aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2024-09-09 09:50:54 -0500
committerChristian Clason <c.clason@uni-graz.at>2024-10-06 11:47:42 +0200
commit1bcdd79088f9ecca42090f41dd77c1a9b35578ff (patch)
tree33cba2c33abb968ff5af37e666993975f6a5f29c
parentbot(lockfile): update latex, nix, ruby (diff)
downloadnvim-treesitter-1bcdd79088f9ecca42090f41dd77c1a9b35578ff.tar
nvim-treesitter-1bcdd79088f9ecca42090f41dd77c1a9b35578ff.tar.gz
nvim-treesitter-1bcdd79088f9ecca42090f41dd77c1a9b35578ff.tar.bz2
nvim-treesitter-1bcdd79088f9ecca42090f41dd77c1a9b35578ff.tar.lz
nvim-treesitter-1bcdd79088f9ecca42090f41dd77c1a9b35578ff.tar.xz
nvim-treesitter-1bcdd79088f9ecca42090f41dd77c1a9b35578ff.tar.zst
nvim-treesitter-1bcdd79088f9ecca42090f41dd77c1a9b35578ff.zip
feat(superhtml): add superhtml parser and queries
SuperHTML is a templating language used by the zine static site generator.
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua12
-rw-r--r--queries/superhtml/highlights.scm44
-rw-r--r--queries/superhtml/injections.scm7
4 files changed, 66 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json
index 05d1f2554..1c293b253 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -728,6 +728,9 @@
"supercollider": {
"revision": "1a8ee0da9a4f2df5a8a22f4d637ac863623a78a7"
},
+ "superhtml": {
+ "revision": "3edb67236291d45ba97a79cdac3b91692487a352"
+ },
"surface": {
"revision": "f4586b35ac8548667a9aaa4eae44456c1f43d032"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 877635967..b5853c04f 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -2109,6 +2109,18 @@ list.supercollider = {
maintainers = { "@madskjeldgaard" },
}
+list.superhtml = {
+ install_info = {
+ url = "https://github.com/kristoff-it/superhtml",
+ files = {
+ "src/parser.c",
+ "src/scanner.c",
+ },
+ location = "tree-sitter-superhtml",
+ },
+ maintainers = { "@rockorager" },
+}
+
list.surface = {
install_info = {
url = "https://github.com/connorlay/tree-sitter-surface",
diff --git a/queries/superhtml/highlights.scm b/queries/superhtml/highlights.scm
new file mode 100644
index 000000000..cbf366d1c
--- /dev/null
+++ b/queries/superhtml/highlights.scm
@@ -0,0 +1,44 @@
+(doctype) @constant
+
+(comment) @comment
+
+(tag_name) @tag
+
+((tag_name) @string.special
+ (#any-of? @string.special "super" "extend"))
+
+(attribute_name) @attribute
+
+(attribute_value) @string
+
+((element
+ (start_tag
+ (attribute
+ (attribute_name) @_attribute
+ [
+ (attribute_value) @markup.link.url
+ (quoted_attribute_value
+ (attribute_value) @markup.link.url)
+ ]))
+ (element
+ (start_tag
+ (tag_name) @tag)))
+ (#eq? @tag "super")
+ (#eq? @_attribute "id"))
+
+(element
+ (start_tag
+ (tag_name) @string.special)
+ (#eq? @string.special "super"))
+
+"\"" @string
+
+[
+ "<"
+ ">"
+ "</"
+ "/>"
+ "<!"
+] @punctuation.bracket
+
+"=" @punctuation.delimiter
diff --git a/queries/superhtml/injections.scm b/queries/superhtml/injections.scm
new file mode 100644
index 000000000..138fe7c23
--- /dev/null
+++ b/queries/superhtml/injections.scm
@@ -0,0 +1,7 @@
+((script_element
+ (raw_text) @injection.content)
+ (#set! injection.language "javascript"))
+
+((style_element
+ (raw_text) @injection.content)
+ (#set! injection.language "css"))