# Brookmd – streaming Markdown renderer in Rust (web, RN, Swift and more)

> Source: <https://github.com/siinghd/brookmd>
> Published: 2026-07-21 21:41:10+00:00

**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.

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 →](/siinghd/brookmd/blob/main/packages/brookmd/README.md)

[Changelog](/siinghd/brookmd/blob/main/packages/brookmd/CHANGELOG.md)

```
npm i brookmd
js
import { BrookMarkdown } from "brookmd/react";

// `stream` is an AsyncIterable<string> (SSE deltas), a Response, or a ReadableStream
<BrookMarkdown stream={stream} />;
```

**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](#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`

).| Path | What |
|---|---|
`packages/brookmd` |

`crates/brookmd-core`

[crates.io](https://crates.io/crates/brookmd-core); compiled to WASM for the npm package. Emits the versioned JSON[wire contract](/siinghd/brookmd/blob/main/crates/brookmd-core/WIRE.md).`crates/brookmd-ffi`

`crates/brookmd-cabi`

`packages/brookmd-react-native`

[(experimental).](https://www.npmjs.com/package/brookmd-react-native)`brookmd-react-native`

`packages/brookmd-flutter`

`bindings/kotlin`

`bindings/swift`

`web`

[md.hsingh.app](https://md.hsingh.app/)).The same Rust core streams the same versioned JSON wire
([WIRE.md](/siinghd/brookmd/blob/main/crates/brookmd-core/WIRE.md)) across every boundary; golden tests
pin every binding to byte-identical output.

| Platform | Use | Status |
|---|---|---|
| Browser / Node / SSR |
`brookmd` |

**Stable**— published[on crates.io](https://crates.io/crates/brookmd-core)`brookmd-core`

**Stable**— published[on npm — native parser via JSI, RN renderer](https://www.npmjs.com/package/brookmd-react-native)`brookmd-react-native`

[— SPM package](/siinghd/brookmd/blob/main/bindings/swift)`bindings/swift`

`BrookMd`

over an XCFramework[— Android library + uniffi bindings](/siinghd/brookmd/blob/main/bindings/kotlin)`bindings/kotlin`

[over the C ABI](/siinghd/brookmd/blob/main/packages/brookmd-flutter)`packages/brookmd-flutter`

[+](/siinghd/brookmd/blob/main/crates/brookmd-cabi)`crates/brookmd-cabi`

`include/brook_md.h`

Swift/Kotlin/C-ABI bindings ship prebuilt from CI as checksummed
[release assets](https://github.com/siinghd/brookmd/releases) (Android `.so`

per ABI, Apple XCFrameworks with iOS + macOS slices); the React Native package
vendors its binaries in the npm tarball.

```
bun install
bun run build:wasm        # compile the Rust core → WASM
cd packages/brookmd && bun test
```

CI enforces the CommonMark 652/652 + GFM conformance floors, the JS test suite, a fresh-process SSR cold-import check, and that the published tarball ships the WASM.
