/** * DocumentParser — SPI interface + MarkdownParser implementation. * * Parses structured documents into sections for downstream extraction. * Supports frontmatter metadata extraction and heading-based sectioning. */ import type { KnowledgeSource } from '../types/index.js'; export interface ParsedSection { title: string; content: string; level: number; metadata: Record; } export interface Frontmatter { title?: string; tags?: string[]; domain?: string; [key: string]: unknown; } /** * SPI: Any document parser must implement this interface. */ export interface DocumentParser { parse(content: string, source: KnowledgeSource): ParsedSection[]; } /** * MarkdownParser — Parses markdown documents into heading-based sections. * * Extracts YAML frontmatter (---) and splits content by headings. * Each heading becomes a ParsedSection with its body content. */ /** * PlainTextParser — Splits plain text into sections by double-newline paragraphs. * * Used for plain text, web page content, and pre-converted formats (PDF→text, EPUB→text). * Each paragraph becomes a ParsedSection at level 0. */ export declare class PlainTextParser implements DocumentParser { parse(content: string, _source: KnowledgeSource): ParsedSection[]; } /** * MarkdownParser — Parses markdown documents into heading-based sections. * * Extracts YAML frontmatter (---) and splits content by headings. * Each heading becomes a ParsedSection with its body content. */ export declare class MarkdownParser implements DocumentParser { parse(content: string, source: KnowledgeSource): ParsedSection[]; /** * Extract YAML frontmatter delimited by --- lines. */ extractFrontmatter(content: string): { frontmatter: Frontmatter; body: string; }; /** * Minimal YAML parser for frontmatter (key: value pairs, arrays with - prefix). */ private parseYamlSimple; /** * Split markdown body into sections by headings. * Content before the first heading becomes a level-0 section. */ private splitByHeadings; } //# sourceMappingURL=document-parser.d.ts.map