robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Luuk van Baalfeat(treesitter): vertical conceal support for highlighter8ba047e33f

master
2.6 KiB123 linesraw
1;From MDeiml/tree-sitter-markdown & Helix
2(setext_heading
3  (paragraph) @markup.heading.1
4  (setext_h1_underline) @markup.heading.1)
5
6(setext_heading
7  (paragraph) @markup.heading.2
8  (setext_h2_underline) @markup.heading.2)
9
10(atx_heading
11  (atx_h1_marker)) @markup.heading.1
12
13(atx_heading
14  (atx_h2_marker)) @markup.heading.2
15
16(atx_heading
17  (atx_h3_marker)) @markup.heading.3
18
19(atx_heading
20  (atx_h4_marker)) @markup.heading.4
21
22(atx_heading
23  (atx_h5_marker)) @markup.heading.5
24
25(atx_heading
26  (atx_h6_marker)) @markup.heading.6
27
28(info_string) @label
29
30(pipe_table_header
31  (pipe_table_cell) @markup.heading)
32
33(pipe_table_header
34  "|" @punctuation.special)
35
36(pipe_table_row
37  "|" @punctuation.special)
38
39(pipe_table_delimiter_row
40  "|" @punctuation.special)
41
42(pipe_table_delimiter_cell) @punctuation.special
43
44; Code blocks (conceal backticks and language annotation)
45(indented_code_block) @markup.raw.block
46
47((fenced_code_block) @markup.raw.block
48  (#set! priority 90))
49
50(fenced_code_block
51  (fenced_code_block_delimiter) @markup.raw.block
52  (#set! conceal "")
53  (#set! conceal_lines ""))
54
55(fenced_code_block
56  (info_string
57    (language) @label
58    (#set! conceal "")
59    (#set! conceal_lines "")))
60
61(link_destination) @markup.link.url
62
63[
64  (link_title)
65  (link_label)
66] @markup.link.label
67
68((link_label)
69  .
70  ":" @punctuation.delimiter)
71
72[
73  (list_marker_plus)
74  (list_marker_minus)
75  (list_marker_star)
76  (list_marker_dot)
77  (list_marker_parenthesis)
78] @markup.list
79
80; NOTE: The following has been commented out due to issues with spaces in the
81; list marker nodes generated by the parser. If those spaces ever get captured
82; by a different node (e.g. block_continuation) we can safely re-add these
83; conceals.
84; ;; Conceal bullet points
85; ([(list_marker_plus) (list_marker_star)]
86;   @punctuation.special
87;   (#offset! @punctuation.special 0 0 0 -1)
88;   (#set! conceal "•"))
89; ([(list_marker_plus) (list_marker_star)]
90;   @punctuation.special
91;   (#any-of? @punctuation.special "+" "*")
92;   (#set! conceal "•"))
93; ((list_marker_minus)
94;   @punctuation.special
95;   (#offset! @punctuation.special 0 0 0 -1)
96;   (#set! conceal "—"))
97; ((list_marker_minus)
98;   @punctuation.special
99;   (#eq? @punctuation.special "-")
100;   (#set! conceal "—"))
101(thematic_break) @punctuation.special
102
103(task_list_marker_unchecked) @markup.list.unchecked
104
105(task_list_marker_checked) @markup.list.checked
106
107((block_quote) @markup.quote
108  (#set! priority 90))
109
110([
111  (plus_metadata)
112  (minus_metadata)
113] @keyword.directive
114  (#set! priority 90))
115
116[
117  (block_continuation)
118  (block_quote_marker)
119] @punctuation.special
120
121(backslash_escape) @string.escape
122
123(inline) @spell