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

[FR] highlight/wrap function #16

Open
michaelrog opened this issue Apr 3, 2019 · 0 comments
Open

[FR] highlight/wrap function #16

michaelrog opened this issue Apr 3, 2019 · 0 comments

Comments

@michaelrog
Copy link
Member

Function to parse through some text and replace each occurrence of words/substrings of interest with wrapped/"highlighted" text, e.g. foo to <em>foo</em>.

We'd want options to enable or prevent highlighting/wrapping partial words.

Some examples of how this might work:

"This is example text." | highlight(needle='example', html='<span class="highlight">')
"This is <span class="highlight">example</span> text."

"This is example text." | wrapWords(words=['this', 'example'], before='~', after='%', caseSensitive=false )
"~This% is ~example% text."

"This is example text; this is nifty." | wrap(needle=['this', 'ex'], before='~', after='%', caseSensitive=true )
"This is ~ex%ample text; ~this% is nifty."

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

No branches or pull requests

1 participant