Files
karakeep-mirror/packages/shared/utils/htmlUtils.ts
2025-07-06 22:04:56 +00:00

18 lines
409 B
TypeScript

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);
}