robin/laufey

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

Francisco Requenafeat(treesitter): conceal backslash in markdown inline highlights #404958a845104c8

master
2.2 KiB128 linesraw
1; From MDeiml/tree-sitter-markdown
2(code_span) @markup.raw @nospell
3
4(emphasis) @markup.italic
5
6(strong_emphasis) @markup.strong
7
8(strikethrough) @markup.strikethrough
9
10(shortcut_link
11  (link_text) @nospell)
12
13; Conceal backslash in backslash escapes
14((backslash_escape) @conceal
15  (#offset! @conceal 0 0 0 -1)
16  (#set! conceal ""))
17
18; Conceal backslash in hard line breaks
19((hard_line_break
20  "\\" @conceal)
21  (#set! conceal ""))
22
23; Conceal codeblock and text style markers
24([
25  (code_span_delimiter)
26  (emphasis_delimiter)
27] @conceal
28  (#set! conceal ""))
29
30; Conceal inline links
31(inline_link
32  [
33    "["
34    "]"
35    "("
36    (link_destination)
37    ")"
38  ] @markup.link
39  (#set! conceal ""))
40
41[
42  (link_label)
43  (link_text)
44  (link_title)
45  (image_description)
46] @markup.link.label
47
48((inline_link
49  (link_destination) @_url) @_label
50  (#set! @_label url @_url))
51
52((image
53  (link_destination) @_url) @_label
54  (#set! @_label url @_url))
55
56; Conceal image links
57(image
58  [
59    "!"
60    "["
61    "]"
62    "("
63    (link_destination)
64    ")"
65  ] @markup.link
66  (#set! conceal ""))
67
68; Conceal full reference links
69(full_reference_link
70  [
71    "["
72    "]"
73    (link_label)
74  ] @markup.link
75  (#set! conceal ""))
76
77; Conceal collapsed reference links
78(collapsed_reference_link
79  [
80    "["
81    "]"
82  ] @markup.link
83  (#set! conceal ""))
84
85; Conceal shortcut links
86(shortcut_link
87  [
88    "["
89    "]"
90  ] @markup.link
91  (#set! conceal ""))
92
93[
94  (link_destination)
95  (uri_autolink)
96  (email_autolink)
97] @markup.link.url @nospell
98
99((uri_autolink) @_url
100  (#offset! @_url 0 1 0 -1)
101  (#set! @_url url @_url))
102
103(entity_reference) @nospell
104
105; Replace common HTML entities.
106((entity_reference) @character.special
107  (#eq? @character.special " ")
108  (#set! conceal " "))
109
110((entity_reference) @character.special
111  (#eq? @character.special "<")
112  (#set! conceal "<"))
113
114((entity_reference) @character.special
115  (#eq? @character.special "&gt;")
116  (#set! conceal ">"))
117
118((entity_reference) @character.special
119  (#eq? @character.special "&amp;")
120  (#set! conceal "&"))
121
122((entity_reference) @character.special
123  (#eq? @character.special "&quot;")
124  (#set! conceal "\""))
125
126((entity_reference) @character.special
127  (#any-of? @character.special "&ensp;" "&emsp;")
128  (#set! conceal " "))