/** * Section handling - map between section .md files and combined documents */ import type { SectionConfig, SectionsConfig, ExtractedSection } from './types.js'; /** * Extract header from a markdown file */ export declare function extractHeader(filePath: string): string | null; /** * Extract the first markdown heading of ANY level (`#`–`######`) from a file. * * Unlike {@link extractHeader} (which is H1-only by contract), this is used to * derive a section's header from files that lead with a subsection — e.g. * `02_objectives.md` starting with `## 1.2 Objectives`. Using the real first * heading lets the derived header match the corresponding docx heading. */ export declare function extractFirstHeading(filePath: string): string | null; /** * Generate sections.yaml from existing .md files */ export declare function generateConfig(directory: string, excludePatterns?: string[]): SectionsConfig; /** * Load sections config from yaml file */ export declare function loadConfig(configPath: string): SectionsConfig; /** * Save sections config to yaml file */ export declare function saveConfig(configPath: string, config: SectionsConfig): void; /** * Derive a SectionsConfig from the `sections:` list in rev.yaml. * * Each listed file's header is its first markdown H1 (falling back to a * title-cased file name); order follows the list order in rev.yaml. This is * the same section list that `build` consumes, so a project that only has a * `rev.yaml` needs no separate `sections.yaml`. * * Returns null when rev.yaml is absent, unparseable, or has no `sections` list. */ export declare function deriveSectionsFromRev(directory: string): SectionsConfig | null; /** * Resolve the effective sections config for a project directory. * * Precedence (single source of truth, with optional override): * 1. An explicit sections config file (default `sections.yaml`) when it * exists — lets users override headers/aliases/order. * 2. Otherwise the `sections:` list in `rev.yaml`, via {@link deriveSectionsFromRev}. * * Returns null only when neither source yields any sections; callers turn that * into a user-facing error. */ export declare function resolveSectionsConfig(directory: string, configFileName?: string): { config: SectionsConfig; source: string; } | null; /** * Match a heading to a section file */ export declare function matchHeading(heading: string, sections: Record): { file: string; config: SectionConfig; } | null; /** * Extract sections from Word document text */ export declare function extractSectionsFromText(text: string, sections: Record): ExtractedSection[]; /** * Parse annotated paper.md and split back to section files */ export declare function splitAnnotatedPaper(paperContent: string, sections: Record): Map; /** * Get ordered list of section files from config */ export declare function getOrderedSections(config: SectionsConfig): string[]; //# sourceMappingURL=sections.d.ts.map