mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-09 15:00:04 -04:00
chore(injections)!: update injection syntax to 0.9
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated. Because of that, new syntax should be adopted once 0.9 becomes the baseline requirements for nvim-treesitter - update health check - update doc
This commit is contained in:
parent
2aa9e9b0e6
commit
78b54eb7f6
140 changed files with 1083 additions and 665 deletions
|
|
@ -1,9 +1,11 @@
|
|||
(doctest_block) @python
|
||||
((doctest_block) @injection.content
|
||||
(#set! injection.language "python"))
|
||||
|
||||
;; Directives with nested content without arguments nor options
|
||||
((directive
|
||||
name: (type) @_type
|
||||
body: (body) @rst)
|
||||
body: (body) @injection.content)
|
||||
(#set! injection.language "rst")
|
||||
(#any-of?
|
||||
@_type
|
||||
"attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition"
|
||||
|
|
@ -15,7 +17,8 @@
|
|||
;; Directives with nested content without arguments, but with options
|
||||
((directive
|
||||
name: (type) @_type
|
||||
body: (body (options) (content) @rst))
|
||||
body: (body (options) (content) @injection.content))
|
||||
(#set! injection.language "rst")
|
||||
(#any-of?
|
||||
@_type
|
||||
"attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition"
|
||||
|
|
@ -24,7 +27,8 @@
|
|||
;; Directives with nested content with arguments and options
|
||||
((directive
|
||||
name: (type) @_type
|
||||
body: (body (content) @rst))
|
||||
body: (body (content) @injection.content))
|
||||
(#set! injection.language "rst")
|
||||
(#any-of?
|
||||
@_type
|
||||
"figure"
|
||||
|
|
@ -35,37 +39,42 @@
|
|||
;; Special directives
|
||||
((directive
|
||||
name: (type) @_type
|
||||
body: (body (arguments) @language (content) @content))
|
||||
body: (body (arguments) @injection.language (content) @injection.content))
|
||||
(#any-of? @_type "code" "code-block" "sourcecode"))
|
||||
|
||||
((directive
|
||||
name: (type) @_type
|
||||
body: (body (arguments) @language (content) @content))
|
||||
body: (body (arguments) @injection.language (content) @injection.content))
|
||||
(#eq? @_type "raw"))
|
||||
|
||||
((directive
|
||||
name: (type) @_type
|
||||
body: (body (content) @latex))
|
||||
body: (body (content) @injection.content))
|
||||
(#set! injection.language "latex")
|
||||
(#eq? @_type "math"))
|
||||
|
||||
; TODO: re-add when a parser for csv is added.
|
||||
; ((directive
|
||||
; name: (type) @_type
|
||||
; body: (body (content) @csv))
|
||||
; body: (body (content) @injection.content))
|
||||
; (#set! injection.language "csv")
|
||||
; (#eq? @_type "csv-table"))
|
||||
|
||||
;; Special roles - prefix
|
||||
|
||||
((interpreted_text
|
||||
(role) @_role
|
||||
"interpreted_text" @latex)
|
||||
(#eq? @_role ":math:"))
|
||||
"interpreted_text" @injection.content)
|
||||
(#eq? @_role ":math:")
|
||||
(#set! injection.language "latex"))
|
||||
|
||||
;; Special roles - suffix
|
||||
|
||||
((interpreted_text
|
||||
"interpreted_text" @latex
|
||||
"interpreted_text" @injection.content
|
||||
(role) @_role)
|
||||
(#eq? @_role ":math:"))
|
||||
(#eq? @_role ":math:")
|
||||
(#set! injection.language "latex"))
|
||||
|
||||
(comment) @comment
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue