nh3
nh3 copied to clipboard
More ammonia builder options
There are some ammonia builder options it would be really nice to have:
- add_tag (Add additonal whitelisted tags without overwriting old ones.)
- filter_style_properties (Only allows the specified properties in
styleattributes.)
First off, thank you for this most useful library!
I agree with @gsmedley that some of the new ammonia options would come in quite handy, especially filter_style_properties (https://github.com/rust-ammonia/ammonia/pull/208)
The current API does not scale well with more ammonia options, we should refactor it first.
Do you already have a vision for a new API?
we could have a Builder that builds a Cleaner, something like:
cleaner = Builder()
.tags({"a", "div"})
.url_schemes({"http://", "https://"})
.build()
cleaner.clean(html)
Ah so more something closer to upstream ammonia's behaviour?