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

Different highlight class #4

Open
oozrafa opened this issue Apr 4, 2013 · 6 comments
Open

Different highlight class #4

oozrafa opened this issue Apr 4, 2013 · 6 comments

Comments

@oozrafa
Copy link

oozrafa commented Apr 4, 2013

Hey!

I was wondering if there's a way to add different classes for each word when an array is used. This way each word can have a different highlight colour.

@tankchintan
Copy link
Owner

@oozrafa That might be slightly complicated. Of course we can modify the array to be an array of objects like so [{pattern: "multi", highlightClass: "rainbow"}] instead of just array of Strings. But then how are we gonna implement the removeHighlight method? Remember there is no instance variable where we can store the state of what highlight classes were used. Even if we hacked it to save that, I am slightly concerned about the performance hit. Do you want to create a quick prototype on http://jsfiddle.com or something and use http://jsperf.com/ to measure the performance on differing sized corupses?

@oozrafa
Copy link
Author

oozrafa commented Apr 4, 2013

Maybe remove highlight could also accept an array of classes as an argument when triggered, and if none is specified then use the default one.

@tankchintan
Copy link
Owner

Hmm. We could do that. Do you want to open a PR for this?

@oozrafa
Copy link
Author

oozrafa commented Apr 9, 2013

a PR?

@tankchintan
Copy link
Owner

Oh. I am sorry I meant Pull Request. Basically make the changes in your copy of forked/cloned code and submit a request for me to merge the changes.

@julkue
Copy link

julkue commented Jan 7, 2016

@oozrafa I have another project started as a fork of the same plugin as highlight-js from @tankchintan. Then I refactored everything. The plugin supports the feature which you missed, and a lot of others too.

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

3 participants