Unnamed repository; edit this file 'description' to name the repository.
Highlight HTML entities (#13753)
uncenter 8 months ago
parent 205e7ec · commit ada8004
-rw-r--r--languages.toml2
-rw-r--r--runtime/queries/astro/highlights.scm47
-rw-r--r--runtime/queries/html/highlights.scm1
3 files changed, 48 insertions, 2 deletions
diff --git a/languages.toml b/languages.toml
index df84837d..50f02e19 100644
--- a/languages.toml
+++ b/languages.toml
@@ -937,7 +937,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "html"
-source = { git = "https://github.com/tree-sitter/tree-sitter-html", rev = "29f53d8f4f2335e61bf6418ab8958dac3282077a" }
+source = { git = "https://github.com/tree-sitter/tree-sitter-html", rev = "cbb91a0ff3621245e890d1c50cc811bffb77a26b" }
[[language]]
name = "python"
diff --git a/runtime/queries/astro/highlights.scm b/runtime/queries/astro/highlights.scm
index 3d0792b8..780ed330 100644
--- a/runtime/queries/astro/highlights.scm
+++ b/runtime/queries/astro/highlights.scm
@@ -1,3 +1,48 @@
-; inherits: html
+(tag_name) @tag
+(erroneous_end_tag_name) @error
+(doctype) @constant
+(attribute_name) @attribute
+(comment) @comment
+
+((attribute
+ (attribute_name) @attribute
+ (quoted_attribute_value (attribute_value) @markup.link.url))
+ (#any-of? @attribute "href" "src"))
+
+((element
+ (start_tag
+ (tag_name) @tag)
+ (text) @markup.link.label)
+ (#eq? @tag "a"))
+
+(attribute [(attribute_value) (quoted_attribute_value)] @string)
+
+((element
+ (start_tag
+ (tag_name) @tag)
+ (text) @markup.bold)
+ (#any-of? @tag "strong" "b"))
+
+((element
+ (start_tag
+ (tag_name) @tag)
+ (text) @markup.italic)
+ (#any-of? @tag "em" "i"))
+
+((element
+ (start_tag
+ (tag_name) @tag)
+ (text) @markup.strikethrough)
+ (#any-of? @tag "s" "del"))
+
+[
+ "<"
+ ">"
+ "</"
+ "/>"
+ "<!"
+] @punctuation.bracket
+
+"=" @punctuation.delimiter
["---"] @punctuation.delimiter
diff --git a/runtime/queries/html/highlights.scm b/runtime/queries/html/highlights.scm
index 0ade1d4b..9227bfca 100644
--- a/runtime/queries/html/highlights.scm
+++ b/runtime/queries/html/highlights.scm
@@ -2,6 +2,7 @@
(erroneous_end_tag_name) @error
(doctype) @constant
(attribute_name) @attribute
+(entity) @string.special.symbol
(comment) @comment
((attribute