Skip to Content
🎉 Nextra 4.0 is released. dimaMachina is looking for a new job or consulting .
APIcompileMdx

compileMdx function

Exported from nextra/compile.

Signature

Parameters:
NameTypeDefault
rawMdxstring
[1]?.staticImageboolean
[1]?.searchboolean | { codeblocks: boolean; }
[1]?.defaultShowCopyCodeboolean | undefined
[1]?.readingTimeboolean | undefined
[1]?.latexboolean | { renderer: "mathjax"; options?: { src?: string | undefined; config?: MathJaxConfig | undefined; } | undefined; } | { options: rehype_katex_lib_index_js.Options; renderer: "katex"; } | undefined
[1]?.codeHighlightboolean
[1]?.whiteListTagsStylingstring[] | undefined
[1]?.mdxOptions{ rehypePlugins?: any; remarkPlugins?: any; recmaPlugins?: any; format?: "detect" | "mdx" | "md" | undefined; rehypePrettyCodeOptions?: Options | undefined; } & Pick<ProcessorOptions, "jsx" | ... 1 more ... | "providerImportSource">{}
[1]?.filePathstring''
[1]?.useCachedCompilerboolean
[1]?.isPageImportbooleanfalse
[1]?.lastCommitTimenumber
Returns:
Promise<string>

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={...} />