diff --git a/web/app/docs/[slug]/page.tsx b/web/app/docs/[slug]/page.tsx index a5ee7fc4..44f2046f 100644 --- a/web/app/docs/[slug]/page.tsx +++ b/web/app/docs/[slug]/page.tsx @@ -1,20 +1,12 @@ import type { Metadata } from 'next'; -import type React from 'react'; import { notFound, redirect } from 'next/navigation'; import { evaluate } from '@mdx-js/mdx'; import { Fragment } from 'react'; import { jsx, jsxs } from 'react/jsx-runtime'; import remarkGfm from 'remark-gfm'; -import { Card } from '../../../components/docs/Card'; -import { CardGroup } from '../../../components/docs/CardGroup'; -import { BannerLink } from '../../../components/docs/BannerLink'; -import { CodeGroup } from '../../../components/docs/CodeGroup'; import { DocsPageActions } from '../../../components/docs/DocsPageActions'; -import { HighlightedPre } from '../../../components/docs/HighlightedCode'; -import { LegacySpawnOptionsTable } from '../../../components/docs/LegacySpawnOptionsTable'; -import { Note } from '../../../components/docs/Note'; -import { Warning } from '../../../components/docs/Warning'; +import { mdxComponents } from '../../../components/docs/mdx-components'; import { TableOfContents } from '../../../components/docs/TableOfContents'; import styles from '../../../components/docs/docs.module.css'; import { getDoc } from '../../../lib/docs'; @@ -24,40 +16,6 @@ import { getDefaultDocsVersionForSlug } from '../../../lib/docs-versions'; import { ogImage } from '../../../lib/og-meta'; import { absoluteUrl } from '../../../lib/site'; -function slugify(text: string): string { - return text - .toLowerCase() - .replace(/`([^`]+)`/g, '$1') - .replace(/[^a-z0-9]+/g, '-') - .replace(/^-|-$/g, ''); -} - -function HeadingWithId(level: 2 | 3) { - return function Heading({ children, ...props }: React.HTMLAttributes) { - const text = typeof children === 'string' ? children : String(children); - const id = slugify(text); - const Tag = `h${level}` as const; - return ( - - {children} - - ); - }; -} - -const components = { - CodeGroup, - Card, - CardGroup, - BannerLink, - Note, - Warning, - SpawnOptionsTable: LegacySpawnOptionsTable, - pre: HighlightedPre, - h2: HeadingWithId(2), - h3: HeadingWithId(3), -}; - type PageProps = { params: Promise<{ slug: string }>; }; @@ -152,7 +110,7 @@ export default async function DocsPage({ params }: PageProps) {

{doc.frontmatter.description}

)}
- +