import { type ElementType, type ReactElement } from "react"; import type { MDXRemoteProps } from "next-mdx-remote/rsc"; import type { Docs } from "../../docs/docs.js"; /** * Props for {@link DocsPage}. */ export interface DocsPageProps { /** The configured `Docs` instance. The page and site config are derived from it. */ docs: Docs; /** The slug to render; the page is loaded via `docs.getDoc(slug, lang)`. */ slug: string; /** Which language to render the page in. Defaults to the docs' default locale. */ lang?: string; /** Custom component map for MDX elements, forwarded to `MDXRemote` (e.g. code highlighting). */ components?: MDXRemoteProps["components"]; /** * EXTRA remark/rehype options forwarded to `MDXRemote` (e.g. `rehype-pretty-code`). GFM * (tables, strikethrough, task lists, autolinks) is already on by default - plugins passed * here are merged with it, never replace it. See `shared/mdx.ts`. */ mdxOptions?: MDXRemoteProps["options"]; /** Element used for prev/next links. Defaults to `"a"`; pass `next/link` for client-side nav. */ linkComponent?: ElementType; /** Element used for the hero image. Defaults to `"img"`; pass `next/image` for optimisation. */ imgComponent?: ElementType; /** Whether to render the breadcrumb above the title. Defaults to `true`. */ showBreadcrumb?: boolean; /** Whether to render the right-hand "On this page" table-of-contents minimap. Defaults to `true`. */ showToc?: boolean; /** Whether to render the "Was this page helpful?" widget below the body. Defaults to `true`. */ showFeedback?: boolean; /** Heading for the ToC minimap. Defaults to the `lang` translation (e.g. `"On this page"`). */ tocTitle?: string; /** Label for the "previous page" card. Defaults to the `lang` translation (e.g. `"Previous"`). */ previousLabel?: string; /** Label for the "next page" card. Defaults to the `lang` translation (e.g. `"Next"`). */ nextLabel?: string; /** The feedback prompt. Defaults to the `lang` translation (e.g. `"Was this page helpful?"`). */ feedbackQuestion?: string; /** Affirmative feedback button label. Defaults to the `lang` translation (e.g. `"Yes"`). */ feedbackYesLabel?: string; /** Negative feedback button label. Defaults to the `lang` translation (e.g. `"No"`). */ feedbackNoLabel?: string; /** Feedback confirmation. Defaults to the `lang` translation (e.g. `"Thanks for the feedback!"`). */ feedbackThanksLabel?: string; /** Called once with the reader's feedback vote; wire it to your analytics. Optional. */ onFeedback?: (vote: "yes" | "no") => void; /** Builds the reading-time label from the estimated minutes. Defaults to the `lang` translation. */ readingLabel?: (minutes: number) => string; /** Builds the "Updated " meta line from the formatted date. Defaults to the `lang` translation. */ updatedLabel?: (date: string) => string; } /** * Renders a single documentation page: a breadcrumb, the title and lead, a meta row (reading time * and last-updated date), the hero image (when the page's front-matter sets `image`, rendered with * `imgComponent`), the MDX body (compiled with `next-mdx-remote`, memoized per source+options - see `shared/mdx.ts`) inside a * `.scribekit-prose` container, a "Was this page helpful?" widget, prev/next cards from the sidebar * reading order, and a right-hand "On this page" minimap (the same scroll-spy `BlogSidebar` the * blog uses). SEO JSON-LD (a `TechArticle` + `BreadcrumbList`) is derived from `docs.site`. * * A server component: pass your configured `Docs` instance and the slug (and, for a translated * page, the `lang`), and it loads the page (`docs.getDoc(slug, lang)`), formats the date in that * language's locale, and computes the breadcrumb / minimap / prev-next. The left navigation is a * separate client component (`DocsSidebar`) you place in your route's layout; a language switcher * is the consumer's to build (from `docs.getTranslations(slug)` + `localePath`). `##`/`###` * headings in the MDX body get anchor ids injected (via the shared `slugify`) so the minimap can * jump to them - if you override `h2`/`h3` in `components`, add your own ids. Requires the package * stylesheet. * * With the recommended route setup (`generateStaticParams` + `dynamicParams = false`), unknown * slugs 404 at the router before this renders. If you opt into dynamic rendering, guard with your * own `getDoc` try/catch -> `notFound()` in the page component before rendering. * * @param props - see {@link DocsPageProps}. * @returns the documentation page, with the ToC minimap when enabled and there are headings. */ export declare function DocsPage({ docs, slug, lang, components, mdxOptions, linkComponent: Link, imgComponent: Img, showBreadcrumb, showToc, showFeedback, tocTitle, previousLabel, nextLabel, feedbackQuestion, feedbackYesLabel, feedbackNoLabel, feedbackThanksLabel, onFeedback, readingLabel, updatedLabel, }: DocsPageProps): ReactElement;