html5ever runs on stable Rust

… but without some optimizations. (Namely NonZero and unsafe_no_drop_flag.) You can enable those via the unstable cargo feature.

Using on stable Rust (release or beta):

# Cargo.toml

[dependencies]
html5ever = "0.2.1"

Using on unstable Rust (nightly or built from source) with optimizations:

# Cargo.toml

[dependencies]
html5ever = { version = "0.2.1", features = ["unstable"] }

Supporting both in your own code:

# Cargo.toml

[features]
unstable = ["html5ever/unstable"]

[dependencies]
html5ever = "0.2.1"

Happy HTML parsing!

By the way, also have a look at Kuchiki. It’s still in flux and not well documented, but it now also runs on stable (with its own unstable Cargo feature) and is starting to be useable.

3 Likes