package
A fast code highlighter written in WebAssembly Text(Wat), from Pierre
npm install @pierre/highlightsGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 1 packages.
1.8 MB
Includes dependencies.
@pierre/highlights is a syntax highlighter written in WebAssembly Text (WAT).
It supports 152 built-in languages and Zed-compatible themes. It produces HTML
or themed tokens from complete input, input chunks, or document edits.
Read the Documentation.
pnpm add @pierre/highlightsThe package runs in Node.js, browsers, and Cloudflare Workers. It initializes
WebAssembly at import. codeToHtml() and codeToTokens() run synchronously
after import.
import { codeToHtml } from '@pierre/highlights';
import { pierreDark } from '@pierre/highlights/themes';
const htmlBytes = codeToHtml("console.log('Hello world!')", {
lang: 'js',
theme: pierreDark,
});
const html = new TextDecoder().decode(htmlBytes);codeToHtml() returns UTF-8 HTML bytes that can share WebAssembly memory.
Decode the bytes before the next call to the highlighter. Use .slice() to keep
a copy for later use.
Read the API reference for tokens, input streams, document edits, and themes.
moonx highlights:build
moonx highlights:dev
moonx highlights:test
moonx highlights:bench
moonx highlights:bench-live
moonx highlights:bench-memoryBenchmarks · Architecture · Bundled themes
imownbey
imownbey@gmail.com