aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared/utils
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-07-06 21:50:23 +0000
committerMohamed Bassem <me@mbassem.com>2025-07-06 22:04:56 +0000
commitdee3a4d44ddb1999e7dec383889246e87f202d92 (patch)
tree1984234f17eed886bc834543e1505ddbfb43228f /packages/shared/utils
parent362be3008aa8b036c4c448a86e459044af8784c2 (diff)
downloadkarakeep-dee3a4d44ddb1999e7dec383889246e87f202d92.tar.zst
feat: Store large html content in the asset db
Diffstat (limited to 'packages/shared/utils')
-rw-r--r--packages/shared/utils/htmlUtils.ts17
1 files changed, 17 insertions, 0 deletions
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);
+}