pub fn clean(src: &str) -> String
Expand description
Clean HTML with a conservative set of defaults.
- tags
script
andstyle
have their contents stripped- attributes on specific tags
- attributes on all tags
- url schemes
- relative URLs are passed through, unchanged, by default
- links are marked
noopener noreferrer
by default - all
class=""
settings are blocked by default - comments are stripped by default
- no generic attribute prefixes are turned on by default
- no specific tag-attribute-value settings are configured by default
§Examples
assert_eq!(ammonia::clean("XSS<script>attack</script>"), "XSS")