html: Improve syntax highlighting (#28184)
chbk
created
| Zed 0.180.2 | With this PR |
| --- | --- |
|

|

|
```html
<script>
return <div class="main content"></div>
</script>
<div class="main content"></div>
<span></spn>
```
Changes homogenize JSX and HTML
- `"`: `string`
- `=`: `operator` -> `punctuation.delimiter` like in
[JSX](https://github.com/zed-industries/zed/blob/3775496b84cfc9ebf27376119742f3484d4997f2/crates/languages/src/javascript/highlights.scm#L246),
[VSCode](https://github.com/microsoft/vscode/blob/336801752dd09afa76f5429fba846e533bcdb7d9/extensions/html/syntaxes/html.tmLanguage.json#L382)
- `erroneous_end_tag_name`: `keyword` -> not a keyword
Release Notes:
- Improved HTML highlighting
Change summary
extensions/html/languages/html/highlights.scm | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Detailed changes
@@ -1,11 +1,14 @@
(tag_name) @tag
-(erroneous_end_tag_name) @keyword
(doctype) @tag.doctype
(attribute_name) @attribute
-(attribute_value) @string
+[
+ "\""
+ "'"
+ (attribute_value)
+] @string
(comment) @comment
-"=" @operator
+"=" @punctuation.delimiter.html
[
"<"
@@ -13,4 +16,4 @@
"<!"
"</"
"/>"
-] @punctuation.bracket
+] @punctuation.bracket.html