Markdown
Compiles and renders a string of markdown content.
Hello World
This is a markdown string that gets rendered as HTML.
import { Markdown } from 'renoun' export function Basic() { return ( <Markdown> {`# Hello World This is a **markdown** string that gets rendered as HTML.`} </Markdown> ) }
Examples
With Custom Components
View SourceHello World
This paragraph has custom styling applied through the
componentsprop.You can override any HTML element rendered from markdown.
import { Markdown } from 'renoun' export function WithCustomComponents() { return ( <Markdown components={{ h1: (props) => ( <h1 {...props} style={{ fontSize: '2rem', fontWeight: 'bold', marginBottom: '1rem', }} /> ), p: (props) => ( <p {...props} style={{ lineHeight: 1.6, marginBottom: '0.5rem', }} /> ), code: (props) => ( <code {...props} style={{ backgroundColor: 'oklab(0.3 -0.01 -0.04)', padding: '0.2rem 0.4rem', borderRadius: '0.25rem', }} /> ), }} > {`# Hello World This paragraph has custom styling applied through the \`components\` prop. You can override any HTML element rendered from markdown.`} </Markdown> ) }
API Reference
Type
Partial<Components>Properties
| Property | Type | Modifiers |
|---|---|---|
| children | string | — |
The markdown content to render. | ||
| components? | Partial<Components> | — |
Components to override the HTML compiled from markdown syntax. | ||
| remarkPlugins? | PluggableList | — |
Remark plugins to use. See PluggableList for more info. | ||
| rehypePlugins? | PluggableList | — |
Rehype plugins to use. See PluggableList for more info. | ||
Compiles and renders a string of markdown content.
Properties
MarkdownPropsReturns
Promise<JSX.Element>Modifiers
asyncLast updated
MDX
NextNavigation