// SPDX-License-Identifier: AGPL-3.0-or-later import {decode} from 'html-entities'; export function decodeHTMLEntities(html?: string | null): string { if (!html) return ''; return decode(html); } export function stripHtmlTags(html?: string | null): string { if (!html) return ''; return html.replace(/<[^>]*>/g, ''); } export function htmlToMarkdown(html?: string | null): string { if (!html) return ''; let md = html .replace(/

/gi, '\n\n') .replace(/<\/p>/gi, '') .replace(//gi, '\n') .replace(//gi, '\n\n**') .replace(/<\/h[1-6]>/gi, '**\n\n') .replace(/

  • /gi, '• ') .replace(/<\/li>/gi, '\n') .replace(/