markdown
assistant-ui Markdown
Always consult assistant-ui.com/llms.txt for the latest API.
Assistant-ui has two renderers for an assistant text part. MarkdownTextPrimitive is the lightweight react-markdown path and the installed MarkdownText element is its styled implementation. StreamdownTextPrimitive is the alternative when block-aware streaming and optional Shiki, KaTeX, Mermaid, or CJK support are worth the larger renderer.
References
- ./references/markdown-text.md -- install and compose
MarkdownText, customizeMarkdownTextPrimitive, and distinguish inline from fenced code - ./references/syntax-highlighting.md -- install the Shiki or Prism renderer and select one per fenced language
- ./references/latex-mermaid.md -- configure KaTeX, normalize model math, preserve code spans, and gate Mermaid on stream completion
- ./references/streamdown.md -- use the Streamdown alternative, plugins, Tailwind sources, and deferred parsing
Choose the renderer
Use markdown-text when the app needs a small renderer, a custom react-markdown component map, or per-language SyntaxHighlighter and CodeHeader overrides. Add highlighting, math, and Mermaid only when the message format requires them.
Use StreamdownTextPrimitive when a text part needs block-based streaming, incomplete markdown repair, or the optional code, math, Mermaid, and CJK plugins. It replaces the markdown renderer for that text part. Do not mount both renderers for the same part.