/** * Markdown parser for programmatic spec management * * Implements spec 059: Programmatic Spec Management * * This module provides mechanical parsing of markdown structure: * - Section detection (headings and their line ranges) * - Line extraction/removal/replacement * - Basic structure analysis * * NO semantic analysis - just mechanical operations on text */ /** * Represents a section in the markdown document */ export interface Section { /** Section title (without the # prefix) */ title: string; /** Heading level (1-6) */ level: number; /** Start line number (1-indexed) */ startLine: number; /** End line number (1-indexed, inclusive) */ endLine: number; /** Line count */ lineCount: number; /** Direct subsections */ subsections: Section[]; } /** * Parse markdown content and extract section structure */ export declare function parseMarkdownSections(content: string): Section[]; /** * Find a section by title (case-insensitive, partial match) */ export declare function findSection(sections: Section[], titlePattern: string): Section | null; /** * Flatten section tree to array (depth-first) */ export declare function flattenSections(sections: Section[]): Section[]; /** * Extract lines from content * @param content Full markdown content * @param startLine Start line (1-indexed, inclusive) * @param endLine End line (1-indexed, inclusive) */ export declare function extractLines(content: string, startLine: number, endLine: number): string; /** * Remove lines from content * @param content Full markdown content * @param startLine Start line (1-indexed, inclusive) * @param endLine End line (1-indexed, inclusive) */ export declare function removeLines(content: string, startLine: number, endLine: number): string; /** * Replace lines in content * @param content Full markdown content * @param startLine Start line (1-indexed, inclusive) * @param endLine End line (1-indexed, inclusive) * @param replacement Replacement text (can be multi-line) */ export declare function replaceLines(content: string, startLine: number, endLine: number, replacement: string): string; /** * Count lines in content */ export declare function countLines(content: string): number; /** * Get line at specific line number (1-indexed) */ export declare function getLine(content: string, lineNumber: number): string; /** * Parse markdown structure for analysis */ export interface MarkdownStructure { /** Total line count */ lines: number; /** Section hierarchy */ sections: Section[]; /** Flattened sections */ allSections: Section[]; /** Section count by level */ sectionsByLevel: { h1: number; h2: number; h3: number; h4: number; h5: number; h6: number; total: number; }; /** Code block count */ codeBlocks: number; /** Maximum nesting depth */ maxNesting: number; } /** * Analyze markdown structure */ export declare function analyzeMarkdownStructure(content: string): MarkdownStructure; //# sourceMappingURL=markdown-parser.d.ts.map