kazari is the command line for Kazari, the code block
presentation layer built on Irosashi, a Rust port of Shiki.
It gives any static site framed, syntax highlighted code blocks with VS Code themes, without
touching the site's Markdown pipeline:
process walks a directory of built HTML, recognizes the code blocks Hugo, Jekyll, Eleventy,
mdBook, Sphinx, Zola, Astro and hand written pages emit, recovers the source, re-renders every
block with Kazari (frames, copy button, line markers, dual light and dark themes), splices the
result back while preserving every other byte, and writes kazari.css and kazari.js once with
a link and a script tag injected into each page that needs them. Running it again is a no-op.
The other subcommands render code, Markdown or Typst from a file or stdin, print the assets, and list the bundled themes and languages. No Node, no WASM, no runtime dependencies: one binary.
Install
Prebuilt binaries for Windows (x86_64), Linux (x86_64 and aarch64) and macOS (Intel and
Apple Silicon) are attached to each
GitHub release. Download the archive for your
platform, unpack it, and put kazari on your PATH.
With a Rust toolchain:
Building from source needs only a Rust toolchain (1.94 or later); there is no C dependency.
The binary ships two highlighting backends. irosashi (default) uses VS Code grammars and
themes and matches Shiki byte for byte; syntect uses Sublime Text grammars and syntect's
bundled .tmTheme set, for sites that want their code blocks to look the way syntect
renders them elsewhere. Pick one with --engine on any command or engine: in the config
file. Irosashi is also the faster of the two in this binary (syntect runs on fancy-regex):
about 11 ms against 61 ms for a small file, and 167 ms against 391 ms for a 60-page site
(medians of 7 runs, tools/kazari-bench).
Commands
kazari process [dir] [flags] upgrade code blocks in built HTML under dir (default ".")
kazari render <file|-> render one source file (or stdin) as a decorated HTML block
kazari markdown <file|-> render a Markdown file (or stdin) to HTML
kazari typst <file|-> render one source file (or stdin) as Typst source
kazari css print the page-wide stylesheet
kazari js print the page-wide script
kazari themes list the syntax theme names of a backend
kazari languages list the language names of a backend
kazari version print the kazari version
Run kazari <command> --help for the flags of a command.
process
kazari process [dir] [flags]
--check report would-be changes without writing; exit 1 if any
--config <PATH> config file (default: kazari.config.yaml|.yml|.json in dir, then the working directory)
--engine <NAME> highlighting backend, irosashi or syntect (default irosashi; overrides config)
--theme-light <NAME> light syntax theme (default github-light; overrides config)
--theme-dark <NAME> dark syntax theme (default github-dark; overrides config)
--min-contrast <N> minimum WCAG contrast ratio of token colours, 0 to 21 (default off; overrides config)
--assets-base <URL> fixed asset URL prefix instead of per-file relative paths
--hashed-assets content hashed asset filenames (kazari-<hash>.css) instead of kazari.css
--skip-unlabeled leave blocks without a detectable language untouched
--concurrency <N> files processed concurrently (default: number of CPUs)
--verbose log per-file progress to stderr
The summary line reads N files, N blocks upgraded, N skipped, N suppressed, N changed.
Skipped blocks are ones the processor decided to leave alone (no recognizable shape, a
data-kazari="ignore" attribute, a Mermaid diagram, or an unlabeled block under
--skip-unlabeled). Suppressed blocks sit inside Kazari's own output from an earlier run.
Exit status: 0 on success, 1 from --check when something would change, 2 on a usage,
config, theme, or per-file error.
Assets: kazari.css and kazari.js are written to the root of dir. Pages reference them
by a relative path computed from their depth (../../kazari.css?v=<hash>), so subpath
deployments such as GitHub Pages project sites work unchanged. --assets-base https://cdn/x
makes every page use that prefix instead. --hashed-assets embeds the content hash in the
file name for long-lived caching; old hashed files from previous runs are not removed.
Re-runs and config changes: blocks already rendered by Kazari are skipped, and the link and
script tags from a previous run are rewritten to the current asset hashes even on pages that
have no code blocks. A config change followed by kazari process therefore updates the whole
site in place.
Per-block options in built HTML: a data-kz-meta attribute on the <pre> or <code>
element carries a full fence meta string through the build:
...
Hugo users add it from a render-codeblock.html hook; the meta syntax is the same as the
fence info string documented in the kazari-rs README.
data-kazari="ignore" on the block's root element leaves it untouched.
Recognized shapes:
| Generator | Shape |
|---|---|
| Hugo (Chroma) | div.highlight > pre.chroma > code, inline styles mode, and the lntable line number table |
| Jekyll (Rouge) | div.language-x.highlighter-rouge, the figure.highlight Liquid tag, and rouge-table line numbers |
| Sphinx, Pelican (Pygments) | div.highlight-x > div.highlight > pre and the highlighttable line number table |
| Eleventy (Prism) | pre.language-x > code.language-x |
| Zola | pre[style*=background-color] > code[data-lang] |
| Astro (Shiki) | pre.astro-code[data-language] > code |
| mdBook, markdown-it, hand written | pre > code[class=language-x], with or without a language |
Line number gutters are dropped from the recovered source; Chroma's hl line markers become
{n-m} highlight ranges. Expressive Code output (Starlight) is left alone.
render, markdown, typst
|
&&
--page wraps the output in a standalone HTML page with the stylesheet and script inlined.
Without it, inject kazari css once in <head> and kazari js once before </body>.
markdown enables GFM tables, footnotes, strikethrough, task lists, heading attributes and
code groups; --disable tables,code-groups (or --disable gfm for all five extensions)
turns them off.
typst prints the #code-block template followed by the block; --no-preamble prints only
the block, for appending to a document that already has the template. --font and
--font-size set the block's font family and text size (a Typst length such as 10pt).
--tokens string writes tokens as string arguments instead of raw literals.
All of these accept --config, --engine, --theme-light, --theme-dark and
--min-contrast like process. Contrast correction applies to HTML output, so typst accepts
the flag and ignores it. themes and languages accept --engine too, so
kazari themes --engine syntect lists what that backend knows.
With --engine syntect, theme names are not validated: syntect maps the common VS Code names
to the closest of its seven bundled themes (github-light to InspiredGitHub, github-dark
to base16-ocean.dark, and so on), loads a name ending in .tmTheme from that path, and
falls back to a light or dark bundled theme for anything else.
Configuration
Every command reads kazari.config.yaml (or .yml, .json) from the target directory, then
the working directory; --config names one explicitly. The keys are Kazari's, documented in
the kazari-rs README,
plus an engine key and a process section for this command:
engine: irosashi # or syntect
themes:
light: github-light
dark: github-dark
lineNumbers: true
process:
skipUnlabeled: false
assetsBase: ""
hashedAssets: false
concurrency: 4
maxFileBytes: 33554432
Flags override the file. maxFileBytes (default 32 MiB) skips pages larger than the limit.
Per-generator notes
- Hugo: run
hugothenkazari process ./public. The defaultmarkup.highlightsettings are fine; bothnoClasses = true(inline styles) andnoClasses = falseare recognized, as iscodeFences = false. A render hook can adddata-kz-metafor per-block options. - Jekyll:
jekyll buildthenkazari process ./_site. Kramdown fences and the Liquid{% highlight %}tag are both recognized, with or withoutlinenos. - mdBook:
mdbook buildthenkazari process ./book. Blocks come out as plainpre > code.language-x; mdBook's own highlight.js styling is replaced. - Sphinx:
make htmlthenkazari process ./_build/html.:linenos:tables are handled. - Eleventy: with the syntax highlight plugin,
kazari process ./_site. - Zola:
zola buildthenkazari process ./public. Requireshighlight_code = trueinconfig.toml, which is what produces the recognizabledata-langshape. - Astro: built-in Shiki blocks are recognized; Starlight's Expressive Code blocks are left as they are.
Development
Part of the irosashi workspace.
KAZARI_UPDATE_GOLDEN=1
testdata/unwrap holds one fixture per recognized shape with the expected recovered source;
testdata/corpus holds small sites processed end to end against committed golden trees.
License
Copyright (c) 2026 FrostyBee. Licensed under the MIT License.