html-ellipsis
Version:
truncates a html string without messing up the tags
12 lines • 561 B
TypeScript
/**
* Truncates a string to maxLength chars without destroying HTML tags.
* Optionally adds ellipsis to the end of the string (this does not make
* the string longer than `maxLength`)
*
* @param html - The HTML string to truncate. The function assumes valid HTML.
* @param maxLength - The max truncated length
* @param addEllipsis - Add … at the end of the string.
* @returns The shortened string
*/
export declare function htmlEllipsis(html: string, maxLength: number, addEllipsis?: boolean): string;
//# sourceMappingURL=html-ellipsis.d.ts.map