2 unstable releases

0.20.0 Jan 30, 2024
0.19.0 Dec 21, 2021

#42 in Text editors

Download history 896/week @ 2023-11-23 1018/week @ 2023-11-30 1209/week @ 2023-12-07 1089/week @ 2023-12-14 742/week @ 2023-12-21 703/week @ 2023-12-28 681/week @ 2024-01-04 701/week @ 2024-01-11 1089/week @ 2024-01-18 2926/week @ 2024-01-25 1624/week @ 2024-02-01 1714/week @ 2024-02-08 2050/week @ 2024-02-15 2798/week @ 2024-02-22 2307/week @ 2024-02-29 1346/week @ 2024-03-07

8,796 downloads per month
Used in 9 crates (8 directly)

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