import DOMPurify from "isomorphic-dompurify"; export function sanitizeHtml(html) { if (!html || typeof html !== "string") return ""; return DOMPurify.sanitize(html, { ALLOWED_TAGS: [ "p", "br", "strong", "em", "b", "i", "u", "ul", "ol", "li", "a", "h2", "h3", "h4", "h5", "blockquote", "img", "span", "div", "table", "thead", "tbody", "tr", "td", "th", ], ALLOWED_ATTR: ["href", "target", "rel", "src", "alt", "title"], ALLOW_DATA_ATTR: false, }); } // خروجی امن برای