1 unstable release

0.20.0 Dec 7, 2023

#161 in Text editors

Download history 126/week @ 2023-12-18 480/week @ 2023-12-25 567/week @ 2024-01-01 614/week @ 2024-01-08 471/week @ 2024-01-15 394/week @ 2024-01-22 788/week @ 2024-01-29 540/week @ 2024-02-05 623/week @ 2024-02-12 792/week @ 2024-02-19 514/week @ 2024-02-26 487/week @ 2024-03-04 568/week @ 2024-03-11 546/week @ 2024-03-18 550/week @ 2024-03-25 290/week @ 2024-04-01

2,021 downloads per month

MIT license

90KB
3K SLoC

C 2.5K SLoC // 0.0% comments JavaScript 114 SLoC // 0.1% comments Rust 36 SLoC // 0.1% comments Scheme 18 SLoC

tree-sitter-html

This crate provides a HTML grammar for the tree-sitter parsing library. To use this crate, add it to the [dependencies] section of your Cargo.toml file. (Note that you will probably also need to depend on the tree-sitter crate to use the parsed result in any useful way.)

[dependencies]
tree-sitter = "0.20.10"
tree-sitter-html = "0.20.0"

Typically, you will use the language function to add this grammar to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
    def double(x):
        return x * 2
"#;
let mut parser = Parser::new();
parser.set_language(tree_sitter_html::language()).expect("Error loading HTML grammar");
let parsed = parser.parse(code, None);

If you have any questions, please reach out to us in the tree-sitter discussions page.

Dependencies

~2.7–4MB
~71K SLoC