servo / html5ever

High-performance browser-grade HTML5 parser
Other
2.16k stars 222 forks source link

`RcDom` issues in `html2html` example #555

Open atjn opened 2 months ago

atjn commented 2 months ago

I am trying to figure out how to use this parser, and as far as I can tell, the only "getting started" documentation you provide is the html2html example.

html2html uses the markup5ever_rcdom package, which you have decided to make "unofficial" because it is unsafe and incorrect. This means two things:

  1. The html2html example doesn't build by default and provides the message "the trait TreeSink is not implemented for RcDom". It took me quite a lot of hair pulling to figure out that you must pin the markup5ever_rcdom to version 0.5.0-unofficial to fix that problem.

  2. If the only documentation you have for using this crate is a bad implementation, how am I supposed to use it? If you had some documentation on how I could write my own RcDom that would go a long way, but I don't see any.

jdm commented 2 months ago

Mmm, point 1 is definitely a problem! I'll see if I can fix that.

nicoburns commented 1 month ago

@atjn Not a substitute for proper documention, but we have an implementation here (https://github.com/DioxusLabs/blitz/blob/main/packages/blitz-dom/src/htmlsink.rs) which you could use as a second reference. Although our implementation has been less reliable (sometimes panics) since the latest HTML5ever version switched to using interior mutability, and I haven't had chance to track down why yet.