You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to take an HTML snippet and remove everything that isn't plain text. This includes things like the contents of <script> and <style> tags. Essentially:
assert_eq!(ammonia::clean(r"<script type='text/javascript'>XSS</script>Some <em>text</em> here!<style>a { font-size: 14px; }</style>"),"Some text here!");
I'm willing to make a PR for this, but I don't know how the API should look. Builder::remove_content_tags()?
The text was updated successfully, but these errors were encountered:
90: Add clean_content_tags() r=notriddle a=mattico
Here's a basic implementation. I'm not completely sure how it should interact with the whitelist:
1. If a tag is in the blacklist that takes precedence, and the whitelist is ignored for that tag. (currently implemented)
2. If a tag is in both blacklist and whitelist then panic. (annoying to use with default options but explicit)
3. When a tag is added to the blacklist, it's automatically removed from the whitelist. (adds complexity and doesn't work well with `rm_clean_content_tags`, but is consistent)
Also I think defaulting to `clean_content_tags(["script", "style"])` is a good idea, but I know defaults are hard to change.
Closes#89
I'd like to be able to take an HTML snippet and remove everything that isn't plain text. This includes things like the contents of
<script>
and<style>
tags. Essentially:I'm willing to make a PR for this, but I don't know how the API should look.
Builder::remove_content_tags()
?The text was updated successfully, but these errors were encountered: