Ultrafast, lightweight streaming Markdown for React and AI replies
Its own parser · 0 dependencies · 37 KB gzipped · 16× faster on a long stream
flowdown.localix.ai · Get started · Syntax · API · Comparison · Rust
One reply, streamed twice: by <Markdown> on a page and by @localix-ai/flowdown/tui in a terminal.
flowdown draws a model's reply as it arrives: GitHub Markdown, plus the forms a model can write and a reader can scan, such as steps, tabs, headline figures, pros and cons, callouts, folded sections, sources, file trees, titled code, diagrams and math. Nothing flickers, and no raw syntax shows while the text is still coming in. It works in React, on a page with no framework, on a server and in a terminal, and a Rust crate reads the same dialect.
| npm | npm install @localix-ai/flowdown |
| pnpm | pnpm add @localix-ai/flowdown |
| bun | bun add @localix-ai/flowdown |
| yarn | yarn add @localix-ai/flowdown |
| Cargo | cargo add flowdown --git https://github.com/localixai/flowdown --tag rust-v0.1.0 |
import { Markdown } from '@localix-ai/flowdown'
import '@localix-ai/flowdown/styles.css'
export function Reply({ text, done }: { text: string; done: boolean }) {
return <Markdown streaming={!done}>{text}</Markdown>
}<Markdown> needs React 18 or 19. A model writes the forms once its system prompt teaches them:
add answerFormatPrompt() from @localix-ai/flowdown/prompt
(prompting).
- Fast. A 100k-character reply streams in 0.15 s. The next fastest renderer takes 2.4 s, and Streamdown takes 6.5 s.
- Linear. A reply four times longer costs 2.5 times more, not sixteen, and no update takes more than 5 ms.
- Repairs a reply mid-stream. Unfinished
**bold, half-typed links and open code fences never show their raw syntax. - Complete. Its parser passes every example of CommonMark and of GitHub's extensions (conformance).
- Light. One package with no dependencies, 37 KB gzipped, styled without Tailwind.
- Safe. Raw HTML from a reply is sanitized, and links are held to safe protocols.
Every figure, how it was measured, and the cases where another renderer suits better are in the comparison.
Formulas as MathML, with a math font of its own and no dependency (math).
One package covers every target, each behind its own import path. Only the first one imports React.
| Import | Draws |
|---|---|
@localix-ai/flowdown |
React elements |
@localix-ai/flowdown/static |
HTML text, for a server or an email |
@localix-ai/flowdown/dom |
a page with no framework, kept up to date in place |
@localix-ai/flowdown/element |
<flow-down>, for Vue, Svelte, Solid or Angular |
@localix-ai/flowdown/tui |
the rows of a terminal |
Each target's options are in other targets. Further entries
give you the pieces for a renderer of your own: the parser (/engine), a growing reply as blocks
(/document), a remark plugin (/remark), the prompt (/prompt), and code, math and diagrams
(/highlight, /math, /mermaid). The API lists them all.
A Rust crate with no dependencies reads the same dialect into a tree, for a terminal, a server or an agent written in Rust. It is held to the same specifications as the npm package, passes the same cases of the dialect's forms (spec/) and teaches a model with the same prompt.
[dependencies]
flowdown = { git = "https://github.com/localixai/flowdown", tag = "rust-v0.1.0" }let doc = flowdown::parse("> [!STEPS] Cut a release\n1. **Run the checks**\n2. **Tag it**\n");It builds its tree faster than pulldown-cmark pulls its events. What it reads, how fast and how
it is made: crates/flowdown and
the Rust crate page of the docs.
Everything is at flowdown.localix.ai:
- Start: introduction · getting started · comparison
- Writing: syntax · prompting · conformance
- Rendering: streaming · styling · components · math · diagrams · highlighting · security
- Beyond React: other targets · extensions and remark · the Rust crate
- Recipes: Vercel AI SDK · a documentation site · migrating
- Reference: API · releases of the npm package and of the Rust crate
bun install
bun run test # the library's tests
bun run check # the build's exports, types and entry isolation
bun run bench # the benchmarks, against other renderers
crates/flowdown/scripts/check # the Rust crate: fmt, clippy, tests, docs, the wasm build| Folder | What it holds |
|---|---|
packages/flowdown |
The npm package. |
crates/flowdown |
The Rust crate, with its own benchmarks. |
spec/ |
What both parsers are held to: CommonMark's and GitHub's specifications, and the dialect's forms. |
docs/ |
The documentation, each file a page of the site. |
site/ |
flowdown.localix.ai. |
bench/ |
The benchmarks every published figure comes from. |
How to work on it: CONTRIBUTING.md.


