tree-sitter-htmlx-html 0.1.0

Tree-sitter grammar for HTML following the WHATWG HTML Living Standard
docs.rs failed to build tree-sitter-htmlx-html-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: tree-sitter-htmlx-html-0.1.13

Tree-sitter grammar for HTML following the WHATWG HTML Living Standard

This grammar provides spec-compliant HTML parsing including:

  • Void elements (§13.1.2): area, base, br, col, embed, hr, img, input, link, meta, source, track, wbr
  • Raw text elements (§13.1.2.1): script, style
  • Escapable raw text elements (§13.1.2.2): textarea, title
  • Optional end tags (§13.1.2.4): Proper implicit closing
  • Character references (§13.5): Named, decimal, and hex entities

Example

use tree_sitter_html::LANGUAGE;

let mut parser = tree_sitter::Parser::new();
parser.set_language(&LANGUAGE.into()).expect("Failed to load HTML grammar");

let source = r#"<!DOCTYPE html>
<html>
<head>
  <title>Hello World</title>
</head>
<body>
  <p>Welcome to <strong>HTML</strong>!</p>
  <img src="logo.png" alt="Logo">
</body>
</html>"#;

let tree = parser.parse(source, None).unwrap();
assert!(!tree.root_node().has_error());