RichMarkdownResponse

Markdown

Markdown that also renders math and Mermaid diagrams.

Use it for
Markdown with math and Mermaid diagrams.
Not for
Plain Markdown; it loads more. Try MarkdownResponse.

RichMarkdownResponse preview

Loading example…

Installation

npm install @stackunseen/ui react-markdown remark-gfm remend remark-math katex mermaid dompurify
import { RichMarkdownResponse } from '@stackunseen/ui/rich-markdown';
Styles: @stackunseen/ui/styles.css

Usage and props

Display a Markdown response as text arrives. RichMarkdownResponse also renders supported math and Mermaid fences. Pass the Markdown text from your response. Install the math and diagram packages and load the KaTeX styles. Diagrams draw once the reply is complete.

textstring
The response so far. Update it as new text arrives.
stateMessageData['state']
The response state from your application, including streaming or complete.
headingLevel1 | 2 | 3 | 4 | 5 | 6 (optional)
Heading level for a Markdown # heading. Defaults to 3; deeper headings stop at 6.
renderCodeBlock(props: MarkdownCodeBlockProps) => ReactNode (optional)
Render fenced code with your own component. Define this callback in your application.
How state and callbacks work
All props

Loading…

For your coding agent

Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.

Contract
text · state · headingLevel? · variant
Keeps honest
Install the math and diagram packages and load the KaTeX styles. Diagrams draw once the reply is complete.
MCP
read_component "RichMarkdownResponse" on the docs endpoint
Open the Markdown file

Keyboard and customization

Keyboard

Tab reaches links and code actions. Wide code blocks can be scrolled with the keyboard. Set headingLevel to fit the page outline.

Customization

Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio