The HTML content to sanitize
Remove all <script> elements. Defaults to true.
Remove all <style> elements. Defaults to true.
Remove all <svg> elements. Defaults to true.
Remove HTML comments. Defaults to true.
options.removeLongAttributes
Remove attributes longer than maxAttributeLength. Defaults to true.
options.maxAttributeLength
Maximum length for attributes before removal. Defaults to 500.
options.preserveAttributes
List of attribute names to always preserve. Defaults to [“class”, “src”].
Remove empty tags (except preserved ones). Defaults to true.
options.preserveEmptyTags
List of tag names to preserve even when empty. Defaults to [“img”].
Remove extra whitespace between tags and empty lines. Defaults to true.