@willbooster/tree-sitter-html 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,9 +19,14 @@ number, so it loads only with the WillBooster runtime, version 2.0.0 or later
19
19
  [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter)); upstream's runtime rejects
20
20
  it. Input that contains NUL characters can parse to a different tree than with upstream's 0.23.2 parser, because the
21
21
  lexers that generator emits treat a NUL character as an ordinary character. This grammar also accepts literal `>`
22
- characters in text nodes, which upstream 0.23.2 rejects. Its scanner requires an HTML tag-name boundary after
22
+ characters and bare `&` in text nodes, which upstream 0.23.2 rejects. A bare `&` becomes its own `text` node beside
23
+ surrounding text, while character references remain `entity` nodes. Its scanner requires an HTML tag-name boundary after
23
24
  `</script` and `</style`, so longer names and overlapping prefixes remain raw text. Closing-name comparisons
24
- fold only ASCII letters, and embedded NUL characters remain part of raw-text content. Void elements close
25
+ fold only ASCII letters, and embedded NUL characters remain part of raw-text content. Script content follows
26
+ HTML escaped and double-escaped states, so closing-tag text inside a double escape remains raw text. A script that reaches
27
+ EOF while scanning raw content closes implicitly without an error: its `script_element` has no `end_tag` child, and its
28
+ remaining content stays available for JavaScript injection. Incomplete closing tags such as `</script` still report
29
+ recovery errors. Unterminated style elements still report an error. Void elements close
25
30
  before following text, entities, and complete comments, which become siblings instead of children.
26
31
  Scanner serialization stores the open-tag stack from its innermost tag, compressing runs of identical tags, so active
27
32
  void, script, and style elements retain their identities when deeply nested. When deep nesting of distinct tags
package/grammar.js CHANGED
@@ -62,7 +62,7 @@ module.exports = grammar({
62
62
  script_element: $ => seq(
63
63
  alias($.script_start_tag, $.start_tag),
64
64
  optional($.raw_text),
65
- $.end_tag,
65
+ choice($.end_tag, $._implicit_end_tag),
66
66
  ),
67
67
 
68
68
  style_element: $ => seq(
@@ -134,6 +134,6 @@ module.exports = grammar({
134
134
  seq('"', optional(alias(/[^"]+/, $.attribute_value)), '"'),
135
135
  ),
136
136
 
137
- text: _ => /[^<&\s]([^<&]*[^<&\s])?/,
137
+ text: _ => /[^<&\s]([^<&]*[^<&\s])?|&/,
138
138
  },
139
139
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-html",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "HTML grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -18,7 +18,7 @@
18
18
  }
19
19
  ],
20
20
  "metadata": {
21
- "version": "1.0.4",
21
+ "version": "1.0.6",
22
22
  "license": "MIT",
23
23
  "description": "HTML grammar for tree-sitter",
24
24
  "authors": [