Examples
Arguments
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.
Remove attributes longer than max_attribute_length. Defaults to True.
Maximum length for attributes before removal. Defaults to 500.
List of attribute names to always preserve. Defaults to [“class”, “src”].
Remove empty tags (except preserved ones). Defaults to True.
List of tag names to preserve even when empty. Defaults to [“img”].
Remove extra whitespace between tags and empty lines. Defaults to True.