Skip to content

Expand functionality like (instead of) highlighting #11

@tebaly

Description

@tebaly

Expand highlighting functionality to wrapping tag/templates.
It would be nice to extract this code in an external plugin.

Why?

I need not to highlight, but to wrap the word found with a link (for example).
It's almost the same as the backlight, just wrapping tag differently. Another replacement pattern.

return '<span style="background: #' + highlightColor + ';">' + match + '</span>';

return '<a href="/another-page">' + match + '</a>';

highlighting like linking specifically applied - additional functionality, not related to finding bad words. It complements the library well. But there must be the possibility of independent expansion.

As I see it

import Highlighting from highlight-this-text-by-span-or-not-span-tag; 
import Wrapper from wrap-specific-tag-this-text;
// ...
Censoring.use(Highlighting);
Censoring.use(Wrapper);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions