mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-20 04:10:06 -04:00
HTML: improve highlights & injections
This commit is contained in:
parent
3f9a8e9509
commit
b86555d9c3
6 changed files with 39 additions and 1 deletions
|
|
@ -162,6 +162,7 @@ Mainly for markup languages.
|
||||||
@text.strong
|
@text.strong
|
||||||
@text.emphasis
|
@text.emphasis
|
||||||
@text.underline
|
@text.underline
|
||||||
|
@text.strike
|
||||||
@text.title
|
@text.title
|
||||||
@text.literal
|
@text.literal
|
||||||
@text.uri
|
@text.uri
|
||||||
|
|
|
||||||
|
|
@ -580,6 +580,10 @@ For text to be represented with emphasis.
|
||||||
*hl-TSUnderline*
|
*hl-TSUnderline*
|
||||||
For text to be represented with an underline.
|
For text to be represented with an underline.
|
||||||
|
|
||||||
|
`TSStrike`
|
||||||
|
*hl-TSStrike*
|
||||||
|
For strikethrough text.
|
||||||
|
|
||||||
`TSTitle`
|
`TSTitle`
|
||||||
*hl-TSTitle*
|
*hl-TSTitle*
|
||||||
Text that is part of a title.
|
Text that is part of a title.
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ hlmap["text"] = "TSText"
|
||||||
hlmap["text.strong"] = "TSStrong"
|
hlmap["text.strong"] = "TSStrong"
|
||||||
hlmap["text.emphasis"] = "TSEmphasis"
|
hlmap["text.emphasis"] = "TSEmphasis"
|
||||||
hlmap["text.underline"] = "TSUnderline"
|
hlmap["text.underline"] = "TSUnderline"
|
||||||
|
hlmap["text.strike"] = "TSStrike"
|
||||||
hlmap["text.title"] = "TSTitle"
|
hlmap["text.title"] = "TSTitle"
|
||||||
hlmap["text.literal"] = "TSLiteral"
|
hlmap["text.literal"] = "TSLiteral"
|
||||||
hlmap["text.uri"] = "TSURI"
|
hlmap["text.uri"] = "TSURI"
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ highlight default link TSText TSNone
|
||||||
highlight default TSStrong term=bold cterm=bold gui=bold
|
highlight default TSStrong term=bold cterm=bold gui=bold
|
||||||
highlight default TSEmphasis term=italic cterm=italic gui=italic
|
highlight default TSEmphasis term=italic cterm=italic gui=italic
|
||||||
highlight default TSUnderline term=underline cterm=underline gui=underline
|
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 TSTitle Title
|
||||||
highlight default link TSLiteral String
|
highlight default link TSLiteral String
|
||||||
highlight default link TSURI Underlined
|
highlight default link TSURI Underlined
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,32 @@
|
||||||
(quoted_attribute_value) @string
|
(quoted_attribute_value) @string
|
||||||
(comment) @comment
|
(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
|
"=" @operator
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -14,4 +40,4 @@
|
||||||
">"
|
">"
|
||||||
"</"
|
"</"
|
||||||
"/>"
|
"/>"
|
||||||
] @tag.delimiter
|
] @tag.delimiter
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
((style_element
|
((style_element
|
||||||
(raw_text) @css))
|
(raw_text) @css))
|
||||||
|
|
||||||
|
((attribute
|
||||||
|
(attribute_name) @_attr
|
||||||
|
(quoted_attribute_value (attribute_value) @css))
|
||||||
|
(#match? @_attr "^style$"))
|
||||||
|
|
||||||
((script_element
|
((script_element
|
||||||
(raw_text) @javascript))
|
(raw_text) @javascript))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue