vercel/streamdown
A drop-in replacement for react-markdown, designed for AI-powered streaming.
What it solves
It addresses the formatting challenges that occur when streaming Markdown content from AI models. Standard Markdown parsers often struggle with incomplete or unterminated blocks (like a code block that hasn't finished streaming), leading to jarring visual glitches. Streamdown provides a seamless rendering experience by handling these partial blocks gracefully.
How it works
Streamdown acts as a drop-in replacement for react-markdown. It uses remend to parse unterminated blocks and includes memoized rendering to ensure efficient updates as new tokens arrive from the AI. It also integrates with various plugins for specialized content like math and diagrams.
Who it’s for
Developers building AI chat interfaces or applications that stream LLM responses to a React frontend.
Highlights
- Streaming Optimization: Specifically designed to handle incomplete Markdown blocks without breaking the layout.
- Rich Content Support: Supports GitHub Flavored Markdown (tables, task lists), LaTeX equations via KaTeX, and Mermaid diagrams.
- Developer Experience: Easy integration as a
react-markdownreplacement with built-in support for Shiki syntax highlighting. - Security: Uses
rehype-hardento ensure safe rendering of content.
Related
- Project
- Project
- Project
- Project