Sanitize HTML icon

Sanitize HTML

Sanitize HTML content based on specified rules

Sanitize HTML

AI-generated

Summary

Sanitize HTML content by removing disallowed tags and attributes according to customizable rules.

Inputs

  • html (required) — The HTML string content to sanitize.
  • allowedAttributes — Specify additional or overridden allowed HTML attributes per tag, as a collection of tags and their permitted attributes.
  • allowedTags — Adjust which HTML tags are allowed by adding to, removing from, or exclusively specifying tags in the whitelist.

Output shape

a list of items where each item contains a JSON object with a single 'html' field holding the sanitized HTML string.

Processes all input items independently, returning sanitized HTML for each input item. The sanitization uses a default set of allowed tags and attributes that can be customized via 'allowedTags' and 'allowedAttributes' parameters. If 'only' is specified in 'allowedTags', it overrides add/remove and defaults.

Links

Discussion