I came across Syntax highlighting code with Javascript, which explains very well how to do syntax highlighting on the client side.
Right now, I'm scraping sites and would like to do the syntax highlighting on the server side, as I'm scraping. We're using node.js cheerio to get some of the basic jQuery features as we're scraping. Is there a simple javascript library that works with cheerio (not a full-fledged jQuery) that lets me do something along the lines of:
var highlightedCode = JsCodeSyntaxHighlighter.highlightCode(...);
where ... is raw HTML.
Or, can I accomplish that with prettify or jQuery syntax highlighter (i.e. does jQuery syntax highlighter only rely on functionality that cheerio provides?).
The reason I need to do this server-side and not client-side is because we load thousands of code divs on the client at once (mostly hidden, but still), and running jQuery syntax highlighter on thousands of snippets takes a few seconds, which is too slow.