Markdown
ProTypography for agent answers: styles the headings, paragraphs, lists, links and inline code of text a parser has already turned into elements.
Playground
Q3 report
Revenue grew 12% quarter over quarter to $1,842,000.
Customers
1,204 new customers joined and churn fell to 1.8%.
Three things stand out in the Q3 report:
- Revenue: $1,842,000, up 12%
- New customers: 1,204
- Churn: 1.8%, down from 2.4%
Next steps:
- Share the report with Priya Raman
- Review churn with Daniel Okafor
- Plan the Q4 launch
Read the Markdown page for the details, or write the rate inline as (q3 - q2) / q2.
The growth rate is one line:
const growth = (q3 - q2) / q2 // 0.12Installation
Markdown comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import { Markdown } from "@wunderui/react"Then use it:
import { Markdown } from "@wunderui/react"
export function Answer() {
return (
<Markdown>
<h2>Q3 summary</h2>
<p>Revenue grew <code>12%</code> quarter over quarter to $1,842,000.</p>
<ul>
<li>New customers: 1,204</li>
<li>Churn: 1.8%</li>
</ul>
</Markdown>
)
}Expected result: You see a bold heading, a paragraph in a lighter text colour with 12% in a small chip, and a bulleted list with two items.
When to use
Use Markdown for
- An assistant reply with headings, paragraphs, lists, links and inline code
- Streamed text that a parser re-renders on every update
- Short release notes or help text that comes from a Markdown source
Use something else for
- Code Block for source code with a language label, a copy button and sideways scrolling
- Table for data in rows and columns that people sort, select or scan
- Chat Message for the bubble, the avatar and the role around a reply
Table
Markdown has no table styling, so tables look like the browser default: no borders or padding. Pass classes to style every table in the answer.
| Metric | Q2 | Q3 |
|---|---|---|
| Revenue | $1,644,000 | $1,842,000 |
| New customers | 1,076 | 1,204 |
| Churn | 2.4% | 1.8% |
| Metric | Q2 | Q3 |
|---|---|---|
| Revenue | $1,644,000 | $1,842,000 |
| New customers | 1,076 | 1,204 |
| Churn | 2.4% | 1.8% |
Newer props
Pass a string and the component renders paragraphs, lists, fences, bold, code and links. onCite turns every [n] marker into a button, renderCitation draws your own. Half markers of a streaming answer stay hidden.
A string with clickable citations
Payouts take 2 business days . Use payout.paid to track them .
- Instant payouts cost 1 %
- Weekends are skipped
Keyboard interactions
Markdown has no interactive part of its own. Links inside are native anchors, so the browser handles focus and activation.
- TaborShift+Tab
- Moves focus to the next or previous link in the text, in reading order.
- Enter
- Follows the focused link.
Text is not focusable. A link shows the browser focus ring unless the parser adds one.
Behavior and motion
What the component does and does not do with Markdown, links, markup and streaming.
- A wrapper, not a parser
- Markdown renders its children inside a styled div. It does not read a Markdown string, so passing one shows raw text: parse it first and pass the elements.
- What is styled
- Styled: h1, h2, p, a, code, ul and ol. Other headings, tables, quotes, rules, images, pre and strong follow the browser and Tailwind defaults.
- Tables
- A table is drawn without borders or padding. Pass classes on Markdown that target th and td, and one string styles every table in the answer.
- Code
- The chip rule matches only inline code, so a CodeBlock inside the box keeps its own look.
- Links
- Links are only styled. The component does not check URLs, add target or rel, or open new tabs, and a javascript: link stays clickable, so check links in the parser.
- Sanitization
- The component sanitizes nothing, so safety lives in the parser. react-markdown builds React elements, escapes raw HTML unless you add rehype-raw, and drops unsafe URL schemes by default.
- Streaming
- Re-render the parser with the longer text on every update. Wrap the reply in a log region and set aria-busy while it grows, so a screen reader reads it once.
- Live region
- Markdown announces nothing itself. The log region around the conversation announces what is added.
- Motion
- None, so there is nothing to reduce. If you animate a reply in, use opacity and transform with the entrance timing and switch it off for reduced motion.
Anatomy
The figure marks a heading, a paragraph with inline code and a link, and a list inside one Markdown box.
- 1
A div that stacks its children in a column with an 8 px gap and sets 14 px text in the foreground colour. It parses nothing: it styles the elements you pass in.
- 2Optional
An h1 (18 px, bold) or an h2 (16 px, bold). Deeper headings have no rule and look like body text.
- 3Optional
Any inline code (not inside a pre): a muted chip with 4 px corners and 12 px text. Code inside a CodeBlock keeps its own look.
- 4Optional
An anchor in the link colour, underlined. It sets no target or rel; add them in the parser.
- 5Optional
A paragraph in the secondary text colour, a step lighter than headings and list items.
- 6Optional
A bulleted or numbered list, indented 20 px. List items keep the foreground colour.
Best practices
- Do
Parse first, then pass the elements as children. A raw Markdown string stays raw.
- Do
Render model text with a parser that builds React elements, such as react-markdown, never with dangerouslySetInnerHTML. Model output and tool results are data and can contain markup.
- Do
Check every link in the parser: allow http, https and mailto, show anything else as plain text, and add rel noopener noreferrer to links that open a new tab.
- Do
Put a CodeBlock in the answer for multi-line code. The chip style only reaches inline code, so the block keeps its own look.
- Do
Style tables with a class on Markdown, because it has no rules for table, th and td.
- Don’t
Don't expect headings below h2, block quotes, images or tables to be styled. Only the listed elements have rules.
- Don’t
Don't override link or paragraph colour with hex values. The tokens follow light and dark.
- Don’t
Don't set aria-live on Markdown to announce a streaming reply. Put a log region around the conversation and set aria-busy while the text grows.
API reference
Markdown is a plain component, so this table lists every prop.
A div that stacks its children in a column with an 8 px gap and sets 14 px text in the foreground colour. It parses nothing: it styles the elements you pass in.
| Prop | Type | Default | Description |
|---|---|---|---|
| children required | ReactNode | — | The elements to style, already parsed: headings, paragraphs, lists, links and inline code. A raw Markdown string is shown as it is. |
| className | string | — | Extra classes for the box. Arbitrary variants such as or reach the elements inside, which is how you style a table or reset the chip on the code of a CodeBlock. |
| citationLabel | (n) => string | — | Accessible name of a citation button made by , for example the source title. Defaults to "Source n". |
| onCite | (n) => void | — | Makes every [n] marker a button that calls this with the number. |
| renderCitation | (n) => ReactNode | — |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("markdown")The full library index for assistants is at /llms.txt.