# `sanitizer/sanitizer.ts` _(no submodules)_ ## Purpose Sanitizer hooks applied to inbound `text/html` clipboard payloads. The package ships an identity sanitizer (pass-through) plus a regex-based tag-allowlist sanitizer for stripping known-dangerous tags from untrusted clipboard HTML. Both adhere to the `ClipboardSanitizer` shape `(html: string) => string` so consumers can plug in DOMPurify, sanitize-html, or any other library without changing call sites. The package deliberately does not bundle a security-grade sanitizer to avoid pinning consumers to a specific implementation — `createTagAllowlistSanitizer` is suitable for hardening trusted-origin clipboard flows and is NOT a substitute for DOMPurify in security-critical paths. ## Features - `identitySanitizer` — pass-through, used when no sanitizer is supplied. - `createTagAllowlistSanitizer(tags)` — regex-based stripper that drops any tag not in the supplied allowlist while preserving allowed tags with their attributes intact. - Case-insensitive tag matching. ## Usage: Basic ```ts import { ClipboardManager, createTagAllowlistSanitizer, } from "@suaveplan/clipboard"; const sanitize = createTagAllowlistSanitizer(["p", "b", "i", "br"]); const clipboard = new ClipboardManager({ sanitizer: sanitize }); const result = await clipboard.readRichContent(); // result.data.html no longer contains