blob: 0a8248112e4aebc7e09b65909551a9e5a8541149 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
; Text-object queries for SiSU Spine markup.
;
; Capture conventions follow nvim-treesitter/textobjects:
; @<thing>.outer -> select including delimiters / surrounding whitespace
; @<thing>.inner -> select content only
;
; Hosts that consume these (Neovim's nvim-treesitter-textobjects, Helix,
; Emacs treesit) bind keys such as `af` / `if` to .outer / .inner.
; =================================================================
; Headings (sectioning units)
; =================================================================
; A whole heading line is a "section header" object. Heading sections
; (the heading plus its body content up to the next heading of equal or
; higher level) are not directly expressible in tree-sitter without
; additional grammar work; hosts can synthesise that from these captures.
(heading_part) @class.outer
(heading_part
content: (heading_content) @class.inner)
(heading_segment) @class.outer
(heading_segment
content: (heading_content) @class.inner)
; =================================================================
; Block elements (code / poem / block / group / table / quote)
; =================================================================
; Whole block including delimiters; raw_content is the inner.
(code_block_curly) @function.outer
(code_block_curly
content: (raw_content) @function.inner)
(code_block_tic) @function.outer
(code_block_tic
content: (raw_content) @function.inner)
(poem_block_curly) @function.outer
(poem_block_curly
content: (raw_content) @function.inner)
(poem_block_tic) @function.outer
(poem_block_tic
content: (raw_content) @function.inner)
(block_block_curly) @function.outer
(block_block_curly
content: (raw_content) @function.inner)
(block_block_tic) @function.outer
(block_block_tic
content: (raw_content) @function.inner)
(group_block_curly) @function.outer
(group_block_curly
content: (raw_content) @function.inner)
(group_block_tic) @function.outer
(group_block_tic
content: (raw_content) @function.inner)
(table_block_curly) @function.outer
(table_block_curly
content: (raw_content) @function.inner)
(table_block_tic) @function.outer
(table_block_tic
content: (raw_content) @function.inner)
(quote_block_tic) @function.outer
(quote_block_tic
content: (raw_content) @function.inner)
(pipe_table) @function.outer
; =================================================================
; Footnotes and editor notes
; =================================================================
; Both share the same outer/inner shape; the inner skips the markers and
; closing delimiters.
(footnote) @comment.outer
(footnote
(_)+ @comment.inner)
(editor_note) @comment.outer
(editor_note
(_)+ @comment.inner)
; =================================================================
; Links and images
; =================================================================
(link) @parameter.outer
(link
text: (link_text) @parameter.inner)
(image) @parameter.outer
(image
spec: (image_spec) @parameter.inner)
; =================================================================
; Paragraph / inline-formatting runs
; =================================================================
(paragraph) @block.outer
(paragraph
(_)+ @block.inner)
; Inline formatting pairs - useful as fine-grained text objects.
; The same delimiter character pattern (e.g. `*{` / `}*`) opens and
; closes each, so .inner is everything between them.
(emphasis) @assignment.outer
(bold) @assignment.outer
(italic) @assignment.outer
(underline) @assignment.outer
(citation_mark) @assignment.outer
(superscript) @assignment.outer
(subscript) @assignment.outer
(inserted) @assignment.outer
(strikethrough) @assignment.outer
(monospace_inline) @assignment.outer
; =================================================================
; Book index entries
; =================================================================
(book_index) @attribute.outer
(book_index
(index_content) @attribute.inner)
; =================================================================
; Header fields
; =================================================================
(header_field) @assignment.outer
(header_field
value: (header_value) @assignment.inner)
|