@willbooster/tree-sitter-html 9.0.0 → 10.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 +12 -7
- package/grammar.js +15 -15
- package/package.json +1 -1
- package/queries/highlights.scm +4 -1
- package/src/node-types.json +51 -17
- package/tree-sitter-html.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -54,12 +54,17 @@ runs. Custom tag names are retained in full when they fit the remaining buffer.
|
|
|
54
54
|
omitted along with older tags. Lost tag identities can still produce recovery errors when those tags close.
|
|
55
55
|
Malformed input after a void element can replace its enclosing element with an `ERROR` node during recovery.
|
|
56
56
|
|
|
57
|
-
Attribute values
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
Attribute values use distinct `unquoted_attribute_value`, `singlequoted_attribute_value`, and
|
|
58
|
+
`doublequoted_attribute_value` nodes directly inside `attribute`. Quoted nodes include both delimiters and retain an
|
|
59
|
+
`attribute_value` child for nonempty content; empty quoted values have no content child. Unquoted nodes cover the value
|
|
60
|
+
without surrounding whitespace. Recognized named and numeric character references are `entity` children of the content
|
|
61
|
+
node. Other content, including literal ampersands, has no child nodes. Injections that need quote-free value content can
|
|
62
|
+
capture `attribute_value` and `unquoted_attribute_value`; set `injection.include-children` when they need the original
|
|
63
|
+
reference spellings as well. The highlight query captures those same content nodes, excluding quote delimiters.
|
|
64
|
+
Legacy names without a semicolon remain literal before an ASCII letter, digit, or `=`; unknown names and incomplete
|
|
65
|
+
numeric prefixes remain literal. Comments are document or element content and are not accepted between attributes.
|
|
66
|
+
Comment-shaped text inside a quoted value remains part of that value. Whitespace after `=` separates the operator from
|
|
67
|
+
the value, so `noval= bool` remains one attribute with the unquoted value `bool`.
|
|
63
68
|
|
|
64
69
|
## Usage
|
|
65
70
|
|
|
@@ -113,7 +118,7 @@ fuzzed with:
|
|
|
113
118
|
```toml
|
|
114
119
|
[dependencies]
|
|
115
120
|
tree-sitter = { package = "willbooster-tree-sitter", version = "13.0.0" }
|
|
116
|
-
tree-sitter-html = { package = "willbooster-tree-sitter-html", version = "
|
|
121
|
+
tree-sitter-html = { package = "willbooster-tree-sitter-html", version = "10" }
|
|
117
122
|
```
|
|
118
123
|
|
|
119
124
|
```rust
|
package/grammar.js
CHANGED
|
@@ -141,15 +141,16 @@ module.exports = grammar({
|
|
|
141
141
|
optional(seq(
|
|
142
142
|
'=',
|
|
143
143
|
choice(
|
|
144
|
-
$.
|
|
145
|
-
$.
|
|
144
|
+
$.unquoted_attribute_value,
|
|
145
|
+
$.singlequoted_attribute_value,
|
|
146
|
+
$.doublequoted_attribute_value,
|
|
146
147
|
),
|
|
147
148
|
)),
|
|
148
149
|
),
|
|
149
150
|
|
|
150
151
|
attribute_name: _ => /[^<>"'/=\s]+/,
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
unquoted_attribute_value: $ => seq(
|
|
153
154
|
choice(
|
|
154
155
|
alias($._unquoted_attribute_entity, $.entity),
|
|
155
156
|
/[^<>"'=\s&]+/,
|
|
@@ -164,18 +165,17 @@ module.exports = grammar({
|
|
|
164
165
|
|
|
165
166
|
entity: _ => token(/&(#([xX][0-9a-fA-F]+|[0-9]+)|[A-Za-z][A-Za-z0-9]*);?/),
|
|
166
167
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
),
|
|
168
|
+
singlequoted_attribute_value: $ => seq('\'', optional(alias(repeat1(choice(
|
|
169
|
+
alias($._attribute_entity, $.entity),
|
|
170
|
+
token.immediate(/[^'&]+/),
|
|
171
|
+
$._attribute_ampersand,
|
|
172
|
+
)), $.attribute_value)), '\''),
|
|
173
|
+
|
|
174
|
+
doublequoted_attribute_value: $ => seq('"', optional(alias(repeat1(choice(
|
|
175
|
+
alias($._attribute_entity, $.entity),
|
|
176
|
+
token.immediate(/[^"&]+/),
|
|
177
|
+
$._attribute_ampersand,
|
|
178
|
+
)), $.attribute_value)), '"'),
|
|
179
179
|
|
|
180
180
|
text: _ => token(prec(1, /[^<&]+/)),
|
|
181
181
|
},
|
package/package.json
CHANGED
package/queries/highlights.scm
CHANGED
package/src/node-types.json
CHANGED
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
"named": true
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"type": "
|
|
15
|
+
"type": "doublequoted_attribute_value",
|
|
16
|
+
"named": true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"type": "singlequoted_attribute_value",
|
|
16
20
|
"named": true
|
|
17
21
|
},
|
|
18
22
|
{
|
|
19
|
-
"type": "
|
|
23
|
+
"type": "unquoted_attribute_value",
|
|
20
24
|
"named": true
|
|
21
25
|
}
|
|
22
26
|
]
|
|
@@ -109,6 +113,21 @@
|
|
|
109
113
|
]
|
|
110
114
|
}
|
|
111
115
|
},
|
|
116
|
+
{
|
|
117
|
+
"type": "doublequoted_attribute_value",
|
|
118
|
+
"named": true,
|
|
119
|
+
"fields": {},
|
|
120
|
+
"children": {
|
|
121
|
+
"multiple": false,
|
|
122
|
+
"required": false,
|
|
123
|
+
"types": [
|
|
124
|
+
{
|
|
125
|
+
"type": "attribute_value",
|
|
126
|
+
"named": true
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
112
131
|
{
|
|
113
132
|
"type": "element",
|
|
114
133
|
"named": true,
|
|
@@ -202,21 +221,6 @@
|
|
|
202
221
|
]
|
|
203
222
|
}
|
|
204
223
|
},
|
|
205
|
-
{
|
|
206
|
-
"type": "quoted_attribute_value",
|
|
207
|
-
"named": true,
|
|
208
|
-
"fields": {},
|
|
209
|
-
"children": {
|
|
210
|
-
"multiple": false,
|
|
211
|
-
"required": false,
|
|
212
|
-
"types": [
|
|
213
|
-
{
|
|
214
|
-
"type": "attribute_value",
|
|
215
|
-
"named": true
|
|
216
|
-
}
|
|
217
|
-
]
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
224
|
{
|
|
221
225
|
"type": "script_element",
|
|
222
226
|
"named": true,
|
|
@@ -259,6 +263,21 @@
|
|
|
259
263
|
]
|
|
260
264
|
}
|
|
261
265
|
},
|
|
266
|
+
{
|
|
267
|
+
"type": "singlequoted_attribute_value",
|
|
268
|
+
"named": true,
|
|
269
|
+
"fields": {},
|
|
270
|
+
"children": {
|
|
271
|
+
"multiple": false,
|
|
272
|
+
"required": false,
|
|
273
|
+
"types": [
|
|
274
|
+
{
|
|
275
|
+
"type": "attribute_value",
|
|
276
|
+
"named": true
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
},
|
|
262
281
|
{
|
|
263
282
|
"type": "start_tag",
|
|
264
283
|
"named": true,
|
|
@@ -301,6 +320,21 @@
|
|
|
301
320
|
]
|
|
302
321
|
}
|
|
303
322
|
},
|
|
323
|
+
{
|
|
324
|
+
"type": "unquoted_attribute_value",
|
|
325
|
+
"named": true,
|
|
326
|
+
"fields": {},
|
|
327
|
+
"children": {
|
|
328
|
+
"multiple": true,
|
|
329
|
+
"required": false,
|
|
330
|
+
"types": [
|
|
331
|
+
{
|
|
332
|
+
"type": "entity",
|
|
333
|
+
"named": true
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
},
|
|
304
338
|
{
|
|
305
339
|
"type": "void_element",
|
|
306
340
|
"named": true,
|
package/tree-sitter-html.wasm
CHANGED
|
Binary file
|