@zag2art/highlightjs-zig
v1.0.0
Published
Zig 0.16 syntax highlighting grammar for highlight.js
Maintainers
Readme
highlight.js grammar for Zig
Syntax highlighting for Zig 0.16 using the standard highlight.js scopes. The grammar recognizes Zig keywords, primitive types, arbitrary-width integer types, builtins, literals, comments, quoted identifiers, strings, multiline string lines, numbers, and operators.
This package is a maintained fork of
highlightjs-zig. It keeps
the original MIT license and adds executable compatibility and grammar tests.
Install
npm install highlight.js @zag2art/highlightjs-zigRegister the grammar before highlighting Zig blocks:
const hljs = require("highlight.js/lib/core");
const zig = require("@zag2art/highlightjs-zig");
hljs.registerLanguage("zig", zig);Then use the normal highlight.js language class:
<pre><code class="language-zig">const std = @import("std");</code></pre>The CommonJS export also exposes default and zigLanguageSupport aliases for
interop with existing consumers of the upstream package.
Compatibility
- highlight.js:
>=11.10.0 <12 - Zig syntax baseline: 0.16.0
- License: MIT
This package provides highlighting only. It does not compile, format, or run Zig code and does not require custom CSS beyond a normal highlight.js theme.
