treesitter html highlighting/injections

This commit is contained in:
2022-12-17 12:19:57 -06:00
parent 46a513cc74
commit 4b30748f16
5 changed files with 95 additions and 4 deletions
+55
View File
@@ -0,0 +1,55 @@
; inherits: html
(attribute_name) @keyword
[
"<"
">"
"</"
"/>"
] @punctuation.bracket
(doctype) @comment
((tag_name) @type (#match? @type "^(head|body)$"))
((tag_name) @comment (#eq? @comment "html"))
(element
(start_tag
((tag_name) @function)
(attribute (attribute_name) @_alpine))
(#lua-match? @_alpine "^[@:]%l+.-$"))
(element
(start_tag
(attribute (attribute_name) @_alpine))
(end_tag ((tag_name) @function))
(#lua-match? @_alpine "^[@:]%l+.-$"))
(element
(start_tag
((tag_name) @function)
(attribute (attribute_name) @_alpine))
(#lua-match? @_alpine "^x[-]%l+$"))
(element
(start_tag
(attribute (attribute_name) @_alpine))
(end_tag ((tag_name) @function))
(#lua-match? @_alpine "^x[-]%l+$"))
(element
(self_closing_tag
((tag_name) @function)
(attribute (attribute_name) @_alpine))
(#lua-match? @_alpine "^[@:]%l+.-$"))
(element
(self_closing_tag
((tag_name) @function)
(attribute (attribute_name) @_alpine))
(#lua-match? @_alpine "^x[-]%l+$"))
(element (start_tag ((tag_name) @function) (#eq? @function "template")))
(element (end_tag ((tag_name) @function) (#eq? @function "template")))
+21
View File
@@ -0,0 +1,21 @@
((attribute
(attribute_name) @_alpine
(quoted_attribute_value (attribute_value) @javascript))
(#lua-match? @_alpine "^[@:]%l+.-$"))
((attribute
(attribute_name) @_alpine
(quoted_attribute_value (attribute_value) @javascript))
(#lua-match? @_alpine "^x[-]%l+$"))
(script_element
(raw_text) @javascript)
((text) @python (#lua-match? @python "^{%p%s+%l+%s+.-%s+%p}$"))
((text) @python (#lua-match? @python "^{{%s+.-%s+}}$"))
((attribute
(attribute_name) @_hyperscript
(quoted_attribute_value (attribute_value) @python))
(#eq? @_hyperscript "_"))