diff --git a/website/next.config.mjs b/website/next.config.mjs index 06adac6b5..390cceac2 100644 --- a/website/next.config.mjs +++ b/website/next.config.mjs @@ -1,8 +1,11 @@ import MDX from '@next/mdx' +import remarkPlugins from './plugins/index.mjs' + const withMDX = MDX({ extension: /\.mdx?$/, options: { + remarkPlugins, providerImportSource: '@mdx-js/react', }, experimental: { diff --git a/website/pages/[slug].tsx b/website/pages/[slug].tsx index 915c55de6..c257e13c4 100644 --- a/website/pages/[slug].tsx +++ b/website/pages/[slug].tsx @@ -4,6 +4,7 @@ import fs from 'fs' import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote' import path from 'path' import Layout from '../components/layout' +import remarkPlugins from '../plugins/index.mjs' type PropsPage = { mdx: MDXRemoteSerializeResult @@ -43,7 +44,12 @@ export const getStaticProps: GetStaticProps = async ( slug: args.params.slug, mdx: await serialize( fs.readFileSync(path.join('docs', args.params.slug + '.mdx'), 'utf-8'), - { parseFrontmatter: true } + { + parseFrontmatter: true, + mdxOptions: { + remarkPlugins, + }, + } ), }, } diff --git a/website/plugins/index.mjs b/website/plugins/index.mjs new file mode 100644 index 000000000..660338e86 --- /dev/null +++ b/website/plugins/index.mjs @@ -0,0 +1,3 @@ +const remarkPlugins = [] + +export default remarkPlugins