I’m looking for a high performance syntax highlighter.
I’ve tried Google prettify, rainbow.js and another one I can’t remember. They all struggle with large blocks of HTML code. They eventually all highlight correctly but the browser freezes for a second or two. Or the text isn’t highlighted and after a couple of seconds when the page has loaded, it appears all at once.
I had a look at how github uses syntax highlighter and I think he reason it works so well is because groups of text have a single span around it rather than each word, meaning better performance.
Anyone know of a JS syntax highlighters that supports HTML code and can render things really quickly?
Would it be possible to do the highlighting on the server? Possibly cashing it so you don’t have to de it every time. If you post your server-side stack info I can give you links to some libs.
If not can do the syntax highlighting in a worker thread if you want to avoid blocking the UI.
Also, here are a list of 9 other highlighters : http://www.webdesignbooth.com/9-useful-javascript-syntax-highlighting-scripts/