Raw
1 import React from "react"
2 import type { MDXComponents } from "mdx/types"
3 import Security from "./Security"
4 import type { OpenAPI } from "types"
5 import H2 from "./H2"
6 import { MDXComponents as UiMDXComponents, H3 as UiH3 } from "docs-ui"
7
8 export type ScopeType = {
9 specs?: OpenAPI.OpenAPIV3.Document
10 addToSidebar?: boolean
11 }
12
13 const getCustomComponents = (scope?: ScopeType): MDXComponents => {
14 return {
15 ...UiMDXComponents,
16 Security: () => <Security specs={scope?.specs} />,
17 h2: (props: React.HTMLAttributes<HTMLHeadingElement>) => <H2 {...props} />,
18 // hide the "#" anchor link next to headings — the reference navigates via
19 // real page paths, not in-page hashes (same as tag/operation headings).
20 h3: (props: React.HTMLAttributes<HTMLHeadingElement>) => (
21 <UiH3 {...props} hideAnchorLink />
22 ),
23 }
24 }
25
26 export default getCustomComponents