Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand functionality like (instead of) highlighting #11

Open
tebaly opened this issue Jun 3, 2018 · 1 comment
Open

Expand functionality like (instead of) highlighting #11

tebaly opened this issue Jun 3, 2018 · 1 comment

Comments

@tebaly
Copy link
Contributor

tebaly commented Jun 3, 2018

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);
@RWOverdijk
Copy link
Member

Good idea. The replacer method is quite easy right now.

You might like something like procurator more, which allows you to implement your own replacers. Otherwise, PRs are welcome! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants