/** * Shared low-level scanning helpers: source normalization, line classification, * escape handling, and URL scanning. Pure functions, no AST/JSX dependency. */ import type { HeadingLevel, TableAlign } from '../ast.js'; /** * Normalize source for uniform parsing: CRLF/CR → LF, and expand leading tabs * to four spaces so indentation logic is consistent. Tabs after the first * non-space content are left alone (they only matter for block indentation). */ export declare function normalize(src: string): string; /** Count leading spaces (indentation) of a line. */ export declare function indentOf(line: string): number; /** True when a line is blank (empty or whitespace-only). */ export declare function isBlank(line: string): boolean; export interface FenceInfo { /** The fence character: '`' or '~'. */ char: string; /** Length of the fence run (≥ 3). */ length: number; /** Indentation of the fence (stripped from content lines). */ indent: number; /** Trimmed info string (language) after the opening fence, if any. */ info: string; } /** Match an opening (or closing) fenced-code-block marker. */ export declare function matchFence(line: string): FenceInfo | null; /** True when `line` closes a fence opened by `open`. */ export declare function isFenceClose(line: string, open: FenceInfo): boolean; /** Match an ATX heading (`#`..`######`). Returns level + text, or null. */ export declare function matchHeading(line: string): { level: HeadingLevel; text: string; } | null; /** Match a thematic break (`---`, `***`, `___`, optionally spaced). */ export declare function isThematicBreak(line: string): boolean; export interface ListMarkerInfo { ordered: boolean; /** Start number (ordered) or 1 (unordered). */ start: number; /** The bullet/delimiter char: '-', '*', '+', '.', or ')'. */ delimiter: string; /** Column where the item content begins (used for continuation indent). */ contentIndent: number; /** Indentation of the marker itself. */ markerIndent: number; /** The content following the marker on the same line. */ content: string; } /** Match a list-item marker (`- `, `* `, `+ `, `1. `, `1) `). */ export declare function matchListMarker(line: string): ListMarkerInfo | null; /** Match an empty list item (`-` / `1.` with nothing after). */ export declare function matchEmptyListMarker(line: string): ListMarkerInfo | null; /** * Parse a GFM table delimiter row (`| --- | :--: | --: |`) into per-column * alignment, or return null if the line is not a valid delimiter row. */ export declare function matchTableDelimiter(line: string): (TableAlign | null)[] | null; /** Split a table row into raw cell strings, honoring `\|` escapes. */ export declare function splitTableRow(line: string): string[]; /** True when `ch` is a backslash-escapable punctuation character. */ export declare function isEscapable(ch: string): boolean; /** * Return a link href if it is safe to expose to handlers, else `'#'`. Blocks * `javascript:`/`data:` and other unexpected schemes. Relative/anchor links and * the recognized safe schemes pass through unchanged. */ export declare function sanitizeHref(href: string): string; /** Trailing punctuation trimmed from bare-URL autolinks (GFM behavior). */ export declare function trimAutolinkTail(url: string): { url: string; tail: string; };