2.0.6 • Published 3 years ago

highlightjs-lox v2.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Lox syntax support for highlight.js

This repository provides syntax highlighting for the Lox language using highlight.js.

Dependencies

{
	"highlight.js": "^11.3.1"
}

Usage

Provided in the dist/ folder are 5 versions: iife (for browsers), es, umd, cjs, and amd (+ lox.mjs & lox.cjs in case they're needed). min and map files included also :sunglasses:.

Static HTML

To import lox make sure to include lox.js in the HTML:

<!-- jsdelivr -->
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.3.1/build/highlight.js"></script>
<script src="https://cdn.jsdelivr.net/npm/highlightjs-lox/dist/iife/lox.js"></script>
<!-- unpkg -->
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.3.1/highlight.js"></script>
<script src="https://unpkg.com/highlightjs-lox/dist/iife/lox.js"></script>

and then:

<script>
	hljs.registerLanguage("lox", lox)
	hljs.initHighlightingOnLoad();
</script>

This will find and highlight code inside of <pre><code> tags; it tries to detect the language automatically. If automatic detection doesn’t work for you, you can specify the language in the class attribute:

<pre>
	<code class="lox">
		...
	</code>
</pre>

Node or other build systems

ES Modules, CommonJS, AMD and UMD can all be found in the dist/ folder.

To add the package run:

# npm
npm install highlight.js
npm install highlightjs-lox

# yarn
yarn add highlight.js
yarn add highlightjs-lox

ES6+ module syntax

import hljs from "highlight.js"
import lox from "highlightjs-lox"

hljs.registerLanguage("lox", lox)
hljs.initHighlightingOnLoad()

CommonJS syntax

const hljs = require("highlight.js")
const lox = require("highlightjs-lox")

Demos

If you would like to see some more in depth examples you can check out the demo folder

Building

Go to highlight.js and update lox.js directly into the library. Then run their build tool:

node ./tools/build.js lox

License

2.0.6

3 years ago

2.0.3

3 years ago

1.1.1

3 years ago

2.0.2

3 years ago

1.1.0

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago