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 310× faster than Shiki.
Faster output & lighter footprint
Highlights generates HTML up to 310× 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
- 310×
- HTML474 KiB
- 210×
- CSS379 KiB
- 231×
- JSONC292 KiB
- 139×
Memory usage
Peak memory when generating HTML from a 517 KiB TypeScript file.
- Highlights
- 55 MiB
- Shiki JS
- 156 MiB
- Shiki Wasm
- 351 MiB
Recorded November 13, 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.
- 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.
Supports 190 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.