aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantos Gallegos <stsewd@protonmail.com>2020-07-31 13:26:00 -0500
committerStephan Seitz <stephan.lauf@yahoo.de>2020-08-01 14:33:36 +0200
commit8cacd5aaac0aa13a3ba29e15ea822ac80711abf6 (patch)
tree1227d40ae52f3334c732cfa6f46739b071b6a712
parentMerge pull request #241 from steelsojka/master (diff)
downloadnvim-treesitter-8cacd5aaac0aa13a3ba29e15ea822ac80711abf6.tar
nvim-treesitter-8cacd5aaac0aa13a3ba29e15ea822ac80711abf6.tar.gz
nvim-treesitter-8cacd5aaac0aa13a3ba29e15ea822ac80711abf6.tar.bz2
nvim-treesitter-8cacd5aaac0aa13a3ba29e15ea822ac80711abf6.tar.lz
nvim-treesitter-8cacd5aaac0aa13a3ba29e15ea822ac80711abf6.tar.xz
nvim-treesitter-8cacd5aaac0aa13a3ba29e15ea822ac80711abf6.tar.zst
nvim-treesitter-8cacd5aaac0aa13a3ba29e15ea822ac80711abf6.zip
RST: update highlights
-rw-r--r--queries/rst/highlights.scm49
1 files changed, 39 insertions, 10 deletions
diff --git a/queries/rst/highlights.scm b/queries/rst/highlights.scm
index fa89bce1e..3f7254719 100644
--- a/queries/rst/highlights.scm
+++ b/queries/rst/highlights.scm
@@ -1,4 +1,4 @@
-; Marks
+;; Marks
[
".."
@@ -11,7 +11,7 @@
(transition)
] @punctuation.special
-; Directives
+;; Directives
(directive
name: (type) @function)
@@ -20,7 +20,14 @@
name: (type) @include)
(#match? @include "^include::$"))
-; Blocks
+((directive
+ name: (type) @function.builtin)
+ (#match?
+ @function.builtin
+ ; https://docutils.sourceforge.io/docs/ref/rst/directives.html
+ "^(attention|caution|danger|error|hint|important|note|tip|warning|admonition)|(image|figure)|(topic|sidebar|line-block|parsed-literal|code|math|rubric|epigraph|highlights|pull-quote|compound|container)|(table|csv-table|list-table)|(contents|sectnum|section-numbering|header|footer)|(target-notes)|(meta)|(replace|unicode|date)|(raw|class|role|default-role|title|restructuredtext-test-directive)::$"))
+
+;; Blocks
[
(literal_block)
@@ -42,7 +49,7 @@
name: (reference)? @constant
link: (_) @text.literal)
-; Inline markup
+;; Inline markup
(emphasis) @text.emphasis
@@ -56,10 +63,32 @@
(#match?
@function.builtin
; https://docutils.sourceforge.io/docs/ref/rst/roles.html
- "^:(emphasis|literal|code|math|pep-reference|rfc-reference|strong|subscript|superscript|title-reference|raw):$"))
+ "^:(emphasis|literal|code|math|pep-reference|PEP|rfc-reference|RFC|strong|subscript|sub|superscript|sup|title-reference|title|t|raw):$"))
+
+; Prefix role
+((interpreted_text
+ (role) @_role
+ "interpreted_text" @text.emphasis)
+ (#eq? @_role ":emphasis:"))
+
+((interpreted_text
+ (role) @_role
+ "interpreted_text" @text.strong)
+ (#eq? @_role ":strong:"))
+
+; Sufix role
+((interpreted_text
+ "interpreted_text" @text.emphasis
+ (role) @_role)
+ (#eq? @_role ":emphasis:"))
+
+((interpreted_text
+ "interpreted_text" @text.strong
+ (role) @_role)
+ (#eq? @_role ":strong:"))
[
- (interpreted_text)
+ "interpreted_text"
(literal)
] @text.literal
@@ -71,13 +100,13 @@
(reference)
] @constant
-; Embedded
+;; Embedded
-(doctest_block) @embed
+(doctest_block) @embedded
(directive
- body: (body) @embed)
+ body: (body) @embedded)
-; Others
+;; Others
(title) @text.title