/** * convert.ts — HTML → Markdown converter + section detection. * * The built-in `minimal` converter is a hand-rolled tag walker that * handles the common cases in documentation pages (headings, * paragraphs, lists, code, blockquotes, tables, links, images, inline * formatting). Pages with complex tables, math, or unusual structures * can opt into `--converter turndown` (a peer dependency) for richer * fidelity. * * After conversion, section detection scans the Markdown for ATX * headings and produces a `Section[]` index (slug, level, heading, * byte range) that the `--section` flag uses for selective inlining. */ import type { Section } from "./sections.js"; /** Result of an HTML→Markdown conversion. */ export interface ConvertResult { /** The converted Markdown text. */ markdown: string; /** Sections detected from the converted Markdown's headings. */ sections: Section[]; } /** Converter mode — `minimal` (built-in) or `turndown` (peer dep). */ export type ConverterMode = "minimal" | "turndown"; /** Options for {@link convertHtmlToMarkdown}. */ export interface ConvertOptions { converter?: ConverterMode; } /** * Convert HTML to Markdown using the configured converter. * * Default converter is `minimal` (built-in, zero dependencies). * Pass `converter: "turndown"` to use the `turndown` peer dependency * for richer table fidelity and smarter list handling. * * For `text/plain` content (no `<` in the body), treat the body as * already-Markdown and only run section detection. */ export declare function convertHtmlToMarkdown(html: string, opts?: ConvertOptions): Promise; /** * Convert HTML to Markdown using the minimal built-in converter. * * Walks the token stream, maintaining a stack of open tags. When we * encounter a known tag we emit the corresponding Markdown construct. * Unknown tags are flattened — their text content is preserved. */ export declare function convertMinimal(html: string): string; /** * Scan converted Markdown for ATX headings and produce a section list. * * A section covers everything from the heading line up to (but not * including) the next heading at the same or higher level, or EOF. */ export declare function detectSections(markdown: string): Section[]; //# sourceMappingURL=convert.d.ts.map