import { CSSProperties, FunctionComponent, JSX, ReactElement, ReactNode } from "react"; import { Font, MeasurableStyle, MeasureContext, SafeClassName } from "@wingleeio/mugen/native-core"; import { ParserOptions } from "@incremark/core"; import { PreparedRichInline, RichInlineItem } from "@wingleeio/pretext-core"; import { Blockquote, Code, Delete, Emphasis, Heading, Html, Image, InlineCode, Link, List, Paragraph, PhrasingContent, Root, RootContent, Strong, Table, Text, ThematicBreak } from "mdast"; //#region src/parse.d.ts /** * Markdown parsing options — a curated subset of incremark's `ParserOptions`. * `gfm` (tables, task lists, strikethrough, autolinks) is on by default because * it's what people mean by "markdown" today. */ interface MarkdownParseOptions { /** GitHub-Flavored Markdown: tables, task lists, strikethrough, autolinks. Default `true`. */ gfm?: boolean; /** `$…$` / `$$…$$` math. Off by default (needs a math-capable component override to render). */ math?: ParserOptions['math']; /** `:::` directive containers. Off by default. */ containers?: ParserOptions['containers']; } /** * Parse markdown into an mdast `Root` with incremark, memoized by * `(source, options)` and parsed **incrementally** when the source grows. * * Pure and synchronous — safe to call inside mugen's measure walk. Growing the * same source (a streaming row) appends only the new text to a retained parser; * an unchanged source is served from the AST cache; a non-extending change parses * fresh. */ declare function parseMarkdown(source: string, options?: MarkdownParseOptions): Root; /** Drop the parse caches and retained parsers (tests / memory pressure). */ declare function clearParseCache(): void; //#endregion //#region src/highlight/types.d.ts /** * Token vocabulary for the built-in code-block highlighter. The set is small on * purpose: highlighting is purely cosmetic paint layered over already-laid-out * text, so a coarse classification that is cheap to compute incrementally beats * a grammar-exact one that would need a real parser. */ type TokenType = 'keyword' | 'string' | 'comment' | 'number' | 'constant' | 'function' | 'type' | 'property' | 'operator' | 'punctuation'; /** * One colour per token type. A value of `'currentColor'` paints that token in * the block's own text colour (whatever `color` computes to on the ``), * which is how a token type opts out of special colouring. */ type CodeTokenColors = Record; /** * Default palette: mid-tone colours chosen to stay legible on both light and * dark page backgrounds, since the default theme inherits the page colours. */ declare const defaultTokenColors: CodeTokenColors; //#endregion //#region src/theme.d.ts /** * The markdown theme. Every value that affects a box's height — fonts, line * heights, paddings, gaps — lives here as a concrete number/family, because the * dispatcher bakes them into primitive props (the measure walk only sees props, * never React context). Colours and other purely-cosmetic values live here too, * for one-stop styling. * * Fonts are given as a **family** plus sizes/weights, not as full `Font` * shorthands, so the dispatcher can compose inline variants (bold inside a * heading, code inside a paragraph) without you spelling out every combination. * Families must be measurable — a named web font (`"Inter"`) or a canvas-safe * generic (`"sans-serif"`, `"monospace"`); `"system-ui"` is rejected at measure * time because its canvas metrics drift from what CSS paints. */ interface MarkdownTheme { /** Body text family, e.g. `"Inter"` or `"sans-serif"`. */ fontFamily: string; /** Monospace family for code, e.g. `"JetBrains Mono"` or `"monospace"`. */ monoFamily: string; /** Body font size in px. */ fontSize: number; /** Body line height in px. */ lineHeight: number; /** Default text colour (any CSS colour; `"inherit"` follows the surrounding CSS). */ color: string; /** Vertical gap between adjacent blocks, in px. */ blockGap: number; heading: { weight: number; color: string; /** Font size per heading depth, in px. */ sizes: Record<1 | 2 | 3 | 4 | 5 | 6, number>; /** Line height per heading depth, in px. */ lineHeights: Record<1 | 2 | 3 | 4 | 5 | 6, number>; }; /** Weight applied to `**strong**` text. */ strongWeight: number; /** Whether `*emphasis*` renders italic (needs an italic face of the family). */ emphasisItalic: boolean; link: { color: string; underline: boolean; }; inlineCode: { color: string; background: string; /** Inline-code size as a fraction of the surrounding text size. */ sizeScale: number; }; code: { fontSize: number; lineHeight: number; padding: number; background: string; color: string; radius: number; /** Cosmetic outer border colour, painted inset so it does not change height. */ borderColor?: string; /** * Token palette for the built-in non-blocking canvas highlighter, or * `false` to disable highlighting. Colours are paint-only — they can never * change a block's measured height. */ highlight: CodeTokenColors | false; /** * Optional chrome bar above the code — the language on the left, a * copy-to-clipboard button on the right. `show: false` (the default) keeps * the bare `
`. When shown, the bar's fixed `height` is folded into the
     * block's measured height, so computed and painted heights stay identical.
     */
    header: {
      /** Render the chrome bar. Off by default. */show: boolean; /** Fixed bar height in px (counted in the measured height). */
      height: number; /** Label + button font size in px. */
      fontSize: number; /** Bar background. */
      background: string; /** Label + button text colour. */
      color: string; /** Bottom hairline + button border colour. */
      borderColor: string; /** Copy-button fill. */
      buttonBackground: string;
    };
  };
  blockquote: {
    padding: number;
    gap: number;
    borderWidth: number;
    borderColor: string;
    color: string;
  };
  list: {
    /** Gap between list items, in px. */gap: number; /** Width of the marker column (bullet / number), in px. */
    indent: number;
    markerColor: string;
  };
  table: {
    /** Uniform cell padding in px (uniform so the analytic height stays exact). */cellPadding: number; /** Hairline between rows (and the outer ring) in px; 0 disables both. */
    gap: number;
    headerWeight: number; /** Background behind the header row. */
    headerBackground: string; /** Hairline / outer-ring colour. */
    borderColor: string; /** Corner radius in px (clip only — no height impact). */
    radius: number;
    /**
     * Reasonable minimum rendered column width in px (padding included). A column
     * whose content is naturally narrower keeps its content width; wider columns
     * wrap down to this floor but no further. When the columns' minimums can't
     * fit the available width the table scrolls horizontally instead of crushing
     * every column into per-character wrapping. Affects wrapping (hence height),
     * so it lives here and is baked into the primitive's props.
     */
    minColumnWidth: number;
  };
  rule: {
    thickness: number;
    color: string;
    gap: number;
  };
  /**
   * Images have no intrinsic measurable height, so the default `image` component
   * renders a fixed-height box. Override the `image` component for real layout.
   */
  image: {
    placeholderHeight: number;
    color: string;
  };
}
type DeepPartial = T extends (infer U)[] ? DeepPartial[] : T extends object ? { [K in keyof T]?: DeepPartial } : T;
declare const defaultTheme: MarkdownTheme;
/** Merge a partial theme over the defaults into a fully-resolved theme. */
declare function resolveTheme(theme?: DeepPartial): MarkdownTheme;
//#endregion
//#region src/primitives/rich-text.d.ts
/**
 * One styled span of inline text. A `RichText` is a sequence of runs that wrap
 * together as a single flowing paragraph — the thing markdown inline content
 * (bold, italic, code, links inside a sentence) needs and that a single-font
 * `` can't express. Each run carries its own measurable `font`, so the
 * mixed fonts on a line are measured exactly (via `@chenglou/pretext`'s
 * rich-inline layout) and the painted spans use the identical fonts.
 */
interface RichTextRun {
  /** The run's text. Ignored when `break` or `advance` is set. */
  text?: string;
  /**
   * Render this run as an **inline box** — the inline analogue of mugen's
   * `Escape`: it reserves exactly `advance` px in the flow (via pretext's
   * `extraWidth`) and paints {@link content}, whatever it is, without measuring
   * its insides. The flow wraps it as one non-breaking atom. The caller owns the
   * contract: `content` must render exactly `advance` px wide and no taller than
   * the line (use the exported `measureInline` to size text-based boxes).
   */
  advance?: number;
  /** The painted content of an inline box (see {@link advance}). */
  content?: ReactNode;
  /** Measurable font for this run; falls back to the `` prop. */
  font?: Font;
  color?: string;
  /** Background (e.g. inline-code chip). Cosmetic — does not affect height. */
  background?: string;
  /** CSS `text-decoration` (e.g. `"underline"`, `"line-through"`). Cosmetic. */
  decoration?: string;
  /** Render as a link with this `href` (sets the tag to `` unless `as` is given). */
  href?: string;
  title?: string;
  onClick?: (e: unknown) => void;
  /** The element tag for this run. Defaults to `a` when `href` is set, else `span`. */
  as?: keyof JSX.IntrinsicElements;
  /** Forbid line breaks inside this run. */
  noBreak?: boolean;
  /**
   * Disable ligatures for this run (`font-variant-ligatures: none` on the web,
   * the `no-*-ligatures`/`no-contextual` font variants on native). Set on
   * monospace code runs so a programming font's `===`/`!=`/`=>` ligatures render
   * as the literal characters. Height-neutral: monospace advances don't change
   * under ligature substitution, so the measure is unaffected.
   */
  noLigatures?: boolean;
  letterSpacing?: number;
  className?: string;
  /** A hard line break (renders `
`, forces a new line in the measure). */ break?: boolean; } interface RichTextProps { /** The inline runs to flow together. */ runs: RichTextRun[]; /** Line height in px — the height of every wrapped line. Required. */ lineHeight: number; /** Fallback font for runs that don't set their own. */ font?: Font; color?: string; align?: CSSProperties['textAlign']; /** Inline styles, minus spacing/sizing (owned by the layout). */ style?: MeasurableStyle; className?: SafeClassName; } /** Resolve a run's font against the flow fallback (exported for native renderers). */ declare function resolveRunFont(run: RichTextRun, fallback: Font | undefined): Font; /** * One hard-break-delimited segment of the flow: the pretext items plus the * source run behind each item (`runs[i]` produced `items[i]`), so a renderer * that paints materialized line fragments (React Native) can map a fragment's * `itemIndex` back to its run's color/decoration/link. The measure only reads * `items`. */ interface RichTextSegment { items: RichInlineItem[]; runs: RichTextRun[]; } /** Split runs into hard-break-delimited segments of rich-inline items. */ declare function segmentItems(runs: RichTextRun[], fallback: Font | undefined): RichTextSegment[]; /** * Prepare a segment's items with the shared LRU-ish cache (flushed on font * epoch). Exported for the native renderer, which materializes lines from the * exact same prepared handles the measure counted them on. */ declare function prepareCached(items: RichInlineItem[]): PreparedRichInline; /** * A measurable rich inline-text primitive: a paragraph of mixed-font runs that * wrap as one flow. Its height is `lines × lineHeight`, where `lines` comes from * pretext's rich-inline layout at the row's width — the same layout the browser * performs over the rendered spans, so the analytic height matches the paint. */ declare const RichText: (props: RichTextProps) => ReactElement; /** * Measure a string's rendered advance in px for a given measurable font — the * same ruler `RichText` measures with. Use it to size an inline box: a text * "pill" reserves `measureInline(label, font) + horizontalPadding`. */ declare function measureInline(text: string, font: Font): number; /** Drop the rich-inline prepare cache (tests / memory pressure). */ declare function clearRichTextCache(): void; //#endregion //#region src/inline.d.ts /** * The mutable styling state threaded through the inline walk. Markdown inline * marks (`**`, `*`, `` ` ``, `[]()`) nest, so we carry the composed format down * and emit a styled run at each text leaf. Fonts are composed here — a `` * inside a heading produces one bold run at the heading's size — which is what * lets the rich-inline measurement see every mixed font exactly. */ interface InlineFormat { family: string; monoFamily: string; size: number; weight: number; italic: boolean; mono: boolean; underline: boolean; strike: boolean; color?: string; background?: string; href?: string; } /** A base format for body text at a given size/weight/colour. */ declare function baseFormat(theme: MarkdownTheme, opts?: { size?: number; weight?: number; color?: string; }): InlineFormat; /** Compose a measurable `Font` shorthand from a format. */ declare function composeFont(fmt: InlineFormat): Font; /** * Flatten phrasing content into styled runs. Recursive over the inline marks; * the result feeds a single `` so the whole paragraph wraps as one * flow and measures exactly. An `inline` override map can replace how any node * type flattens — returning its own runs (e.g. a measured inline box) or `null` * to fall through to the default. */ declare function flattenInline(nodes: readonly PhrasingContent[], fmt: InlineFormat, theme: MarkdownTheme, out: RichTextRun[], inline?: InlineComponents): void; //#endregion //#region src/types.d.ts /** * The two primitives the dispatcher constructs directly (everything else goes * through {@link MarkdownComponents}). A non-DOM renderer swaps these for its * own implementations with the identical measure contract — that's how * `@wingleeio/mugen-markdown-native` reuses this package's entire pipeline. */ interface MarkdownPrimitives { /** Stacks block children with a `gap` (the web default is mugen's `VStack`). */ Stack?: FunctionComponent<{ gap?: number; children?: ReactNode; }>; /** The inline flow (the web default is this package's `RichText`). */ RichText?: FunctionComponent; } type ResolvedMarkdownPrimitives = Required; /** Options for building a body/heading inline-text (`RichText`) element. */ interface InlineTextOptions { /** Font size in px (defaults to the theme body size). */ size?: number; /** Font weight (defaults to 400). */ weight?: number; /** Line height in px (defaults to the theme body line height). */ lineHeight?: number; color?: string; align?: CSSProperties['textAlign']; } /** * The context threaded to every markdown component. It carries the resolved * theme and the helpers a component needs to recurse — all of which return * **mugen primitives**, so whatever a component builds with them stays * measurable by mugen's tree walker. */ interface MarkdownRenderContext { /** The fully-resolved theme. */ readonly theme: MarkdownTheme; /** The resolved component set (defaults merged with user overrides). */ readonly components: ResolvedMarkdownComponents; /** The resolved dispatcher primitives (Stack + RichText; see {@link MarkdownPrimitives}). */ readonly primitives: ResolvedMarkdownPrimitives; /** Render a list of block nodes as a vertically-stacked subtree (gap defaults to `theme.blockGap`). */ renderBlocks(nodes: readonly RootContent[], gap?: number): ReactNode; /** Render a single block node, dispatching to its component. */ renderBlock(node: RootContent, key?: string | number): ReactNode; /** The default inner rendering for a node (inline `RichText`, or rendered child blocks). */ renderChildren(node: RootContent): ReactNode; /** Flatten phrasing content into styled `RichText` runs at an optional base format. */ inlineRuns(nodes: readonly PhrasingContent[], base?: Partial): RichTextRun[]; /** Build a `RichText` element from phrasing content (the inline pipeline). */ inlineText(nodes: readonly PhrasingContent[], opts?: InlineTextOptions): ReactNode; /** * Memoize a rendered element by its `node`'s content, so streaming re-renders * reuse it (React then bails out). `variant` distinguishes renderings of the * same node that differ by sibling context — e.g. a list item's index/marker * or a table cell's column. Use it in custom `list`/`table` components so their * already-finished items/cells don't re-render while a later one streams in. */ memo(node: object, variant: string, build: () => ReactNode): ReactNode; } /** * Props every markdown component receives. `node` is the typed mdast node, * `children` is what the default component would render inside (so an override * can wrap it), and `ctx` exposes the recursion + theme helpers. */ interface MarkdownComponentProps { node: N; children: ReactNode; ctx: MarkdownRenderContext; } /** * A markdown component. It must return mugen primitives (or hook-free * compositions of them) so mugen's walker can measure the row — use the * primitives re-exported from this package and the `ctx` helpers. */ type MarkdownComponent = (props: MarkdownComponentProps) => ReactNode; /** * The context passed to an inline override. It carries the active inline format * (so an override can match the surrounding type) and the helpers to build runs * that stay exactly measurable. */ interface InlineRenderContext { readonly theme: MarkdownTheme; /** The composed inline format at this node (family, size, weight, colour…). */ readonly fmt: InlineFormat; /** Compose a measurable `Font` from the current format plus overrides. */ font(overrides?: Partial): Font; /** * Measure a string's rendered advance in px for a font — to size an inline * box. A text pill reserves `measure(label, font) + horizontalPadding`. */ measure(text: string, font: Font): number; /** Default-flatten phrasing children into runs, to compose with your own. */ runs(nodes: readonly PhrasingContent[], fmtOverrides?: Partial): RichTextRun[]; } /** * An inline-node override: given the mdast node and the inline context, return * the runs it should flatten to — styled text, an inline box (`{ advance, * content }`), or a mix — or `null` to fall back to the default styling. */ type InlineComponent = (node: N, ctx: InlineRenderContext) => RichTextRun[] | null; /** * Inline-node overrides, keyed by mdast inline type. The index signature admits * custom inline tokens (from a remark plugin) beyond the named ones. */ interface InlineComponents { text?: InlineComponent; strong?: InlineComponent; emphasis?: InlineComponent; delete?: InlineComponent; inlineCode?: InlineComponent; link?: InlineComponent; [type: string]: InlineComponent | undefined; } /** * The overridable components. Block-level marks are keyed by mdast node type and * typed to the matching node. Inline marks (bold, italic, code, links) are * styled through the {@link MarkdownTheme} by default, but `inline` lets you * override how an inline node flattens into runs — including a measured inline * box (`{ advance, content }`), the inline twin of mugen's `Escape`. */ interface MarkdownComponents { paragraph?: MarkdownComponent; heading?: MarkdownComponent; thematicBreak?: MarkdownComponent; blockquote?: MarkdownComponent
; list?: MarkdownComponent; code?: MarkdownComponent; table?: MarkdownComponent; image?: MarkdownComponent; html?: MarkdownComponent; /** Inline-node overrides (see {@link InlineComponents}). */ inline?: InlineComponents; } /** Block components resolve to defaults; `inline` stays optional. */ type ResolvedMarkdownComponents = Required> & { inline?: InlineComponents; }; /** * Identity helper for authoring a typed component set with full inference and * `node` narrowing per key: * * ```tsx * const components = defineMarkdownComponents({ * heading: ({ node, children }) => // node is Heading, node.depth is 1..6 * {children}, * }); * ``` */ declare function defineMarkdownComponents(components: MarkdownComponents): MarkdownComponents; //#endregion //#region src/components.d.ts declare const defaultComponents: ResolvedMarkdownComponents; /** Merge a partial component set over the defaults. */ declare function mergeComponents(components?: MarkdownComponents): ResolvedMarkdownComponents; //#endregion //#region src/render.d.ts interface RenderMarkdownOptions { /** Theme overrides (deep-merged over the defaults). */ theme?: DeepPartial; /** Block-component overrides. */ components?: MarkdownComponents; /** Parser options (gfm, math, containers). */ parserOptions?: MarkdownParseOptions; /** * The two primitives the dispatcher itself constructs — the block `Stack` * and the inline `RichText` flow. A non-DOM renderer (React Native) swaps in * its own implementations here; the measure contract must be identical. * Pass a **stable object identity** — the block memo caches key on it. */ primitives?: MarkdownPrimitives; } /** * Parse `source` and render it into a tree of mugen primitives. The result is * pure and hook-free, so it can be returned straight from a `` * `render` and measured by the walker. Memoization of parsing/theme/components * keeps the measure and render passes cheap. */ declare function renderMarkdown(source: string, options?: RenderMarkdownOptions): ReactNode; //#endregion //#region src/primitives/code-block.d.ts /** * A fenced code block. Code does not wrap — long lines scroll horizontally — so * its height is simply `lineCount × lineHeight + 2 × padding` (plus an optional * fixed-height {@link CodeBlockHeader} bar), independent of the row width. That * makes it trivially and exactly measurable. * * Syntax highlighting is layered on as pure paint, never layout: the `` * text renders immediately (plain, selectable, accessible), the language is * tokenized off the critical path in time-sliced chunks, and token colours are * painted onto canvas tiles overlaying the text — at which point the DOM text * turns `color: transparent` in the same frame. Highlighting therefore can't * block first paint and can't ever change the measured height. */ /** * Optional chrome bar above the code: the language on the left, a * copy-to-clipboard button on the right. Its fixed `height` is added to the * block's measured height, so the block still measures exactly what it paints. * Pure decoration otherwise — the bar never wraps and never grows. */ interface CodeBlockHeader { /** Left-aligned label; falls back to {@link CodeBlockProps.lang}, then `code`. */ label?: string; /** Fixed bar height in px (folded into the measured height). */ height: number; /** Label + button font size in px. */ fontSize: number; /** Monospace family for the label/button; defaults to `monospace`. */ fontFamily?: string; background?: string; color?: string; borderColor?: string; /** Copy-button fill. */ buttonBackground?: string; } interface CodeBlockProps { /** Raw code text. Newlines determine the line count. */ value: string; /** Info-string language, if any (drives the built-in highlighter / labels). */ lang?: string; /** Monospace font. Required. */ font: Font; /** Line height in px. Required. */ lineHeight: number; /** Uniform padding in px (chrome counted in the height). */ padding?: number; background?: string; color?: string; radius?: number; /** Cosmetic outer border colour, painted inset so it does not affect measurement. */ borderColor?: string; /** * Token-colour overrides for the built-in canvas highlighter, or `false` to * disable it. Defaults to {@link defaultTokenColors}; only languages with a * registered profile are highlighted either way. */ highlight?: Partial | false; /** * A chrome bar above the code (language label + copy button). Omit for the * bare `
`. Its `height` is folded into the measured height.
   */
  header?: CodeBlockHeader;
  style?: MeasurableStyle;
  className?: SafeClassName;
}
/** A measurable fenced-code primitive (no wrapping; height from line count). */
declare const CodeBlock: (props: CodeBlockProps) => ReactElement;
//#endregion
//#region src/primitives/table-block.d.ts
/**
 * A GFM table that *looks* like a table, stays exactly measurable, and never
 * crushes its columns on a narrow viewport.
 *
 * Each column has a **max-content width** (the width its widest cell wants) and
 * a **minimum width** (`min(max-content, minColumnWidth)` — a naturally short
 * column keeps its content width; a long one may wrap, but only down to the
 * floor). Widths are then resolved exactly the way CSS flexbox resolves
 * `flex-grow: max-content; flex-basis: 0` cells with a `min-width` floor:
 * distribute the available width in proportion to each column's max-content
 * size, pin any column that would fall below its floor, and re-share the
 * remainder among the rest. When every column is pinned — the viewport is
 * narrower than the sum of the minimums — the row overflows and the table
 * scrolls horizontally inside a clipped viewport rather than wrapping each
 * column to a sliver. `resolveColumnWidths` mirrors that algorithm so the
 * analytic height matches the painted flex layout at any width.
 *
 * The design is frameless — a flat "hairline" table: horizontal row rules under
 * the header and between rows are the only chrome, with no outer box or header
 * fill. Those rules are real `divider`-px elements (counted in the height); an
 * optional corner `radius` is pure overflow clipping. The horizontal scroller
 * hides its scrollbar (`scrollbar-width: none`) so the scroll affordance never
 * adds height the measure can't see, on classic-scrollbar platforms included.
 */
interface TableBlockProps {
  /** Cell content per row, header row first. Rows may be ragged. */
  rows: ReactNode[][];
  /** Uniform cell padding in px (counted in the height). */
  cellPadding: number;
  /** Hairline between rows and the outer ring, in px. 0 disables both. */
  divider: number;
  /** Hairline / ring colour. */
  borderColor: string;
  /** Background behind the header row. */
  headerBackground: string;
  /** Corner radius in px (clip only — no height impact). */
  radius: number;
  /**
   * Reasonable minimum rendered column width in px (padding included). Columns
   * whose content is naturally narrower keep their content width; wider columns
   * wrap down to this floor, and once the minimums no longer fit the row the
   * table scrolls horizontally. Defaults to {@link DEFAULT_MIN_COLUMN_WIDTH}.
   */
  minColumnWidth?: number;
  style?: MeasurableStyle;
  className?: SafeClassName;
}
/** Fallback minimum column width when a caller omits `minColumnWidth`. */
declare const DEFAULT_MIN_COLUMN_WIDTH = 96;
/** The shared per-column geometry used by both the measure and the renders. */
interface TableColumns {
  /** Per-column max-content width, padding included. */
  naturals: number[];
  /** Per-column minimum width, padding included = `min(natural, minColumnWidth)`. */
  minimums: number[];
  /** Σ minimums — the width below which the table stops shrinking and scrolls. */
  minTableWidth: number;
}
/**
 * Resolve the shared column geometry (max-content widths + per-column floors).
 * Falls back to equal, floorless columns when a cell's natural width is
 * unknowable (SSR / no metrics) — the same fallback the old renderer used.
 */
declare function tableColumns(p: TableBlockProps, ctx: MeasureContext): TableColumns;
/**
 * Resolve the final per-column pixel widths at an available width, replicating
 * CSS flexbox's grow-with-`min-width` resolution for cells styled
 * `flex-grow: natural; flex-basis: 0; min-width: minimum`:
 *
 *  1. distribute the width across the unfrozen columns in proportion to their
 *     max-content size,
 *  2. pin (freeze) every column whose share is below its minimum,
 *  3. subtract the pinned minimums and repeat with the rest.
 *
 * When no column violates its floor this is plain content-proportional sizing
 * (the old behaviour, filling the row). When some do, the narrow columns hold
 * their readable minimum and the wide ones share what's left. When *every*
 * column is pinned — the viewport is narrower than Σ minimums — the widths sum
 * to `minTableWidth`, exceeding the viewport, and the table scrolls. The result
 * always sums to `max(availWidth, minTableWidth)`, which is the table's painted
 * width.
 */
declare function resolveColumnWidths(cols: TableColumns, availWidth: number): number[];
/** A measurable GFM-table primitive with aligned, floored, content-proportional columns. */
declare const TableBlock: (props: TableBlockProps) => ReactElement;
//#endregion
//#region src/highlight/languages.d.ts
/**
 * Language profiles for the built-in tokenizer. A profile is a small data
 * description — comment markers, string delimiters, keyword sets, and a few
 * classification heuristics — interpreted by one shared scanner, so adding a
 * language is a handful of lines rather than a grammar.
 */
interface LanguageProfile {
  /** Markers that comment to end-of-line (`//`, `#`, `--`). */
  lineComments: readonly string[];
  /** Open/close pairs that may span lines (C-style block comments, ``). */
  blockComments: readonly (readonly [string, string])[];
  /** Single-char string delimiters; an unclosed one ends at end-of-line. */
  quotes: readonly string[];
  /** String delimiters that carry across lines (`` ` ``, `'''`, `"""`). */
  multilineQuotes: readonly string[];
  keywords: ReadonlySet;
  constants: ReadonlySet;
  /** Colour Capitalised identifiers as types. */
  capitalTypes: boolean;
  /** Extra identifier characters beyond `[A-Za-z0-9_$]` (e.g. `-` for CSS). */
  identExtra: string;
  /** Lower-case words before keyword/constant lookup (SQL, Dockerfile). */
  caseInsensitive?: boolean;
  /** A string immediately followed by `:` is a property key (JSON). */
  stringKeys?: boolean;
  /** An identifier immediately followed by `:` is a property key. */
  colonProps?: boolean;
  /** An identifier followed by `=` (not `==`) is a property/attribute name. */
  eqProps?: boolean;
  /** An identifier right after `<` or `