0.3.3 • Published 3 years ago
jshighlight v0.3.3
jsHighlight - Simple syntax highlighting for webapps
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.
Install
git clone git@github.com/github.com/bobbylight/jshighlight.git
cd jshighlight
npm install
npm run build # Compiles source and builds the library into lib/
npm run watch # Compiles demo app into demo/ 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
Consuming the library in a TypeScript application
import highlighter from 'jshighlight/lib/highlighter';
import JsonParser from 'jshighlight/lib/parsers/json-parser';
...
const html: string = highlighter.highlight(new JsonParser(), jsonStr);