Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make an interface to filter whole tags (nodes) #164

Open
skelewir opened this issue Jul 28, 2022 · 1 comment
Open

Make an interface to filter whole tags (nodes) #164

skelewir opened this issue Jul 28, 2022 · 1 comment

Comments

@skelewir
Copy link

It would be great to have some interface similar to attribute_filter but which works on the whole node.
Or better yet - expose the whole parsed dom so it could be post-analyzed and modified as desired.
An example use case: we want to censor some specific domain in links and replace the occurrences with "[censored]".
With current interfaces it's impossible. Our only solution is to parse the cleaned up html again and apply our filters.

@xmo-odoo
Copy link
Contributor

With current interfaces it's impossible. Our only solution is to parse the cleaned up html again and apply our filters.

FWIW Ammonia does have a to_dom_node method on Document which allows post-processing, but it requires setting a cfg flag to expose the method and the underlying types it exposes: https://github.com/rust-ammonia/ammonia/blob/master/src/lib.rs#L2784-L2842

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants