import type { DocumentSource, FileInput } from './index.js';
import type { FileLoaderOptions } from './text.js';
/** An HTML page as text, with what a loader needs from its head and its links. */
export interface HtmlText {
/** The readable text. Headings become Markdown `#` lines and list items `- ` lines. */
text: string;
/** The `
`. */
title?: string;
/** The ``. */
description?: string;
/** Every `href` on an ``, resolved against `baseUrl` when one is given. */
links: string[];
}
/** Options for `htmlToText()`. */
export interface HtmlToTextOptions {
/**
* Keeps only ``, or else ``, when the page has one, dropping navigation, headers,
* and footers. On by default.
*/
mainContent?: boolean;
/** Resolves relative links. */
baseUrl?: string | URL;
}
/**
* Turns HTML into readable text without a DOM: scripts, styles, and the head are dropped, block
* elements become line breaks, headings become Markdown headings so `splitOnMarkdownHeadings` splits
* a page at its sections, and entities are decoded. A heuristic, not a browser: it is built for pages
* whose content is in the HTML, not rendered by script.
*/
export declare function htmlToText(html: string, options?: HtmlToTextOptions): HtmlText;
/** Options for `loadHtml()`. */
export interface HtmlLoaderOptions extends FileLoaderOptions, HtmlToTextOptions {
}
/** HTML files, one document each, with the page title and description in the metadata. */
export declare function loadHtml(inputs: FileInput | Iterable, options?: HtmlLoaderOptions): AsyncGenerator;