Highlight HTML entities (#13753)

pull/13617/merge
uncenter 2025-06-16 09:03:02 -04:00 committed by GitHub
parent 205e7ece70
commit ada8004ea5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 48 additions and 2 deletions

View File

@ -937,7 +937,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]] [[grammar]]
name = "html" 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]] [[language]]
name = "python" name = "python"

View File

@ -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 ["---"] @punctuation.delimiter

View File

@ -2,6 +2,7 @@
(erroneous_end_tag_name) @error (erroneous_end_tag_name) @error
(doctype) @constant (doctype) @constant
(attribute_name) @attribute (attribute_name) @attribute
(entity) @string.special.symbol
(comment) @comment (comment) @comment
((attribute ((attribute