New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@pierre/highlights

Package Overview
Dependencies
Maintainers
7
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pierre/highlights

A fast code highlighter written in WebAssembly Text(Wat), from Pierre

latest
npmnpm
Version
0.2.0
Version published
Weekly downloads
1.1K
-56.16%
Maintainers
7
Weekly downloads
 
Created
Source

Highlights, from Pierre

@pierre/highlights is a syntax highlighter written in WebAssembly Text (WAT). It supports 80 built-in languages and Zed-compatible themes. It produces HTML or themed tokens from complete input, input chunks, or document edits.

Read the Documentation.

Installation

pnpm add @pierre/highlights

The package runs in Node.js, browsers, and Cloudflare Workers. It initializes WebAssembly at import. codeToHtml() and codeToTokens() run synchronously after import.

Quick start

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.

Development

moonx highlights:build
moonx highlights:dev
moonx highlights:test
moonx highlights:bench
moonx highlights:bench-live
moonx highlights:bench-memory

Benchmarks · Architecture · Bundled themes

License

Apache-2.0

FAQs

Package last updated on 21 Oct 2026

Related posts