0.2.2 • Published 10 years ago

eshighlight v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

eshighlight Build Status

JavaScript code highlighter based on esprima.

Install

npm install eshighlight

Usage

Takes a JavaScript string, returns an html string.

var highlight = require('eshighlight');

highlight('var x = 42');

which returns:

<span class="keyword">var</span> <span class="identifier">x</span> = <span class="numeric">42</span>

Prior Art

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, eshighlight has the drawbacks that it does not support languages besides JavaScript and only works in node.

License

MIT

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago