compileMdx
Function
Exported from nextra/compile
.
Signature
Parameters:Name | Type | Default |
---|---|---|
rawMdx | string | |
[1]?.staticImage | boolean | |
[1]?.search | boolean | { codeblocks: boolean; } | |
[1]?.defaultShowCopyCode | boolean | undefined | |
[1]?.readingTime | boolean | undefined | |
[1]?.latex | boolean | { options?: { src?: string | undefined; config?: MathJaxConfig | undefined; } | undefined; renderer: "mathjax"; } | { renderer: "katex"; options: rehype_katex_lib_index_js.Options; } | undefined | |
[1]?.codeHighlight | boolean | |
[1]?.whiteListTagsStyling | string[] | undefined | |
[1]?.mdxOptions | { rehypePlugins?: PluggableList | null | undefined; remarkPlugins?: PluggableList | null | undefined; recmaPlugins?: PluggableList | null | undefined; format?: "detect" | ... 1 more ... | "md"; rehypePrettyCodeOptions?: Options; } & Pick<...> | {} |
[1]?.filePath | string | '' |
[1]?.useCachedCompiler | boolean | |
[1]?.isPageImport | boolean | false |
[1]?.lastCommitTime | number |
Example
// Usage with MDXRemote
import { compileMdx } from 'nextra/compile'
import { MDXRemote } from 'nextra/mdx-remote'
const rawJs = await compileMdx(rawMdx)
const content = <MDXRemote compiledSource={rawJs} components={...} scope={...} />