import type { HTMLAttributes } from 'react'; /** * Docs heading styles live here (not in a site's mdx.tsx) because components * rendered *inside* MDX — the API reference, most of all — emit their own * headings as JSX. MDX component overrides only reach markdown-authored * elements, so a component's own

would otherwise fall back to Tailwind's * preflight and render at body size with no margin. */ export const HEADING_STYLES = { h2: 'mt-[52px] font-display text-[27px] font-extrabold leading-[1.2] tracking-[-0.02em] text-[var(--dk-heading)]', h3: 'mt-[34px] font-display text-[18px] font-extrabold leading-[1.3] tracking-[-0.01em] text-[var(--dk-heading)]', h4: 'mt-7 font-display text-base font-extrabold text-[var(--dk-heading)]', } as const; type HeadingTag = keyof typeof HEADING_STYLES; type HeadingProps = HTMLAttributes & { as?: HeadingTag }; export function Heading({ as = 'h2', id, children, className = '', ...props }: HeadingProps) { const Tag = as; return ( {children} {id ? ( # ) : null} ); } export function createHeading(as: HeadingTag) { return function MdxHeading(props: HTMLAttributes) { return ; }; }