Search documentation

↑↓ to move↵ to open

kirari


Kirari compared

Four ways to highlight code. Compare the browser footprint, the APIs, and the trade-offs that matter for your project.

At a glance

Kirari1.1.0 · local buildShiki(opens in a new tab)4.5.0Prism(opens in a new tab)1.30.0highlight.js(opens in a new tab)11.12.0
JavaScript → HTMLKB, minified + gzip4.2 KB73.5 KB5.3 KB11.1 KB
EngineRegex rules and scannersTextMate grammarsRegex grammarsRegex modes
Languages shipped48242297193
ThemingCSS classes and variablesVS Code themes; CSS variables supportedCSS classesCSS classes
APISynchronousSync after setup; synchronous core availableSynchronousSynchronous
Incremental streamingBuilt-in token patches@shikijs/streamNo built-in APINo built-in API
Token offsetsYesYesNoNo
Auto-detectionNoNoNoYes

Streaming performance

Median time to highlight a JavaScript response arriving in 16-character chunks. Lower is better.

Kirari1.1.0 · local buildShiki(opens in a new tab)4.5.0 · JavaScript enginePrism(opens in a new tab)1.30.0highlight.js(opens in a new tab)11.12.0
~2 KiB130 updates2.2 ms27 ms31 ms36 ms
~8 KiB513 updates9.1 ms93 ms510 ms605 ms
~32 KiB2,052 updates64 ms129 ms6.8 s7.6 s

When to pick which

Kirari

Small runtime, live code

For known languages, incremental token patches, and colors controlled by CSS. Lexical rules trade some grammar fidelity for a small runtime.

Shiki

Rich syntax, VS Code themes

For TextMate scopes, embedded languages, and VS Code themes. Supports synchronous setup, CSS variables, and streaming through @shikijs/stream.

Prism

Languages and plugins

For a broad language catalog and an established plugin ecosystem. Languages register on a shared Prism instance; many plugins target the DOM.

highlight.js

Unlabeled code

For automatic language detection when the language is unknown. A modular build lets you register only the languages you need.

Same snippet, four ways

Kirari
import { highlight } from '@vortexlabs/kirari'
import '@vortexlabs/kirari/theme.css'

const html = highlight('const answer = 42')
Shiki
import { codeToHtml } from 'shiki'

const html = await codeToHtml('const answer = 42', {
  lang: 'javascript',
  theme: 'github-dark',
})
Prism
import Prism from 'prismjs'

const html = Prism.highlight(
  'const answer = 42',
  Prism.languages.javascript,
  'javascript',
)
highlight.js
import hljs from 'highlight.js/lib/core'
import javascript from 'highlight.js/lib/languages/javascript'

hljs.registerLanguage('javascript', javascript)
const html = hljs.highlight('const answer = 42', {
  language: 'javascript',
}).value