https://github.com/bobbylight/jshighlight
A simple syntax highlighting library for web applications
https://github.com/bobbylight/jshighlight
syntax-highlighting typescript
Last synced: 5 months ago
JSON representation
A simple syntax highlighting library for web applications
- Host: GitHub
- URL: https://github.com/bobbylight/jshighlight
- Owner: bobbylight
- License: mit
- Created: 2017-06-21T03:23:51.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-12-09T06:13:33.000Z (over 1 year ago)
- Last Synced: 2025-10-20T06:40:19.828Z (9 months ago)
- Topics: syntax-highlighting, typescript
- Language: TypeScript
- Size: 420 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsHighlight - Simple syntax highlighting for webapps


[](https://codecov.io/gh/bobbylight/jshighlight)
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
```sh
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 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:
```sh
npm test # Tests only
npm run coverage # Generates coverage report
```
The generated coverage report lives here:
```sh
open coverage/index.html
```
## Consuming the library in a TypeScript application
```typescript
import highlighter from 'jshighlight/lib/highlighter';
import JsonParser from 'jshighlight/lib/parsers/json-parser';
...
const html: string = highlighter.highlight(new JsonParser(), jsonStr);
```