/** Visible text of stored HTML, without pulling in the sanitizer. */ export function htmlToPlain(value: string): string { return value .replace(//gi, " ") .replace(/<\/(p|div|h2|h3|h4|li|blockquote)>/gi, " ") .replace(/<[^>]+>/g, "") .replace(/ /g, " ") .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/\s+/g, " ") .trim(); }