/** * @file Line-level scanners for the block parser. * * Pure, allocation-conscious functions that classify one (detabbed) * line at a char-code level: does a construct start here, and where * does its content begin? The parser in parser.js owns all state; this * module owns none. Every regular expression is compiled once at * module load — nothing in here builds a pattern per call. */ /** * Thematic break: three or more `*`, `-` or `_` (same character), * interleaved with spaces, nothing else on the line. * @param {string} line * @param {number} start first non-space offset * @returns {boolean} */ export declare function scanThematicBreak(line: string, start: number): boolean; /** * ATX heading: `#{1,6}` followed by space or end of line. Returns the * depth and the heading text (closing `#` run stripped), or null. * @param {string} line * @param {number} start first non-space offset * @returns {{ depth: number, text: string } | null} */ export declare function scanAtxHeading(line: string, start: number): { depth: number; text: string; } | null; /** * Code fence opener: three or more backticks or tildes. A backtick * fence's info string may not contain a backtick. * @param {string} line * @param {number} start first non-space offset * @returns {{ marker: number, length: number, info: string } | null} */ export declare function scanFenceOpen(line: string, start: number): { marker: number; length: number; info: string; } | null; /** * Does this line close a fence opened with `marker` × `length`? * @param {string} line * @param {number} marker * @param {number} length * @returns {boolean} */ export declare function scanFenceClose(line: string, marker: number, length: number): boolean; /** * Split a fence info string into `lang` (first word) and `meta` (the * rest), resolving backslash escapes and character references in both. * @param {string} info * @returns {{ lang: string|null, meta: string|null }} */ export declare function splitFenceInfo(info: string): { lang: string | null; meta: string | null; }; /** * Blockquote marker at `offset`: `>` with an optional following space. * Returns the content offset, or -1. * @param {string} line * @param {number} offset first non-space offset * @returns {number} */ export declare function scanBlockquote(line: string, offset: number): number; /** * List marker: `-`/`+`/`*` bullet or `1.`/`1)` ordered (start ≤ 9 * digits), followed by a space or line end. Returns the marker * geometry the parser turns into a list container, or null. * @param {string} line * @param {number} start first non-space offset * @returns {{ ordered: boolean, bullet: string, start: number, * delimiter: string, contentOffset: number } | null} */ export declare function scanListMarker(line: string, start: number): { ordered: boolean; bullet: string; start: number; delimiter: string; contentOffset: number; } | null; /** * Setext underline under an open paragraph: `=` run (depth 1) or `-` * run (depth 2), possibly space-padded. Returns 0 when neither. * @param {string} line * @param {number} start first non-space offset * @returns {number} */ export declare function scanSetextUnderline(line: string, start: number): number; /** * GFM table delimiter row: cells of `---`, `:--`, `--:`, `:-:` split * by pipes. Returns the alignment array, or null. * @param {string} line * @returns {(string|null)[] | null} */ export declare function scanTableDelimiter(line: string): (string | null)[] | null; /** * Split a table row into raw cell strings on unescaped `|`, honoring * `\|` and pipes inside backtick code spans. Leading and trailing * empty cells from outer pipes are dropped. Returns null when the line * contains no pipe at all. * @param {string} line * @returns {string[] | null} */ export declare function splitTableRow(line: string): string[] | null; /** * Classify an HTML block opener at `start` (CommonMark types 1–7); * 0 means no HTML block starts here. Type 7 is only valid when no * paragraph is open — the caller passes `paragraphOpen`. * @param {string} line * @param {number} start first non-space offset * @param {boolean} paragraphOpen * @returns {number} */ export declare function scanHtmlBlockStart(line: string, start: number, paragraphOpen: boolean): number; /** * Does this line end an HTML block of `kind`? Types 6/7 end on the * following blank line (the parser checks that); types 1–5 end on a * content condition, which may sit on the opening line itself. * @param {number} kind * @param {string} line * @returns {boolean} */ export declare function scanHtmlBlockEnd(kind: number, line: string): boolean; /** * Is this char code a space or tab? * @param {number} c * @returns {boolean} */ export declare function isSpaceCode(c: number): boolean; /** * Link reference definition at the start of a closed paragraph's text: * `[label]: destination "title"` (title optional, may be single-, * double- or paren-quoted; destination may be `<>`-wrapped). Returns * the definition and the offset after it, or null. * @param {string} text the paragraph's raw text * @param {number} pos * @returns {{ label: string, url: string, title: string|null, end: number } | null} */ export declare function scanLinkDefinition(text: string, pos: number): { label: string; url: string; title: string | null; end: number; } | null; /** * Scan a link destination at `pos`: `<...>` wrapped or a run of * non-space characters with balanced parens. * @param {string} text * @param {number} pos * @returns {{ url: string, end: number } | null} */ export declare function scanLinkDestination(text: string, pos: number): { url: string; end: number; } | null; /** * Scan a link title at `pos`: `"..."`, `'...'` or `(...)`. * @param {string} text * @param {number} pos * @returns {{ title: string, end: number } | null} */ export declare function scanLinkTitle(text: string, pos: number): { title: string; end: number; } | null; /** ASCII punctuation membership (emphasis flanking, backslash escapes). */ export declare const ASCII_PUNCT: Uint8Array; /** * Is this code point a whitespace character in the spec's sense? * @param {number} point * @returns {boolean} */ export declare function isUnicodeWhitespace(point: number): boolean; /** * Is this code point a punctuation character in the spec's sense (P* or S*)? * @param {number} point * @returns {boolean} */ export declare function isUnicodePunctuation(point: number): boolean; /** * The whole code point ending at `pos`, so a run preceded by an astral * symbol classifies on the symbol and not on a surrogate half. * @param {string} src @param {number} pos * @returns {number} */ export declare function codePointBefore(src: string, pos: number): number; /** * Normalize a link label for matching: trim, collapse internal * whitespace runs to one space, and case fold. * * The fold is lower→upper→lower, not `toLowerCase()`: the spec asks for * Unicode case folding, under which `ẞ` matches `SS`, while lower-casing * alone maps `ẞ` to `ß` and never meets `ss`. The round trip routes both * spellings through the same expansion (`ẞ`→`ß`→`SS`→`ss`, and `fi`→`fi`), * which is as close to the full fold as a zero-dependency package gets * without shipping the table. * @param {string} label * @returns {string} */ export declare function normalizeLabel(label: string): string; /** * Footnote definition opener: `[^label]:` and the spaces after it. * @param {string} line * @param {number} start first non-space offset * @returns {{ label: string, contentOffset: number } | null} */ export declare function scanFootnoteDefinition(line: string, start: number): { label: string; contentOffset: number; } | null; /** * Footnote reference: `[^label]` in inline text. * @param {string} text * @param {number} start offset of the `[` * @returns {{ label: string, end: number } | null} */ export declare function scanFootnoteReference(text: string, start: number): { label: string; end: number; } | null; /** * Find every extended autolink in one text value (GFM §Autolinks): bare * `www.…`, `http://…`, `https://…`, `ftp://…` and email addresses. * Returns the matches in order, or `null` when there are none — the * common answer, and the one that costs nothing. * * This works on a TEXT VALUE and not on the source, which is what makes * the entity rule meaningful: `©` has already become `©` by the * time we look, so the only `&…;` left to exclude is one that was never * an entity in the first place. * @param {string} value * @returns {{ start: number, end: number, url: string }[] | null} */ export declare function scanAutolinkLiterals(value: string): { start: number; end: number; url: string; }[] | null;