1 unstable release

0.20.0 Dec 7, 2023

#498 in Text editors

Download history 128/week @ 2024-07-18 139/week @ 2024-07-25 133/week @ 2024-08-01 126/week @ 2024-08-08 125/week @ 2024-08-15 126/week @ 2024-08-22 128/week @ 2024-08-29 124/week @ 2024-09-05 137/week @ 2024-09-12 139/week @ 2024-09-19 141/week @ 2024-09-26 141/week @ 2024-10-03 124/week @ 2024-10-10 33/week @ 2024-10-17

179 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.8–4MB
~76K SLoC