Streamdown
FreeA markdown renderer designed for streaming content from AI models.
About Streamdown
Streamdown is a drop-in replacement for react-markdown, specifically designed for AI-powered streaming. It was built to enable the streaming of safe and perfectly formatted Markdown content without complex handling, powering components like the AI Elements Response component. It can be installed and used as a standalone package, offering features like built-in typography styles, GitHub Flavored Markdown support, interactive code blocks with Shiki highlighting, mathematical expressions via LaTeX and KaTeX, interactive Mermaid diagrams, and robust security hardening against prompt injection.
How to Use
To use Streamdown, you can install it directly with npm i streamdown or via npx ai-elements add response. Integrate it into your React application by using the <Response> component (if using AI Elements) or the Streamdown component itself to render Markdown content. Additionally, you need to update your Tailwind globals.css file to include Streamdown's styles by adding @source "../node_modules/streamdown/dist/index.js";.
Key Features
- Drop-in replacement for react-markdown
- Designed for AI-powered streaming
- Built-in typography styles with Tailwind classes
- Supports GitHub Flavored Markdown (GFM)
- Interactive code blocks with Shiki highlighting and copy button
- Supports LaTeX mathematical expressions via remark-math and KaTeX
- Supports interactive Mermaid diagrams with render button
- Parses and styles unterminated Markdown blocks for prettier streaming
- Built-in security hardening against prompt injection (image/link origin validation)
- Customizable via props for components, allowed prefixes, plugins, and Shiki themes
Use Cases
- Rendering AI-generated streaming Markdown content in web applications
- Building chat interfaces or response components for AI models
- Displaying complex Markdown content with advanced features (math, diagrams, code) in React applications
- Ensuring secure Markdown rendering from untrusted sources
Key Features
Pros & Cons
- Specifically designed for streaming AI content, with caret indicators and animation support
- Comprehensive built-in features: typography, GFM, interactive code blocks, math, diagrams, and CJK support
- Security hardening against prompt injection and link safety modals
- Highly customizable: override any element, apply custom styles, and fine-tune behavior
- Tree-shakeable plugins keep bundle size minimal
- Only works with React applications and requires React environment
- Plugins are optional but add complexity and may require additional setup
Best For
Alternatives to Streamdown
Dynaboard AI
Accelerate Software Development with Dynaboard AI
Coderabbit
Transform Code Reviews with CodeRabbit's AI-Powered Tools
Point-e
Boost Your Development Workflow Using OpenAI's Point-E on GitHub
Open Interpreter
Transform your computing experience using Open Interpreter.
Devin - The World's First AI Coder
Devin: World's First Fully Autonomous AI Software Engineer
Smudge
Effortlessly choose, convert, and share your color palettes.