From dee3a4d44ddb1999e7dec383889246e87f202d92 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 6 Jul 2025 21:50:23 +0000 Subject: feat: Store large html content in the asset db --- packages/shared/utils/htmlUtils.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 packages/shared/utils/htmlUtils.ts (limited to 'packages/shared/utils') diff --git a/packages/shared/utils/htmlUtils.ts b/packages/shared/utils/htmlUtils.ts new file mode 100644 index 00000000..60272899 --- /dev/null +++ b/packages/shared/utils/htmlUtils.ts @@ -0,0 +1,17 @@ +import { compile } from "html-to-text"; + +const compiledConvert = compile({ + selectors: [{ selector: "img", format: "skip" }], +}); + +/** + * Converts HTML content to plain text + */ +export function htmlToPlainText(htmlContent: string): string { + if (!htmlContent) { + return ""; + } + + // TODO, we probably should also remove singlefile inline images from the content + return compiledConvert(htmlContent); +} -- cgit v1.2.3-70-g09d2