UNPKG

@mintlify/common

Version:

Commonly shared code within Mintlify

68 lines (67 loc) 1.97 kB
/** * MDX components known to NOT pass their `id` prop down to a DOM element. * Links to anchors on these components will be treated as broken by link-rot. * * When modifying this list, update the corresponding render test in * apps/client/test/components/id-passthrough.test.tsx. */ export const COMPONENTS_WITHOUT_ID = new Set([ 'Info', 'Warning', 'Note', 'Tip', 'Check', 'Danger', 'Callout', 'AccordionGroup', 'Card', 'CardGroup', 'Tabs', 'CodeGroup', 'Column', 'Columns', 'CustomCode', 'CustomComponent', 'DynamicCustomComponent', 'Expandable', 'Frame', 'Icon', 'Latex', 'Mermaid', 'Panel', 'Popup', 'Prompt', 'RequestExample', 'ResponseExample', 'SnippetGroup', 'Steps', 'Tile', 'Tooltip', 'Tree', 'Visibility', 'Badge', 'Color', 'ZoomImage', ]); /** * MDX components that call `cleanHeadingId` on their `id` prop at render time. * link-rot must apply the same normalization when storing anchor ids for these components. */ export const COMPONENTS_WITH_CLEANED_ID = new Set(['Heading', 'Step', 'Update']); /** * MDX components that forward their `id` prop to a DOM element without normalization. * Links to anchors on these components are valid targets; no transformation is applied. * * When modifying this list, update the corresponding render test in * apps/client/test/components/id-passthrough.test.tsx. */ export const COMPONENTS_WITH_RAW_ID = new Set([ 'Accordion', // id from remarkComponentIds (title slug) or explicit 'Tab', // formatTabIds returns child.props.id directly without normalization 'CodeBlock', // spreads props to outer <div> 'Table', // spreads props to outer <div> 'OptimizedFrame', // spreads props to <iframe> 'OptimizedImage', // spreads props to <img> 'OptimizedVideo', // spreads props to <video> 'View', // spreads props to outer <div> ]);