A simple syntax highlighting library for web applications
MIT License
I built this after highlight.js
being too heavy, and requiring a custom build to
remove unneeded parsers, and other highlighting packages having similar issues.
git clone [email protected]/github.com/bobbylight/jshighlight.git
cd jshighlight
npm install
npm run build # Compiles source and builds the library into lib/
npm run dev # Runs a demo app and watches for changes
The demo application will be hosted at file://path/to/jshilight/demo/index.html.
To run tests:
npm test # Tests only
npm run coverage # Generates coverage report
The generated coverage report lives here:
open coverage/index.html
import highlighter from 'jshighlight/lib/highlighter';
import JsonParser from 'jshighlight/lib/parsers/json-parser';
...
const html: string = highlighter.highlight(new JsonParser(), jsonStr);