Chore: enforce type-safe MDX components universally

This commit is contained in:
Fuma Nama
2026-03-10 19:59:51 +08:00
parent b95beed8c5
commit dc9985a015
63 changed files with 328 additions and 202 deletions
@@ -2,7 +2,7 @@ import { source } from '@/lib/source';
import { DocsPage, DocsBody, DocsDescription, DocsTitle } from 'fumadocs-ui/layouts/docs/page';
import { notFound } from 'next/navigation';
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { getMDXComponents } from '@/mdx-components';
import { getMDXComponents } from '@/components/mdx';
export default async function Page(props: { params: Promise<{ slug?: string[] }> }) {
const params = await props.params;
@@ -2,11 +2,10 @@ import defaultMdxComponents from 'fumadocs-ui/mdx';
import type { MDXComponents } from 'mdx/types';
import * as Python from 'fumadocs-python/components';
// use this function to get MDX components, you will need it for rendering MDX
export function getMDXComponents(components?: MDXComponents): MDXComponents {
export function getMDXComponents(components?: MDXComponents) {
return {
...defaultMdxComponents,
...Python,
...components,
};
} satisfies MDXComponents;
}