![crate-badge]
![downloads-badge]
![check-badge]
Pure and simple HTML parser and editor.
rust
let document: Vec<Node> = parse("<!doctype html><html><head></head><body></body></html>")?;
println!("{:#?}", document);
Output:
rust
[
Doctype(
Html,
),
Element {
name: "html",
attrs: {},
children: [
Element {
name: "head",
attrs: {},
children: [],
},
Element {
name: "body",
attrs: {},
children: [],
},
],
},
]
You can also use try_parse
to parse the html which contains tolerable errors
rust
let document: Vec<Node> = try_parse("<div><span>Ipsum</div>");
```rust
// let html = r#"..."#
let nodes: Vec
let element: Option
rust
// let html = r#"..."#
let a: String = parse(html)?.trim().html();
let b: String = parse(html)?.insert_to(&selector, node).html();
let c: String = parse(html)?.remove_by(&selector).html();
You can find more examples in the documentation.
See in CHANGELOG.md