Streamdown
React Markdown renderer designed for AI streaming, supporting smooth rendering of incomplete markdown, code blocks, math, and diagrams.
Streamdown is an open-source React component library built to render Markdown content specifically optimized for AI-generated streaming output. It functions as a drop-in replacement for react-markdown, but is designed to handle the unique challenges of real-time AI responses where Markdown is delivered token-by-token and may be incomplete.
The library intelligently parses and renders partial Markdown structures such as unfinished code blocks, bold or italic syntax, links, and lists. This allows developers to display streaming AI responses smoothly without visual glitches or broken formatting during generation.
Streamdown also provides rich built-in support for developer-focused content types including syntax-highlighted code blocks (via Shiki), LaTeX math rendering (via KaTeX), Mermaid diagrams, GitHub Flavored Markdown features, and typography styling powered by Tailwind CSS. It includes additional plugins for code, diagrams, math, and CJK text support.
A key aspect of Streamdown is its focus on security and reliability. It includes sanitization layers that protect against malicious HTML, unsafe links, and prompt-injected content, making it suitable for rendering untrusted AI outputs in production applications.
It is widely used in AI chat interfaces, documentation systems, and generative UI applications where streaming text needs to be displayed in a polished, structured, and interactive format.
Key features include:
- AI-optimized Markdown rendering for streaming responses
- Handles incomplete or unterminated Markdown gracefully
- Syntax highlighting with Shiki for code blocks
- LaTeX math and Mermaid diagram support
- Security hardening for untrusted AI-generated content
Common use cases include:
- Building AI chat interfaces
- Rendering streaming LLM outputs
- Creating documentation tools
- Designing generative UI systems
- Powering real-time assistant experiences with formatted responses
Streamdown is developed as part of the Vercel AI ecosystem and is used in AI Elements to provide production-ready Markdown streaming capabilities.
Comments
0Markdown is supported.