feat: enable live component rendering in MDX docs
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

- Register all 24 components in mdx-components.tsx via client boundary
- MDX files can now render real components inline (not just code blocks)
- media.mdx updated with live Figure and PullQuote demos
This commit is contained in:
sunzhongyi
2026-05-22 10:08:18 +08:00
parent 7b3afa245c
commit dd26470754
5 changed files with 61 additions and 7 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
import { source } from '@/lib/source';
import { DocsPage, DocsBody } from 'fumadocs-ui/page';
import { notFound } from 'next/navigation';
import { useMDXComponents } from '../../../mdx-components';
export default async function Page(props: { params: Promise<{ slug?: string[] }> }) {
const params = await props.params;
@@ -8,10 +9,11 @@ export default async function Page(props: { params: Promise<{ slug?: string[] }>
if (!page) notFound();
const MDX = page.data.body;
const components = useMDXComponents({});
return (
<DocsPage toc={page.data.toc}>
<DocsBody>
<MDX />
<MDX components={components} />
</DocsBody>
</DocsPage>
);