import type { SupportedLocale } from "$lib/const/locales"; import { format, type Locale } from "date-fns"; import { de, enUS } from "date-fns/locale"; // is not exported from svelte export type RenderOutput = { head: string; body: string; }; export const renderOutputToHtml = (renderOutput: RenderOutput) => { return `
${renderOutput.head} ${renderOutput.body} `; }; export const htmlToText = (html: string) => { let text = html; // Replace anchor tags with "Link Text: URL" format const newLinePlaceholder = "{new-line}"; text = text.replace(/]*?\s+)?href="([^"]*)"[^>]*>(.*?)<\/a>/gi, `$2: $1