import { type WikiLink } from '../utils/wikilink.js'; /** Zero-based UTF-16 source position: absolute offset plus line/character. */ export interface SourcePosition { /** Absolute offset into the source string, in UTF-16 code units. */ readonly offset: number; /** Zero-based line number. Both LF and CRLF advance one line at `\n`. */ readonly line: number; /** Zero-based column on `line`, in UTF-16 code units since the line start. */ readonly character: number; } /** End-exclusive `[start, end)` UTF-16 source range. */ export interface SourceRange { readonly start: SourcePosition; readonly end: SourcePosition; } /** An eligible leaf text span, in source order. */ export interface ContextualTextSegment { /** Normalized mdast `text` node value (Markdown escapes/entities resolved). */ readonly value: string; /** Exact `source.slice(range.start.offset, range.end.offset)`. */ readonly rawSource: string; readonly range: SourceRange; } /** A wikilink found within a single eligible text segment. */ export interface ContextualWikiLink extends Readonly { /** Exact `[[...]]` source; equals `source.slice(range.start.offset, range.end.offset)`. */ readonly rawSource: string; readonly range: SourceRange; } export type LineEnding = 'none' | 'lf' | 'crlf' | 'mixed'; export interface ContextualMarkdownFacts { readonly ok: true; /** `source.length`, in UTF-16 code units. */ readonly sourceLength: number; readonly lineEnding: LineEnding; /** Eligible leaf text segments, in source order. */ readonly textSegments: readonly ContextualTextSegment[]; /** Contextual wikilinks, in source order. */ readonly wikilinks: readonly ContextualWikiLink[]; } export interface ContextualMarkdownParseFailure { readonly ok: false; readonly reason: string; } export type ContextualMarkdownResult = ContextualMarkdownFacts | ContextualMarkdownParseFailure; /** * Extract immutable contextual Markdown facts from a source string. * * Pure: accepts only a string and returns a frozen plain result. Never * throws; an unexpected parser failure produces a typed failure rather than * an unrestricted raw-text fallback. */ export declare function extractContextualMarkdownFacts(source: string): ContextualMarkdownResult; //# sourceMappingURL=contextual-facts.d.ts.map