eshighlight-fb

2019-07-10 admin

eshighlight-fb是什么

什么是eshighlight-fb,highlight javascript code based on an esprima-fb with JSX and ES6 support

eshighlight-fb使用教程帮助文档

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

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-69402.html

文章标题:eshighlight-fb

回到顶部