Streamdown is a React-oriented package meant as a drop-in stand-in for react-markdown when model output arrives token by token.
Overview
Streamdown renders Markdown that arrives incrementally from AI models, where ordinary Markdown parsers struggle with incomplete or unterminated blocks. It targets the streaming case rather than static documents.
It can replace react-markdown in existing setups and also powers the AI Elements Message component, or be installed alone for custom streaming UIs. Parsing handles unfinished blocks with help from remend, and supports GitHub Flavored Markdown, LaTeX via KaTeX, Mermaid diagrams, and syntax highlighting with Shiki.
Security-oriented hardening is built in through rehype-harden, and rendering is memoized for efficient updates as new chunks arrive. Tailwind and shadcn-style CSS variables are expected for correct styling unless you already use that design setup.
Optional plugins extend code, CJK, math, and Mermaid behavior, and you can supply a fallbackComponent for tags outside the built-in map while overriding specific tags through a components map.
Key features
- Incomplete Markdown while streaming
- GitHub Flavored Markdown
- KaTeX math rendering
- Mermaid diagram blocks
- Shiki code highlighting
- Security-focused HTML hardening
- Memoized render updates
- Custom tag fallback component
Use cases
- AI chat message rendering
- Streaming assistant interfaces
- Token-by-token Markdown display
- React apps using the AI SDK