import type { DocumentSource, FileInput } from './index.js'; import type { FileLoaderOptions } from './text.js'; /** A Markdown file taken apart: its front matter, its title, and its body. */ export interface MarkdownDocument { /** The body, without the front matter. */ text: string; /** Fields from a leading `---` block: strings, numbers, booleans, and inline `[a, b]` lists. */ frontMatter: Record; /** The front matter's `title`, or else the first `#` heading. */ title?: string; } /** * Splits off a Markdown file's front matter and finds its title. The front matter is read as flat * `key: value` lines — the subset almost every docs site uses — so no YAML parser is needed; a * nested value is kept as its raw text. */ export declare function parseMarkdown(markdown: string): MarkdownDocument; /** Options for `loadMarkdown()`. */ export interface MarkdownLoaderOptions extends FileLoaderOptions { /** * Removes Markdown syntax — link targets, images, emphasis, and code fences — leaving the words. * Off by default, because headings are what `splitOnMarkdownHeadings` splits on and models read * Markdown well. */ plainText?: boolean; } /** * Markdown files, one document each. Front matter and the title go into the metadata, so a filter can * select by them; ingest with `splitOnMarkdownHeadings` so no chunk spans two sections. */ export declare function loadMarkdown(inputs: FileInput | Iterable, options?: MarkdownLoaderOptions): AsyncGenerator; /** Markdown with its syntax removed and its words kept. */ export declare function markdownToPlainText(markdown: string): string;