virchau13 / tree-sitter-astro

Tree-sitter grammar for the Astro web framework
MIT License
98 stars 9 forks source link

Error when using a self closing script tag #27

Closed Akeboshiwind closed 7 months ago

Akeboshiwind commented 7 months ago

With the following document:

---
---
<script />
<div>this isn't highlighted</div>

I get the following in the playground:

frontmatter [0, 0] - [1, 3]
  frontmatter_js_block [0, 3] - [0, 3]
ERROR [2, 0] - [3, 33]
  tag_name [2, 1] - [2, 7]
  attribute_js_expr [2, 10] - [3, 13]
  attribute_js_expr [3, 14] - [3, 33]

And it looks like this:

Screenshot 2024-04-23 at 11 42 00
Akeboshiwind commented 7 months ago

Oddly seems to only happen with the script tag 🤔

virchau13 commented 7 months ago

Oh, self-closing script tags aren't allowed in HTML5. (Are they allowed in Astro?)

virchau13 commented 7 months ago

Looks like self-closing script tags are allowed in Astro. I should probably fix this.