MDX
Compiles and renders a string of MDX content. Note, a set of default remarkPlugins
and rehypePlugins options are only used if both are not provided.
Hello World
React in Markdown
import { MDX } from 'renoun' export function Basic() { return <MDX>{`# Hello World\n\n<p>React in Markdown</p>`}</MDX> }
Security
This component evaluates JavaScript. Always sanitize user-provided content before passing it to the MDX component. This includes sanitizing value, components, and dependencies.
Failing to do so puts you at risk of a cross-site scripting (XSS) attack. See the MDX security documentation for more information.
Prefer the Markdown component if possible for rendering untrusted content as it does not evaluate JavaScript and is therefore safe by default.
API Reference
Properties
| Property | Type | Modifiers |
|---|---|---|
| children | string | — |
The MDX content to render. | ||
| components? | MDXComponents | — |
Additional components that will be available to use in the MDX content.
The default components from | ||
| dependencies? | Record<string, any> | — |
An object of external dependencies that will be available to the MDX source code. | ||
| remarkPlugins? | PluggableList | — |
Remark plugins to use. See PluggableList for more info. | ||
| rehypePlugins? | PluggableList | — |
Rehype plugins to use. See PluggableList for more info. | ||
| baseUrl? | string | — |
Base URL to resolve imports and named exports from (e.g. | ||
Compiles and renders a string of MDX content. Note, a set of default remarkPlugins
and rehypePlugins options are only used if both are not provided.
Properties
MDXPropsReturns
Promise<React.JSX.Element>Modifiers
async