npm install eshighlight
var highlight = require('eshighlight'); highlight('var x = 42');
<span class="keyword">var</span> <span class="identifier">x</span> = <span class="numeric">42</span>
Before writing this, I looked at these solutions:
The main motivation for this library was so I can make my blog to look like sublime. None of the highlighters I looked at let you color parameters. I want that nice orange on my params yo.
I didn’t like that they all only tokenized rather than doing a proper parse. I think the parse tree approach might be interesting.
Compared to highlight.js and google-code-prettify,