@akira108sys/html-rewriter-readability
Version:
A library to extract readable content with Mozilla/Readability algorithm using Cloudflare HTMLRewriter.
22 lines (21 loc) • 1 kB
TypeScript
import type { ElementInfo } from './types';
export interface MarkdownConverterOptions {
debug?: boolean;
}
export declare class MarkdownConverter {
private elementStore;
private elementsToKeepIdsSet;
private baseURI;
private options;
constructor(elementStore: Map<number, ElementInfo>, elementsToKeepIdsSet: Set<number>, baseURI: URL, options?: MarkdownConverterOptions);
convert(rootElementId: number | null): string;
/**
* Recursively converts the element with the specified ID and its descendants to a Markdown string.
* @param id ID of the element to convert
* @param listLevel Current nesting level of the list (0 is outside a list, 1 is the top-level list)
* @param isListOrdered Whether the parent is an ordered list (affects LI elements only)
* @param listItemNumber Current item number within an ordered list (affects LI elements only)
* @returns Part of the generated Markdown string
*/
private convertNodeRecursive;
}