localixai/flowdown
À propos
Ultrafast, lightweight streaming Markdown for React and AI replies
Développement web et applicatifProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +4
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
Original
flowdown
Ultrafast, lightweight streaming Markdown for React and AI replies
Its own parser · 0 dependencies · 40 KB gzipped · 16× faster on a long stream
flowdown.localix.ai · Get started · Syntax · API · Comparison · Rust
One reply, streamed and then worked twice: by <Markdown> on a page, with the pointer, and by @localix-ai/flowdown/tui in a terminal, with keys.
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.3.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).
Why
- 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, 40 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).
Generative Markdown
A reply can do more than tell: colour the words that matter, put a calculator in a card, recount a figure as the reader drags a slider, send a questionnaire back filled in. Generative Markdown is that reply written as text, tags with Markdown inside them and values in braces, drawn on a page or in a terminal, with nothing in it run as code. The two cards at the top of this page are such a reply, worked on a page and in a terminal. Its text is tags like these:
<state minutes={15} />
<card>
<slider bind="minutes" min=1 max=30 label="Running time" unit="min" />
<metric label="Cost a month" value={`€${(minutes * 0.6).toFixed(2)}`} />
</card>
@localix-ai/flowdown/widgets reads it and writes the prompt that teaches it, by the sections a
page chooses; /widgets/react and /widgets/tui draw it, and hand what the reader does to the
page as typed events through a policy of the page's own
(Generative Markdown).
Beyond React
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), code, math and diagrams
(/highlight, /math, /mermaid), and questions and flash cards a reader answers (/quiz,
/quiz/react). The API lists them all.
In Rust
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.3.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. Beside it,
flowdown-widgets works a reply's components as the npm
package does: state, expressions, {#each} and {#if}, and what a press does, with the prompt
for the sections a host chooses. What it reads, how fast and how it is made:
crates/flowdown and
the Rust crate page of the docs.
Documentation
Everything is at flowdown.localix.ai:
- Start: introduction · getting started · comparison
- Writing: syntax · prompting · conformance
- Rendering: streaming · styling · components · math · diagrams · Generative Markdown · questions and cards · 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
Development
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.
Support
flowdown is free and made by a small lab without investors. If it saves you time, you can buy us a coffee.
Contributing
Start with CONTRIBUTING.md: what a change keeps, and the checks.
License
Explorer des projets similaires
Chargement…

