Beta

Highlight diffs and code

@pierre/highlights is a super-fast, lightweight syntax highlighter hand-written in WebAssembly Text. Built especially for @pierre/diffs. Includes built-in language lexers, runs across JavaScript runtimes, and supports Shiki-compatible formats. Generates large-file HTML up to 298× faster than Shiki.

Explore the docs

Faster output & lighter footprint

Highlights generates HTML up to 298× faster than Shiki and uses about a third of its memory.

Super-fast HTML generation

Speedup over Shiki when generating HTML from large files.

TypeScript517 KiB
298×
HTML474 KiB
220×
CSS379 KiB
244×
JSONC292 KiB
157×

Memory usage

Peak memory when generating HTML from a 517 KiB TypeScript file.

Highlights
50 MiB
Shiki JS
155 MiB
Shiki Wasm
349 MiB

Recorded October 5, 2026 · Shiki 4.4.1 · Apple M4 Pro. Speedup is median throughput relative to Shiki. Memory is median peak process RSS from five fresh processes, including the runtime. See the HTML generation and memory usage benchmarks.

Compared with other highlighters

Highlights tokenizes 5.56 million characters of JavaScript in .08 s in the browser. Compare it with Shu Ding’s gpu-lexer and other highlighters on the same input.

Processing three.min.js 10×Elapsed time, shorter is faster
Highlights0.2.0 · Tokens
Elapsed time: .08s
gpu-lexer0.0.2 · Spans
Elapsed time: .40s
Sugar High2.3.1 · HTML
Elapsed time: .76s
Prism.js1.30.0 · HTML
Elapsed time: .99s
Highlight.js11.12.0 · HTML
Elapsed time: 1.35s
Starry Night3.11.0 · HAST
Elapsed time: 10.5s
Shiki4.4.3 · Tokens
Elapsed time: 28.3s

Recorded October 21, 2026 · Chromium 153 · Apple M4 Pro. Median of three runs, each after one warm-up in a fresh worker. Highlights and Shiki return themed tokens, gpu-lexer returns spans, and the others return HTML or HAST. Measures speed only, not highlighting quality. View raw results.

Drop-in replacement for Shiki

Set preferredHighlighter: 'highlights' on your @pierre/diffs component or worker pool to try it. Highlights support is in beta, so share feedback as you go.

source.tsxTSX

Supports 80 languages

Highlights ships its language lexers in one small WebAssembly module. No grammar downloads or language registration. Pick a language and edit the example below to try it yourself.

source.tsTypeScript

Fast, familiar, and editor-ready.

Native WebAssembly performance, Shiki-compatible output, and incremental tokenization built for editors.

Native performance

One-pass lexers
Hand-written Wasm lexers emit HTML or token records directly, with no AST or grammar runtime.
Linear memory
Source bytes, lexer state, and output live in WebAssembly linear memory, keeping the lexer's working data off the JavaScript heap.
Zero-copy output
codeToHtml() returns a view into WebAssembly memory, ready for a response, file, or decoder.
SIMD scans
Hot paths read 16 bytes per step, and equal styles share spans across whitespace.

Shiki compatibility

Familiar APIs
Use codeToHtml() and codeToTokens() in familiar highlighting workflows.
Themes included
Includes all of Shiki's built-in community themes, plus Pierre's light and dark themes.
Dual themes
Pass themes to render light and dark in one pass, with Shiki's CSS custom properties or light-dark() colors.
Streaming API
StreamTokenizer emits completed lines of themed tokens as code arrives, preserving lexer state across chunks.

Editor friendly

Incremental edits
LiveTokenizer re-tokenizes only lines whose text or lexer state changed.
Visible-range rendering
Bound synchronous work to the viewport while off-screen lines converge in the background.
Precise updates
Every edit reports exactly which lines changed, leaving untouched rows alone.

Install Highlights

Get started by installing the package manually, or using our agent skills and prompts.

Documentation

With love from The Pierre Computer Company

Collectively, our team brings over 150 years of expertise designing, building, and scaling the world's largest distributed systems at Cloudflare, Coinbase, Discord, GitHub, Reddit, Stripe, X, and others.