mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-11 07:50:07 -04:00
- The directive type does not longer includes `::`. - The content of the directives is not longer interpreted as rst, but it uses language injection for it. - Fix a query to allow to capture targets without link. - Reset the content of the math role so it can be highlighted by the injection instead. Problems I found: - Capturing the same node with @language and @content will raise an error. ``` Error detected while processing FileType Autocommands for "*": E5108: Error executing lua /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:331: table index is nil ``` Harcoding the language works, Using the offset predicate doesn't work either `(#offset! 0 0 1 0)` nor `(#offset! 0 0 0 5)` - Generating the grammar using `tree-sitter-cli@0.17.x` breaks nvim-treesitter, `@0.16.9` works.
132 lines
2.4 KiB
Scheme
132 lines
2.4 KiB
Scheme
;; Marks
|
|
|
|
[
|
|
".."
|
|
"|"
|
|
"--"
|
|
"__"
|
|
":"
|
|
"::"
|
|
"bullet"
|
|
"adornment"
|
|
(transition)
|
|
] @punctuation.special
|
|
|
|
;; Directives
|
|
|
|
(directive
|
|
name: (type) @function)
|
|
|
|
((directive
|
|
name: (type) @include)
|
|
(#eq? @include "include"))
|
|
|
|
((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)
|
|
(line_block)
|
|
] @text.literal
|
|
|
|
(block_quote
|
|
(attribution)? @text.emphasis) @text.literal
|
|
|
|
(substitution_definition
|
|
name: (substitution) @constant)
|
|
|
|
(footnote
|
|
name: (label) @constant)
|
|
|
|
(citation
|
|
name: (label) @constant)
|
|
|
|
(target
|
|
name: (name)? @constant
|
|
link: (_)? @text.literal)
|
|
|
|
;; Lists
|
|
|
|
; Definition lists
|
|
(list_item
|
|
(term) @text.strong
|
|
(classifier)? @text.emphasis)
|
|
|
|
; Field lists
|
|
(field (field_name) @constant)
|
|
|
|
;; Inline markup
|
|
|
|
(emphasis) @text.emphasis
|
|
|
|
(strong) @text.strong
|
|
|
|
(standalone_hyperlink) @text.uri
|
|
|
|
(role) @function
|
|
|
|
((role) @function.builtin
|
|
(#match?
|
|
@function.builtin
|
|
; https://docutils.sourceforge.io/docs/ref/rst/roles.html
|
|
"^:(emphasis|literal|code|math|pep-reference|PEP|rfc-reference|RFC|strong|subscript|sub|superscript|sup|title-reference|title|t|raw):$"))
|
|
|
|
[
|
|
"interpreted_text"
|
|
(literal)
|
|
] @text.literal
|
|
|
|
; Prefix role
|
|
((interpreted_text
|
|
(role) @_role
|
|
"interpreted_text" @text.emphasis)
|
|
(#eq? @_role ":emphasis:"))
|
|
|
|
((interpreted_text
|
|
(role) @_role
|
|
"interpreted_text" @text.strong)
|
|
(#eq? @_role ":strong:"))
|
|
|
|
((interpreted_text
|
|
(role) @_role
|
|
"interpreted_text" @none)
|
|
(#eq? @_role ":math:"))
|
|
|
|
; Suffix 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" @none
|
|
(role) @_role)
|
|
(#eq? @_role ":math:"))
|
|
|
|
[
|
|
(inline_target)
|
|
(substitution_reference)
|
|
(footnote_reference)
|
|
(citation_reference)
|
|
(reference)
|
|
] @constant
|
|
|
|
;; Others
|
|
|
|
(title) @text.title
|
|
|
|
(comment) @comment
|
|
(comment "..") @comment
|
|
|
|
(ERROR) @error
|