Markdown
A small, safe renderer for a summary written in markdown.
Overview
Text that arrives as markdown, such as an agent's summary, shown on a page.
Summary
Do
What I did
- HC-142 shipped the EmptyState
- Fixed the Pill label wrap
Next
Review the Steps copy.
import { Markdown } from "@hackcove/ui";
<Markdown
md={
"## What I did\n- **HC-142** shipped the EmptyState\n- Fixed the Pill label wrap\n\n" +
"### Next\nReview the Steps copy."
}
/>Markdown renders ## and ### headings, - bullets, **bold** and plain paragraphs, as text nodes and never as HTML.Don't
# What I did
1. Shipped the EmptyState
2. Fixed the Pill
See [the ticket](https://example.com) and `bun install`.
import { Markdown } from "@hackcove/ui";
<Markdown
md={
"# What I did\n1. Shipped the EmptyState\n2. Fixed the Pill\n\n" +
"See [the ticket](https://example.com) and `bun install`."
}
/># title, a numbered list, a link or a code span is not supported: each shows as literal text.Usage
- Pass the markdown as
md. It renders##as a label heading,###as a subheading, lines starting-or*as bullets,**bold**and plain paragraphs. - Nothing else is supported: no
#title, numbered list, link, code span, table or HTML. Those show as plain text. - The text becomes React nodes and never HTML, so untrusted text cannot inject markup.
- Text you write yourself is not markdown: use
Body,BulletListand the heading components.
Accessibility
##renders anh2and###anh3, bullets render aulwithlis, bold astrongand a paragraph ap.- The headings start at
h2, so the page needs its ownh1above. aria-*anddata-*go on the root.
API
Markdown
md required- Type
string