html_parser 0.7.0

A simple and general purpose html/xhtml parser
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use html_parser::{Dom, Result};
use insta::assert_json_snapshot;

#[test]
fn it_can_parse_document_with_just_one_comment() -> Result<()> {
    let html = "<!-- hello !\"#/()= -->";
    let ast = Dom::parse(html)?;
    assert_json_snapshot!(ast);
    Ok(())
}
#[test]
fn it_can_parse_document_with_just_comments() -> Result<()> {
    let html = "<!--x--><!--y--><!--z-->";
    let ast = Dom::parse(html)?;
    assert_json_snapshot!(ast);
    Ok(())
}