Skip to content

Commit

Permalink
feat: support omitted html, head, and body end tags
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Feb 21, 2024
1 parent 5760f52 commit 80a1afb
Show file tree
Hide file tree
Showing 6 changed files with 725 additions and 573 deletions.
11 changes: 10 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ module.exports = grammar({
$._implicit_end_tag,
$.raw_text,
$.comment,
$._omitted_html_end_tag,
$._omitted_head_end_tag,
$._omitted_body_end_tag,
],

rules: {
Expand Down Expand Up @@ -56,7 +59,13 @@ module.exports = grammar({
seq(
$.start_tag,
repeat($._node),
choice($.end_tag, $._implicit_end_tag),
choice(
$.end_tag,
$._implicit_end_tag,
$._omitted_html_end_tag,
$._omitted_head_end_tag,
$._omitted_body_end_tag,
),
),
$.self_closing_tag,
),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"tree-sitter": [
{
"scope": "text.html.basic",
"scope": "source.html",
"file-types": [
"html"
],
Expand Down
24 changes: 24 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@
{
"type": "SYMBOL",
"name": "_implicit_end_tag"
},
{
"type": "SYMBOL",
"name": "_omitted_html_end_tag"
},
{
"type": "SYMBOL",
"name": "_omitted_head_end_tag"
},
{
"type": "SYMBOL",
"name": "_omitted_body_end_tag"
}
]
}
Expand Down Expand Up @@ -493,6 +505,18 @@
{
"type": "SYMBOL",
"name": "comment"
},
{
"type": "SYMBOL",
"name": "_omitted_html_end_tag"
},
{
"type": "SYMBOL",
"name": "_omitted_head_end_tag"
},
{
"type": "SYMBOL",
"name": "_omitted_body_end_tag"
}
],
"inline": [],
Expand Down
Loading

0 comments on commit 80a1afb

Please sign in to comment.