@willbooster/tree-sitter-html 7.0.1 → 8.0.0
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 +10 -6
- package/grammar.js +3 -0
- package/package.json +4 -4
- package/tree-sitter-html.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-html/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-html/actions/workflows/test-rust.yml)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
9
9
|
[](https://crates.io/crates/willbooster-tree-sitter-html)
|
|
10
10
|
|
|
11
11
|
HTML grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
@@ -14,7 +14,7 @@ to its authors and contributors. This is not an official release of that project
|
|
|
14
14
|
|
|
15
15
|
This fork is based on upstream's version 0.23.2 grammar and external scanner and generates the parser with the
|
|
16
16
|
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI
|
|
17
|
-
number `
|
|
17
|
+
number `0x57420009`, so it loads with the WillBooster runtime, version 13.0.0 or later in the 13.x series
|
|
18
18
|
([willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter),
|
|
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
|
|
@@ -29,7 +29,11 @@ and instructions stay `text`, while character references remain `entity` nodes.
|
|
|
29
29
|
`noembed`, and `noframes` also stays `text` up to the element's own closing tag. `plaintext` retains all remaining
|
|
30
30
|
input as `text`, including closing tags. The grammar's scanner requires an HTML tag-name boundary after
|
|
31
31
|
`</script` and `</style`, so longer names and overlapping prefixes remain raw text. Closing-name comparisons
|
|
32
|
-
fold only ASCII letters, and embedded NUL characters remain part of raw-text content.
|
|
32
|
+
fold only ASCII letters, and embedded NUL characters remain part of raw-text content. Tag names start with an ASCII
|
|
33
|
+
letter and retain subsequent characters, including Unicode, until HTML whitespace, `/`, `>`, NUL or end of input.
|
|
34
|
+
Name recognition is independent of platform locale and custom-element registration. NUL retains the existing
|
|
35
|
+
name boundary instead of the HTML tokenizer's replacement-character behavior.
|
|
36
|
+
In the HTML namespace, a trailing
|
|
33
37
|
slash on a `script` or `style` opening tag remains part of its `start_tag`; it does not close the element, so subsequent
|
|
34
38
|
content remains raw text until the matching end tag. Self-closing foreign-namespace `script` and `style` use ordinary element nodes. Complete foreign
|
|
35
39
|
elements retain raw-text nodes and injection ranges, including CDATA delimiters. MathML `annotation-xml` with an `encoding` value of `text/html` or `application/xhtml+xml`
|
|
@@ -56,7 +60,7 @@ between attributes. Comment-shaped text inside a quoted value remains part of th
|
|
|
56
60
|
## Usage
|
|
57
61
|
|
|
58
62
|
The npm package ships `tree-sitter-html.wasm` for
|
|
59
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
63
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 13.0.0 or later in the 13.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers.
|
|
60
64
|
In Node.js and Bun, load the grammar from its path:
|
|
61
65
|
|
|
62
66
|
```js
|
|
@@ -103,8 +107,8 @@ fuzzed with:
|
|
|
103
107
|
|
|
104
108
|
```toml
|
|
105
109
|
[dependencies]
|
|
106
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
107
|
-
tree-sitter-html = { package = "willbooster-tree-sitter-html", version = "
|
|
110
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "13.0.0" }
|
|
111
|
+
tree-sitter-html = { package = "willbooster-tree-sitter-html", version = "8" }
|
|
108
112
|
```
|
|
109
113
|
|
|
110
114
|
```rust
|
package/grammar.js
CHANGED
|
@@ -32,6 +32,8 @@ module.exports = grammar({
|
|
|
32
32
|
$._unquoted_attribute_entity,
|
|
33
33
|
$._attribute_ampersand,
|
|
34
34
|
$._unquoted_attribute_fragment,
|
|
35
|
+
$._discarded_start_tag,
|
|
36
|
+
$._missing_start_tag_end,
|
|
35
37
|
],
|
|
36
38
|
|
|
37
39
|
rules: {
|
|
@@ -52,6 +54,7 @@ module.exports = grammar({
|
|
|
52
54
|
$.doctype,
|
|
53
55
|
$.processing_instruction,
|
|
54
56
|
seq($._unfinished_processing_instruction, '>'),
|
|
57
|
+
seq('<', $._discarded_start_tag, alias($._missing_start_tag_end, '>')),
|
|
55
58
|
alias($._element_text, $.text),
|
|
56
59
|
$.comment,
|
|
57
60
|
$.entity,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-html",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "HTML grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
48
48
|
"@willbooster/oxlint-config": "1.4.8",
|
|
49
49
|
"@willbooster/wb": "22.26.2",
|
|
50
|
-
"@willbooster/web-tree-sitter": "
|
|
50
|
+
"@willbooster/web-tree-sitter": "13.0.0",
|
|
51
51
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
52
52
|
"lefthook": "2.2.2",
|
|
53
53
|
"oxfmt": "0.73.0",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"oxlint-tsgolint": "7.0.2004",
|
|
56
56
|
"playwright": "1.64.0",
|
|
57
57
|
"semantic-release": "25.0.9",
|
|
58
|
-
"sort-package-json": "4.
|
|
58
|
+
"sort-package-json": "4.1.0",
|
|
59
59
|
"vitest": "5.0.3",
|
|
60
60
|
"wrangler": "4.149.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@willbooster/web-tree-sitter": "^
|
|
63
|
+
"@willbooster/web-tree-sitter": "^13.0.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
66
66
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-html.wasm
CHANGED
|
Binary file
|