@visulima/email
Version:
A comprehensive email library with multi-provider support, crypto utilities, and template engines
28 lines (27 loc) • 1.19 kB
TypeScript
/**
* Converts HTML content to plain text format.
* @param html The HTML string to convert.
* @param options Configuration options for the html-to-text conversion.
* @param options.longWordSplit Options for handling long words that exceed the word wrap limit.
* @param options.longWordSplit.forceWrapOnLimit Whether to force wrap on the limit.
* @param options.longWordSplit.wrapCharacters Characters to use for wrapping.
* @param options.preserveNewlines Whether to preserve newlines in the output.
* @param options.selectors Custom selectors for formatting specific HTML elements.
* @param options.wordwrap The word wrap limit (number of characters) or false to disable.
* @returns The converted plain text string.
* @throws {EmailError} When html-to-text is not installed or conversion fails.
*/
declare const htmlToText: (html: string, options?: {
longWordSplit?: {
forceWrapOnLimit?: boolean;
wrapCharacters?: string[];
};
preserveNewlines?: boolean;
selectors?: {
format?: string;
options?: Record<string, unknown>;
selector: string;
}[];
wordwrap?: number | false;
}) => string;
export default htmlToText;