highlight-js
highlight-js copied to clipboard
Different highlight class
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.
@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?
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.
Hmm. We could do that. Do you want to open a PR for this?
a PR?
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.
@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.