hljs-kql
v0.1.0
Published
Kusto Query Language (KQL) grammar for Highlight.js
Maintainers
Readme
hljs-kql
Kusto Query Language (KQL) syntax highlighting for Highlight.js.
KQL is used by Azure Data Explorer, Azure Monitor, Microsoft Sentinel, and other Microsoft data services.
Install
npm install highlight.js hljs-kqlUse
import hljs from "highlight.js/lib/core";
import kql from "hljs-kql";
hljs.registerLanguage("kql", kql);
const result = hljs.highlight(
"StormEvents | where State == 'FLORIDA' | summarize count()",
{ language: "kql" }
);The grammar registers kql and kusto as aliases.
Browser distribution
Build and test everything with:
npm install
npm run buildThe build script:
- Clones Highlight.js
11.11.1into.cacheon the first run. - Links this repository into
highlight.js/extra/hljs-kql. - Runs the standalone package tests.
- Installs the Highlight.js build dependencies.
- Lints the grammar with the Highlight.js ESLint configuration.
- Builds Highlight.js for Node.js and runs the third-party markup tests.
- Generates
dist/kql.min.jsanddist/kql.es.min.js.
The cached checkout is reused by later builds and is excluded from Git. Delete
.cache if you need to recreate it.
Develop and test
For only the fast standalone tests:
npm install
npm testUse npm run build before committing grammar or distribution changes. CI runs
the same command and rejects stale files in dist.
The grammar follows the official Kusto token grammar and the Highlight.js language contribution guide.
License
MIT
