« All posts

Brookmd: a Rust-powered streaming Markdown renderer for every platform

Brookmd is an open-source Rust core for streaming Markdown rendering across web, React Native, Swift, and Kotlin with a shared JSON wire format.

Brookmd introduces a single Rust core that incrementally parses streaming Markdown — the kind produced by LLM outputs — using speculative closure for mid-stream constructs and stable block identities so unchanged blocks skip re-reconciliation. That core compiles to WASM for the web and to native libraries for mobile and desktop, with every platform emitting the same versioned JSON wire byte-for-byte.

On the web, rendering happens off the main thread via a pooled Web Worker per stream, re-parsing only the active tail on each token so many concurrent LLM streams render without blocking the UI. It ships renderers for React, Vue, Svelte, Solid, a framework-agnostic Web Component, and SSR support across major frameworks. An opt-in structured block.data channel exposes tables, headings, code, and math as typed streaming data, letting developers build UI like tables of contents or copy buttons without re-parsing HTML or walking an AST.

React Native, Swift, Kotlin, and Flutter bindings are experimental but validated via CI golden tests ensuring byte-identical output across platforms. The project targets 100% CommonMark 0.31 + GFM conformance and is released under MIT — a practical option for teams needing consistent Markdown rendering across web and native surfaces from one codebase.