UNPKG

html-content-processor

Version:

A professional library for processing, cleaning, filtering, and converting HTML content to Markdown. Features advanced customization options, presets, plugin support, fluent API, and TypeScript integration for reliable content extraction.

36 lines (35 loc) 1.63 kB
/** * Markdown Generator - for converting HTML to Markdown. */ import { Html2TextOptions, MarkdownGenerationResult } from './types'; import { HtmlFilter } from './html-filter'; export interface MarkdownGeneratorOptions extends Html2TextOptions { contentSource?: 'cleaned_html' | 'raw_html' | 'fit_html'; } export declare class DefaultMarkdownGenerator { private contentFilter; private options; /** * Creates a Markdown generator instance. * @param contentFilter Content filter instance. * @param options Generation options. */ constructor(contentFilter?: HtmlFilter | null, options?: MarkdownGeneratorOptions); /** * Converts links to reference style. * @param markdown Markdown text. * @param baseUrl Base URL for resolving relative links. * @returns A tuple containing the Markdown with references and the references section. */ convertLinksToRefs(markdown: string, baseUrl?: string): [string, string]; /** * Generates Markdown from HTML. * @param inputHtml Input HTML string. * @param baseUrl Base URL for resolving relative links. * @param html2textOptions Options for HTML to text conversion. * @param contentFilterOverride Optional override for the content filter. * @param citations Whether to generate citations for links. * @returns Markdown generation result object. */ generateMarkdown(inputHtml: string, baseUrl?: string, html2textOptions?: Html2TextOptions, contentFilterOverride?: HtmlFilter | null, citations?: boolean): Promise<MarkdownGenerationResult>; }