/** * Hand-rolled, dependency-free markdown structure scanning (greenfield by * design — zero markdown deps). The fence-aware splitter is the algorithm * from packages/ui/src/chrome/markdown.tsx (React-local, so copied rather * than imported), extended from h2/h3 to h1-h6 with heading-path * accumulation and CommonMark-ish list-item fence handling * fix 2). */ /** CommonMark-faithful-enough fence state shared by every scanner in this module: a fence closes only on a run of the SAME character, at least as long as the opener — a heading (or blank line) inside a code block never becomes a structural boundary, including fences opened inside list items. An unterminated fence swallows the rest of the document into the current section, which is the safe reading for chunking. */ export declare function fenceTracker(): { feed(line: string): boolean; readonly open: boolean; }; /** True when the block's first line opens a code fence — used by the chunker to keep code atomic where prose would subdivide. */ export declare const startsWithFence: (block: string) => boolean; export interface MarkdownSection { /** Heading text, "" for the preamble before the first heading. */ heading: string; /** 1-6; 0 for the preamble. */ level: number; /** Ancestor headings down to and including this one ([] for the preamble). */ path: string[]; /** Section lines, heading line included (the preamble has no heading line). */ lines: string[]; } /** Splits markdown into heading-delimited sections, fence-aware. */ export declare function splitHeadingSections(text: string): MarkdownSection[]; /** Normalizes raw file text for ingestion: BOM stripped, CRLF/CR folded to LF, trailing whitespace-only tail trimmed. Deliberately keeps markdown markup intact — heading structure is what the chunker keys on. */ export declare function normalizeText(raw: string): string; /** Splits section lines into blank-line-delimited blocks for budget packing. Fenced code is atomic here: blank lines inside a fence never split, so a block boundary can never land inside code. */ export declare function splitBlocks(lines: string[]): string[]; //# sourceMappingURL=markdown.d.ts.map