brookmd

Streaming markdown for every platform. One Rust core — incremental parse
with speculative closure for mid-stream constructs, stable block identities so
unchanged blocks never re-reconcile — compiled to WASM for the web and to
native libraries for mobile and desktop. Every boundary emits the same
versioned JSON wire, byte-for-byte. 100% CommonMark 0.31 + GFM — 652/652 and
24/24 byte-exact against the reference renderers.
In the browser, wire each LLM stream to a BrookClient and the markdown
renders incrementally off the main thread, block by block — so many
concurrent streams render without melting the UI thread.
Live demo · Full docs & API → · Changelog
npm i brookmd
import { BrookMarkdown } from "brookmd/react";
// `stream` is an AsyncIterable<string> (SSE deltas), a Response, or a ReadableStream
<BrookMarkdown stream={stream} />;
Agent skill
Teach your coding agent brookmd in one command — setup, framework bindings,
components overrides, math, highlighting, security, styling and troubleshooting,
with typechecked examples:
npx skills add siinghd/brookmd # installs into every detected agent
npx skills add siinghd/brookmd -a claude-code # …or pick one
In Claude Code you can install it as a plugin instead:
/plugin marketplace add siinghd/brookmd
/plugin install brookmd@brookmd
Agents that read the repo or the site directly can start from
llms.txt — also served at
md.hsingh.app/llms.txt, with the whole
documentation set concatenated at
md.hsingh.app/llms-full.txt.
Highlights
- Off the main thread — a pooled Web Worker per stream; the parser re-parses
only the active tail on each token, patches cross the worker boundary as
verified splices (emitted bytes stay O(n) even for one giant growing block —
wire delta mode, contract v1.2.0), and heavy renderers (highlighting, math,
mermaid) defer until a block closes.
- SSR-safe — imports and
renderToString cleanly on the server across React,
Vue, Solid, and Svelte; the worker is created lazily on the client.
- Structured
block.data channel (opt-in, default off) — tables, headings,
code, math, and lists are exposed as typed, streaming data on
block.kind.data, so you build toolbars (sort/filter/CSV), tables of contents,
charts, and copy buttons from data — no HTML re-parsing, no AST tree to walk.
- Renderers for every stack — React, Vue 3, Svelte (4 & 5), Solid, a
framework-agnostic
<brook-markdown> Web Component, and a vanilla DOM mount
on the web; a React Native renderer and Swift/Kotlin/Flutter bindings over
the native core (experimental — see Platforms).
- Zero runtime dependencies. The whole engine is one WASM binary plus a small
TypeScript client.
See the package README for the full API,
per-stream config, framework bindings, security model, and scaling helpers
(virtualize, stickToBottom).
Repository layout
Platforms
The same Rust core streams the same versioned JSON wire
(WIRE.md) across every boundary; golden tests
pin every binding to byte-identical output.