/** * Default react-markdown component map for the unified markdown engine. * ONE implementation of code blocks, headings, links, lists, tables etc. * Compositions layer on top via `componentOverrides` (spread LAST by the * engine, so caller overrides always win). */ import type React from 'react'; import type { Components, ExtraProps } from 'react-markdown'; import type { ResolveLinkResult } from '../../../types/doc-source'; import type { TextSizeElement } from './text-size'; /** * Props react-markdown hands a renderer for ``: the intrinsic element's * own props plus the hast `node` (react-markdown's `ExtraProps`). Mirrors the * `Components` map's own element typing, so every renderer below stays * assignable to it without a cast. * * NOTE: react-markdown dropped the `inline` prop in v9 — inline code is * distinguished by the absence of a `language-*` class, which is what the * `code` renderer already keys off. */ export type MdRenderProps = React.ComponentPropsWithoutRef & ExtraProps; /** * The shared leaf renderers, typed as plain functions (not `Components` * entries, which also admit a bare tag name). The rich composition CALLS * them directly — see the hook-free contract documented on * `buildStandardLeafRenderers` — so their call signature has to be part of * the type. */ export interface StandardLeafRenderers { code: (props: MdRenderProps<'code'>) => React.ReactElement; blockquote: (props: MdRenderProps<'blockquote'>) => React.ReactElement; div: (props: MdRenderProps<'div'>) => React.ReactElement; } export declare function hasRenderableSrc(src: unknown): src is string; export interface BuildBaseComponentsOptions { textSizes: Record; demoteMarkdownH1ToH2: boolean; brokenLinks: readonly string[]; currentPath?: string; onInternalLinkClick?: (path: string, options?: { expandFolder?: boolean; fromInternalLink?: boolean; }) => void; onResolveLink?: (href: string, currentPath: string) => Promise; } /** * The standard leaf renderers (`code` block + inline, `blockquote`, `div` * pass-through) as standalone functions. * * SSOT for compositions that must OVERRIDE these renderers for a narrow * special case and then fall through: the rich composition intercepts embed * fence languages, shortcode-expanded `div`s and Reddit's `reddit-embed-bq` * blockquote, and delegates everything else here. Previously it reproduced * these renderers byte-for-byte, so any class change here silently drifted * on content surfaces. * * THESE MUST STAY HOOK-FREE: the rich composition calls them as plain * functions from inside its own renderers (`standard.code(props)`), which is * not a React render of a component and would break the rules of hooks. * Hook-using renderers (the headings, which read the heading-line offset * from context) live in `buildBaseComponents` below and are never delegated * to this way. * * ODS-TOKENS FLAG (ODS_TOKEN_RULES §Typography / §General): inline code keeps * an inline `text-[0.9em]`, carried over verbatim from the pre-unification * renderers — ODS has no relative-to-parent code size, so mapping it onto an * existing token would visibly change every inline code span. Same shape as * the flag in ./text-size.ts — flagged for addition to ODS, not copied * anywhere else. * * The code BLOCK's font is NOT flagged: the raw "JetBrains Mono", "SF Mono", * Consolas stack the old renderer inlined is gone, replaced by Tailwind's * `font-mono` (→ `var(--font-family-heading)`, the Azeret Mono ODS stack) — * the same class the inline-code branch below already used, so the two code * surfaces no longer disagree about their family. */ export declare function buildStandardLeafRenderers({ textSizes, }: { textSizes: Record; }): StandardLeafRenderers; export declare function buildBaseComponents({ textSizes, demoteMarkdownH1ToH2, brokenLinks, currentPath: propCurrentPath, onInternalLinkClick, onResolveLink, }: BuildBaseComponentsOptions): Components; //# sourceMappingURL=base-components.d.ts.map