diff options
| -rw-r--r-- | CONTRIBUTING.md | 1 | ||||
| -rw-r--r-- | doc/nvim-treesitter.txt | 4 | ||||
| -rw-r--r-- | lua/nvim-treesitter/highlight.lua | 1 | ||||
| -rw-r--r-- | plugin/nvim-treesitter.vim | 1 | ||||
| -rw-r--r-- | queries/html/highlights.scm | 28 | ||||
| -rw-r--r-- | queries/html/injections.scm | 5 |
6 files changed, 39 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e92ffc3b..e671b24d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -162,6 +162,7 @@ Mainly for markup languages. @text.strong @text.emphasis @text.underline +@text.strike @text.title @text.literal @text.uri diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index 0f3c879a..eb1573ef 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -580,6 +580,10 @@ For text to be represented with emphasis. *hl-TSUnderline* For text to be represented with an underline. +`TSStrike` + *hl-TSStrike* +For strikethrough text. + `TSTitle` *hl-TSTitle* Text that is part of a title. diff --git a/lua/nvim-treesitter/highlight.lua b/lua/nvim-treesitter/highlight.lua index e149cf83..753aeed7 100644 --- a/lua/nvim-treesitter/highlight.lua +++ b/lua/nvim-treesitter/highlight.lua @@ -78,6 +78,7 @@ hlmap["text"] = "TSText" hlmap["text.strong"] = "TSStrong" hlmap["text.emphasis"] = "TSEmphasis" hlmap["text.underline"] = "TSUnderline" +hlmap["text.strike"] = "TSStrike" hlmap["text.title"] = "TSTitle" hlmap["text.literal"] = "TSLiteral" hlmap["text.uri"] = "TSURI" diff --git a/plugin/nvim-treesitter.vim b/plugin/nvim-treesitter.vim index 19b88fb3..0bc3ae8d 100644 --- a/plugin/nvim-treesitter.vim +++ b/plugin/nvim-treesitter.vim @@ -74,6 +74,7 @@ highlight default link TSText TSNone highlight default TSStrong term=bold cterm=bold gui=bold highlight default TSEmphasis term=italic cterm=italic gui=italic highlight default TSUnderline term=underline cterm=underline gui=underline +highlight default TSStrike term=strikethrough cterm=strikethrough gui=strikethrough highlight default link TSTitle Title highlight default link TSLiteral String highlight default link TSURI Underlined diff --git a/queries/html/highlights.scm b/queries/html/highlights.scm index f721440e..c7be2123 100644 --- a/queries/html/highlights.scm +++ b/queries/html/highlights.scm @@ -6,6 +6,32 @@ (quoted_attribute_value) @string (comment) @comment +((element (start_tag (tag_name) @_tag) (text) @text.title) + (#match? @_tag "^(h[0-9]|title)$")) + +((element (start_tag (tag_name) @_tag) (text) @text.strong) + (#match? @_tag "^(strong|b)$")) + +((element (start_tag (tag_name) @_tag) (text) @text.emphasis) + (#match? @_tag "^(em|i)$")) + +((element (start_tag (tag_name) @_tag) (text) @text.strike) + (#match? @_tag "^(s|del)$")) + +((element (start_tag (tag_name) @_tag) (text) @text.underline) + (#match? @_tag "^u$")) + +((element (start_tag (tag_name) @_tag) (text) @text.literal) + (#match? @_tag "^(code|kbd)$")) + +((element (start_tag (tag_name) @_tag) (text) @text.uri) + (#match? @_tag "^a$")) + +((attribute + (attribute_name) @_attr + (quoted_attribute_value (attribute_value) @text.uri)) + (#match? @_attr "^href$")) + "=" @operator [ @@ -14,4 +40,4 @@ ">" "</" "/>" - ] @tag.delimiter +] @tag.delimiter diff --git a/queries/html/injections.scm b/queries/html/injections.scm index 18994f1a..742c92d9 100644 --- a/queries/html/injections.scm +++ b/queries/html/injections.scm @@ -1,5 +1,10 @@ ((style_element (raw_text) @css)) +((attribute + (attribute_name) @_attr + (quoted_attribute_value (attribute_value) @css)) + (#match? @_attr "^style$")) + ((script_element (raw_text) @javascript)) |
