UNPKG

@anoki/fse-ui

Version:

FSE UI components library

22 lines (21 loc) 860 B
import { j as r } from "./index.es277.js"; import { sanitize as s } from "./index.es288.js"; import c from "./index.es289.js"; const z = (e, n = void 0) => { const t = s(e).replace( /^<([a-z][a-z0-9]*)([^>]*)>(.*)<\/\1>$/i, "$3" ); return /* @__PURE__ */ r.jsx(c, { dangerouslySetInnerHTML: { __html: t }, as: n }); }, l = /<(p|div|ul|ol|li|h[1-6]|table|thead|tbody|tfoot|tr|td|th|blockquote|section|article|aside|header|footer|figure|figcaption|pre|hr|address)\b/i, f = (e, n = "p") => { const o = s(e, { addAttributes: ["target"] }), t = o.replace( /^<([a-z][a-z0-9]*)([^>]*)>(.*)<\/\1>$/i, "$3" ), i = n === "div" || l.test(t), a = i ? "div" : "p", d = i ? o : t; return /* @__PURE__ */ r.jsx(a, { dangerouslySetInnerHTML: { __html: d } }); }; export { f as HTML, z as HTMLBalancer }; //# sourceMappingURL=index.es158.js.map