Streamdown

A drop-in react-markdown replacement built for AI-powered streaming interfaces.

Library
npm
v2.7.1
5,721 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
85 /100 Excellent
Development Activity 100
Maintenance 100
Community 64
Maturity 36
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 85
Code Quality 85
Innovation 85
Learning Curve 70

Streamdown is a React markdown-rendering component purpose-built for the failure modes that show up when you render text as it streams token-by-token from a large language model. Ordinary markdown renderers choke on unterminated code fences, half-written tables, and dangling list markers because they assume a complete, well-formed document; Streamdown instead repairs and parses incomplete markdown incrementally, block by block, so the UI never flashes broken formatting while a response is still arriving.

It ships as a near drop-in swap for react-markdown, adding GitHub Flavored Markdown, KaTeX math, Mermaid diagrams, and Shiki-powered code highlighting out of the box, plus security-first sanitization via rehype-harden. It powers the Message component in Vercel’s AI Elements and AI SDK ecosystem but works standalone in any React app that needs to render streaming AI output.

What You Get

  • A <Streamdown> React component that is a near drop-in replacement for react-markdown, accepting the same components, remarkPlugins, and rehypePlugins props
  • Streaming-safe incremental parsing that repairs unterminated code fences, tables, and lists before each render so output never flashes broken formatting
  • Built-in GitHub Flavored Markdown (tables, task lists, strikethrough) via remark-gfm
  • Optional plugin packages for KaTeX math, Mermaid diagram rendering, Shiki code highlighting with copy/download controls, and CJK-friendly text handling
  • Security-first sanitization by default via rehype-sanitize and rehype-harden, with configurable allowed tags and a link-safety confirmation modal
  • Fine-grained controls for animated character-by-character reveal, RTL/LTR text direction detection, i18n string overrides, and a Tailwind class prefix option

Common Use Cases

  • Rendering assistant responses in an LLM chat UI while the response is still streaming from the model
  • Displaying AI-generated content that mixes prose, code blocks, tables, and diagrams without waiting for the full response to complete
  • Building chat and copilot interfaces on top of the Vercel AI SDK’s useChat hook, where Streamdown is the standard rendering layer for message parts

Under The Hood

Architecture Streamdown’s Streamdown component (packages/streamdown/index.tsx) splits incoming markdown into independently-memoized Block components via parseMarkdownIntoBlocks (lib/parse-blocks.tsx), so only the last, still-changing block re-renders during a stream while earlier blocks stay frozen by React’s memo. Before parsing, the remend sibling package rewrites unterminated markdown constructs (open fences, dangling table rows) so the underlying unified/remark/rehype pipeline never sees invalid input. A single combined StreamdownContext carries theme, controls, and mode state to avoid deep provider nesting, and an internal PluginContext lets optional @streamdown/* packages (math, mermaid, code, cjk) register their own remark/rehype plugins without the core package depending on them directly.

Tech Stack The package is TypeScript-first, targeting React 18/19 as peer dependencies, and is built on the unified ecosystem (remark-parse, remark-gfm, remark-rehype, rehype-sanitize, rehype-raw) with marked’s Lexer used specifically for block-boundary detection. Sanitization is hardened via rehype-harden, and styling uses clsx + tailwind-merge with a custom createCn prefixing helper so consumers on Tailwind v4’s prefix() feature aren’t broken. It’s published from a Turborepo/pnpm monorepo (packages/streamdown plus sibling remend, @streamdown/code, @streamdown/math, @streamdown/mermaid, @streamdown/cjk) built with tsup.

Code Quality The streamdown package alone has 75 test files under __tests__/ covering individual concerns (footnotes, RTL support, code-block hydration, KaTeX lazy-loading, link safety, mermaid pan/zoom, table CSV export, etc.), plus a __benchmarks__/ suite comparing performance directly against react-markdown. CI (.github/workflows) runs pnpm test and pnpm check (Biome/Ultracite lint + format) on every push. Source comments frequently explain non-obvious performance and correctness decisions (e.g. why block keys are index-based rather than content-hash-based, why a regex was changed to fix a footnote-matching bug), indicating an actively maintained, defect-aware codebase.

API Design The component intentionally mirrors react-markdown’s prop surface (components, remarkPlugins, rehypePlugins) so migration is close to a one-line import swap, while layering streaming-specific props (mode, isAnimating, parseIncompleteMarkdown, animated) with sensible defaults (mode="streaming", sanitization on, controls on). Optional capabilities (math, mermaid, code highlighting, CJK handling) are opt-in via a plugins prop backed by separate installable packages, keeping the core bundle lean for consumers who don’t need them.

Used by 98 apps in this directory

Python
62%
Apache 2.0

marimo

Data Engineering · Developer Tools

23,309

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
90
Repo Health
91
Technical
65
Dependency
Built with
Python 62%
TypeScript 37%
Updated 6 days ago
JavaScript
98%
Other

Markdrop

Note Taking

360

Visual drag-and-drop markdown editor with GitHub-specific blocks, cloud sync, and offline PWA support

View details
38
Repo Health
57
Technical
69
Dependency
Built with
JavaScript 98%
Updated 7 months ago
TypeScript
96%
AGPL 3.0

Midday

Invoicing Finance · Productivity

15,091

All-in-one AI-powered business operations platform for freelancers and solo entrepreneurs to manage invoicing, time tracking, banking, and financial intelligence.

View details
51
Repo Health
78
Technical
67
Dependency
Built with
TypeScript 96%
Updated 4 months ago
TypeScript
88%
MIT

Mistle

AI Agents · Developer Tools

95

Self-hostable platform for running autonomous coding agents in isolated, credentialless sandboxes with brokered credentials, reusable snapshots, and event-driven triggers.

View details
50
Repo Health
76
Technical
70
Dependency
Built with
TypeScript 88%
Rust 11%
Updated 4 weeks ago
TypeScript
88%
MIT

Mistle

AI Agents · Developer Tools

95

Self-hostable platform for running autonomous coding agents in isolated, credentialless sandboxes with brokered credentials, reusable snapshots, and event-driven triggers.

View details
50
Repo Health
76
Technical
70
Dependency
Built with
TypeScript 88%
Rust 11%
Updated 4 weeks ago
TypeScript
88%
MIT

Mistle

AI Agents · Developer Tools

95

Self-hostable platform for running autonomous coding agents in isolated, credentialless sandboxes with brokered credentials, reusable snapshots, and event-driven triggers.

View details
50
Repo Health
76
Technical
70
Dependency
Built with
TypeScript 88%
Rust 11%
Updated 4 weeks ago
TypeScript
84%
Apache 2.0

nao

AI Development · Analytics

1,949

Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.

View details
85
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 84%
Python 15%
Updated 6 days ago
TypeScript
84%
Apache 2.0

nao

AI Development · Analytics

1,949

Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.

View details
85
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 84%
Python 15%
Updated 6 days ago
TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers