highlightjs-lox
v2.0.6
Published
Lox syntax support for highlight.js
Downloads
152
Readme
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/[email protected]/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/[email protected]/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