html5ever
html5ever copied to clipboard
docs/example of searching and modifying the dom
I would be great to have an example or more explicit docs that shows how to search and modify the dom - or did I just not find that?
html5ever is really a parser (and serializer) that supports any data structure that implements the TreeSink trait. The rcdom module exists more to support html5ever’s own tests than for serious tree manipulation.
https://crates.io/crates/kuchiki is a proof-of-concept for providing more convenience APIs and plumbing a tree together with the parser and with CSS selector matching. But it also could use a lot more documentation, and I’m not actively working on it.
@SimonSapin Thanks for the quick reply. That sounds like bad news though. Bummer. Writing a complete DOM first seems a bit out of scope.
I guess I need to find another way for parse -> dom -> manipulate -> serialize then.
To be clear I think Kuchiki (which uses html5ever) is what you want, though the documentation is not great.
Thanks, will give it a try.
When you say "not actively working on it" does that mean "in maintenance mode" or "noone looks after it"?
Depends what you mean by “look after” exactly. I try to respond to issues and PRs but I make no promise about time.
...bug fixes, merging PRs, releases - that sort of thing.