Streamdown
Monthly visits
23K
Listed on
1 directory
Rating
5.0/5
Core 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
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";`.
FAQ
What is Streamdown and how does it differ from react-markdown?
Streamdown is a drop-in replacement for react-markdown, specifically designed for AI-powered streaming. It offers enhanced features like built-in typography, GFM support, interactive code blocks, math expressions, Mermaid diagrams, and security hardening, all optimized for streaming content.
Does Streamdown support incomplete Markdown during streaming?
Yes, Streamdown comes with built-in support for parsing and fixing unterminated Markdown blocks (e.g., unclosed headings, code blocks, lists), which makes streaming Markdown content appear much prettier and more readable.
How does Streamdown handle security for streamed content?
Streamdown includes built-in security hardening to ensure that untrusted markdown does not contain images from and links to unexpected origins, which might be subject to prompt injection, thereby enhancing the safety of your application.
Can I customize the appearance of code blocks or other Markdown elements?
Yes, Streamdown allows extensive customization. You can use custom React components for rendering markdown elements, specify Shiki themes for code blocks, and integrate various rehype and remark plugins for processing HTML and Markdown.
Similar tools
All Streamdown alternatives →A platform to compare AI coding models and generate multi-file apps side-by-side.
An AI-powered agentic development platform and IDE.
A platform connecting researchers with verified participants for high-quality data collection.
AI-powered platform to build fully-functional apps in minutes with no code.