Skip to content

sanitizeHtml

Sanitizes HTML using the default allowlist merged with custom DOMPurify config.

Default DOMPurify settings are exposed on sanitizeHtml.defaults and can be overridden per call via config.

Example:

ts
sanitizeHtml('<img src=x onerror=alert(1) />');

Released under the MIT License.