Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/src/resources/pandoc/syntax-definitions/markdown.xml
12926 views
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
Kate syntax highlight filter for Markdown/MultiMarkdown documents.
4
5
Copyright 2008 Darrin Yeager. http://www.dyeager.org/
6
Dual-Licensed under both GPL and BSD licenses.
7
8
Extended 2009 Claes Holmerson. http://github.com/claes/kate-markdown/
9
Extended 2019 Nibaldo González S. <[email protected]> (changes under MIT license).
10
-->
11
<!--
12
The [^\s]{1} is in the regex to avoid interfering with bullet list which
13
starts "* item". Thus emphasis/strong MUST be formed like *words here*
14
with the asterisks next to the beginning of the first word.
15
16
Match space or newline, followed by "*", followed by one non-space,
17
followed by anything non-asterisk, followed by "*", followed by
18
space, end-of-sentence punctuation, or the end of the line.
19
20
TODO: We can be more specific and highlight text combinations in bold,
21
italic and strikethrough.
22
Example: **bold text and _italic and bold text_**
23
__bold and ~~strikeout and bold~~__
24
-->
25
<!--
26
Quarto specific adaptations to keep upon updates:
27
- Support for ```{language} code block syntax, specific to quarto computation code blocks
28
- Add explicit support for language julia and dot in code blocks as they are available in skylighting
29
-->
30
<!DOCTYPE language
31
[
32
<!-- NOTE: To correctly detect bold, italic or strike out text, use minimal="true" in RegExpr rules -->
33
<!ENTITY contentregex_ast "(?:(?:[^\*\s\\]|\\.)(?:[^\\]|\\.)*)?(?:[^\*\s\\]|\\\S)">
34
<!ENTITY contentregex_und "(?:(?:[^_\s\\]|\\.)(?:[^\\]|\\.)*)?(?:[^_\s\\]|\\\S)">
35
<!-- strong + emphasis text -->
36
<!ENTITY strongemphasisregex_ast "\*{3,5}&contentregex_ast;\*{3}">
37
<!ENTITY strongemphasisregex_und "\b_{3,5}&contentregex_und;_{3}">
38
<!ENTITY strongemphasisregex_ast_und "\*{2,5}(?:(?:_|_{3}|_{5})&contentregex_und;_+|(?:_{2}|_{4})&contentregex_und;_)\*{2}">
39
<!ENTITY strongemphasisregex_ast_und2 "\*_{2,5}&contentregex_und;_{2,5}\*(?!\*)">
40
<!ENTITY strongemphasisregex_und_ast "\b_{2,5}(?:(?:\*|\*{3}|\*{5})&contentregex_ast;\*+|(?:\*{2}|\*{4})&contentregex_ast;\*)_{2}">
41
<!ENTITY strongemphasisregex_und_ast2 "\b_(?:\*{2,5}&contentregex_ast;\*{2,5}_{0,4}|_{0,4}\*{2,5}&contentregex_ast;\*{2,5})_\b">
42
<!-- strong text -->
43
<!ENTITY strongregex_ast "\*{2}(?:&contentregex_ast;\*{2}|\*{1,3}&contentregex_ast;\*{2}(?!\*))">
44
<!ENTITY strongregex_und "\b_{2}(?:&contentregex_und;_{2}|_{1,3}&contentregex_und;_{2}(?!_))">
45
<!-- emphasis text -->
46
<!ENTITY emphasisregex_ast "\*(?:&contentregex_ast;\*|\*{1,4}&contentregex_ast;\*(?!\*))">
47
<!ENTITY emphasisregex_und "\b_(?:&contentregex_und;_+|_{1,4}&contentregex_und;_)\b">
48
<!-- links.
49
Keep in sync with reStructuredText (rest) -->
50
<!ENTITY startlink "(?:https?|ftp)\://">
51
<!ENTITY link "&startlink;[^&quot;&gt;\s]+">
52
<!-- link in normal text.
53
Keep in sync with reStructuredText’s (rest) StandaloneHyperlink attribute -->
54
<!ENTITY implicitlink "\b&startlink;[^&quot;&gt;\s`\)]*[^\s!&quot;&apos;`\(\)\*,\.:;&lt;&gt;\?~\]\}\\](?=[[:punct:]]*(?:[\s\)]|$))">
55
<!-- references: [name], [name][id], [name][id] "title", [name](https://example.com) -->
56
<!ENTITY refchar "(?:\\.|[^\]\\])">
57
<!ENTITY refname "(?:\\.|[^\s\[\]\\])&refchar;*">
58
<!ENTITY reflinkid "\s*(?:&refname;)?">
59
<!ENTITY reflinkidregex "(?:\s?\[&reflinkid;\]|\((?:\\.|[^\(\)\\])*\))">
60
<!ENTITY reflinkregex "\[(?:(?=\s*&refname;\])|\s+(?=\]))">
61
<!-- target ref.: [id]: https://example.com "Title" -->
62
<!ENTITY reflinktargetregex '\[\s*(?:&refname;|\s)\]\:\s+(?=\S)'>
63
<!-- footnote: [^name] -->
64
<!ENTITY footnoteregex "\[\^&refchar;+\]">
65
<!-- image: ![title](https://example.com), ![title][id] -->
66
<!ENTITY startinlineimage "\!\[(?:\\.|[^\[\]\\])*\]\(">
67
<!ENTITY endinlineimage "(?:\\.|[^\(\)\\])*\)">
68
<!ENTITY inlineimageregex "&startinlineimage;(?=&endinlineimage;)">
69
<!ENTITY refimageregex "\!\[(?:\\.|[^\[\]\\])*\]\[&reflinkid;\]">
70
<!-- autolink & email: <https://example.com>, <[email protected]>, <mailto:[email protected]> -->
71
<!ENTITY autolinkregex '&lt;&link;&gt;'>
72
<!ENTITY email "[\-\.\w]+\@[\-a-z0-9]+(?:\.[\-a-z0-9]+)*\.[a-z]+">
73
<!ENTITY mailtolinkregex "&lt;(?:mailto:)?(?=&email;&gt;)">
74
<!-- horizontal rule: avoid conflicts with strong-emphasis text, lists and code blocks -->
75
<!ENTITY rulerregex "\s*(?:(?:\*\s*){3,}|(?:_\s*){3,}|(?:\-\s*){3,})\s*$">
76
<!-- two spaces at end of line generates linebreak -->
77
<!ENTITY linebreakregex " $">
78
<!-- strikethrough text, pandoc style -->
79
<!ENTITY strikeoutregex "[~]{2}[^~](?:.*[^~])?[~]{2}">
80
<!-- highlight text -->
81
<!ENTITY highlightregex "[=]{2}[^=](?:.*[^=])?[=]{2}">
82
<!-- emoji -->
83
<!ENTITY emojiregex ":([-+]1|\w+):">
84
<!-- start of fenced code block -->
85
<!ENTITY fcode "(`{3,}|~{3,})">
86
<!-- end of line & empty line -->
87
<!ENTITY end "\s*$">
88
<!ENTITY emptyline "^\s*$">
89
<!-- indented code block -->
90
<!ENTITY indentedcodeblock "(?:\s{4}|\t).*$">
91
<!-- bullet of list -->
92
<!ENTITY listbullet "[\*\+\-]">
93
<!-- metadata key & name of html tag -->
94
<!ENTITY metadatakey "[a-zA-Z0-9][\w\-\s]*\:">
95
<!ENTITY htmlname "[A-Za-z_\:][\w\.\:\-]*">
96
<!-- comment -->
97
<!ENTITY startcomment "&lt;!--">
98
<!ENTITY endcomment "--&gt;">
99
<!ENTITY checkbox "\[[ x]\](?=\s)">
100
]>
101
102
<language name="Markdown" version="30" kateversion="5.79" section="Markup" extensions="*.md;*.mmd;*.markdown;*.md.html" mimetype="text/markdown" priority="15" author="Darrin Yeager, Claes Holmerson" license="GPL,BSD">
103
<highlighting>
104
<contexts>
105
<!-- Start of the Markdown document: find metadata or code block -->
106
<context name="Start Document" attribute="Normal Text" lineEndContext="Normal Text" lineEmptyContext="Normal Text" fallthroughContext="Normal Text">
107
<!-- Some titles: (Title|Author|Date|Copyright|Revision|CSS|LaTeX\ XSLT|Categories|Tags|BaseName|Excerpt) -->
108
<!-- Metadata: Markdown format -->
109
<RegExpr attribute="Metadata" context="metadata" String="^\-{3}&end;" column="0" beginRegion="metadata"/>
110
<!-- Metadata: MultiMarkdown format -->
111
<RegExpr attribute="Metadata Title" context="metadata-mm-value" String="^&metadatakey;(?=\s|$)" column="0"/>
112
<!-- Code Block -->
113
<RegExpr attribute="Code" context="find-code-block-start" String="^&indentedcodeblock;" column="0"/>
114
</context>
115
<context name="metadata" attribute="Metadata" lineEndContext="#stay">
116
<StringDetect attribute="Metadata" context="#pop!Normal Text" String="---" column="0" endRegion="metadata"/>
117
<StringDetect attribute="Metadata" context="#pop!Normal Text" String="..." column="0" endRegion="metadata"/>
118
<RegExpr attribute="Metadata Title" String="^&metadatakey;(?=\s|$)" column="0"/>
119
</context>
120
<context name="metadata-mm-value" attribute="Metadata" lineEndContext="#pop!metadata-mm"/>
121
<context name="metadata-mm" attribute="Metadata" lineEndContext="#stay" lineEmptyContext="#pop!Normal Text" fallthroughContext="#pop!Normal Text">
122
<!-- Find Metadata key or value -->
123
<RegExpr attribute="Metadata Title" context="#pop!metadata-mm-value" String="^&metadatakey;(?=\s|$)" column="0"/>
124
<RegExpr attribute="Metadata" context="#pop!metadata-mm-value" String="^(?:\s{4}|\t)" column="0"/>
125
</context>
126
<context name="find-code-block-start" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="#stay" fallthroughContext="#pop!Normal Text">
127
<IncludeRules context="find-code-block"/>
128
</context>
129
130
<!-- Normal Text Document -->
131
<context name="Normal Text" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="find-code-block">
132
<!-- Header -->
133
<DetectChar context="find-header" char="#" column="0" lookAhead="true"/>
134
<RegExpr attribute="Header H1" String="(?:\=\s*){2,}$" firstNonSpace="true"/>
135
<!-- Highlight code block after line only with spaces or comment -->
136
<RegExpr attribute="Normal Text" context="find-code-block" String="&emptyline;" column="0"/>
137
<StringDetect attribute="Comment" context="find-code-block" String="&startcomment;" column="0" lookAhead="true"/>
138
<!-- Horizontal rules, Blockquotes and Lists.
139
NOTE: The indentation of the lists is captured. -->
140
<RegExpr attribute="Horizontal Rule" context="find-code-block" String="^&rulerregex;" column="0"/>
141
<DetectChar attribute="Blockquote" context="blockquote" char="&gt;" firstNonSpace="true"/>
142
<RegExpr attribute="List" context="list" String="^(\s*)&listbullet;(\s+)" column="0"/>
143
<RegExpr attribute="Number List" context="numlist" String="^(\s*)\d\.(\s+)" column="0"/>
144
<RegExpr attribute="Number List" context="numlist2" String="^(\s*)\d\d+\.(\s+)" column="0"/>
145
<!-- Find Strong, Emphasis and Strikethrough Text -->
146
<DetectChar context="find-strong-normal" char="*" lookAhead="true"/>
147
<DetectChar context="find-emphasis-normal" char="_" lookAhead="true"/>
148
<RegExpr attribute="Strikethrough Text" minimal="true" String="&strikeoutregex;"/>
149
<RegExpr attribute="Highlight Text" minimal="true" String="&highlightregex;"/>
150
<!-- Common -->
151
<IncludeRules context="inc"/>
152
<RegExpr attribute="Normal Text: Link" String="&implicitlink;"/>
153
<!-- Table -->
154
<DetectChar attribute="Table" char="|" context="table" firstNonSpace="true" lookAhead="1"/>
155
</context>
156
<!-- Find indented code blocks. These are only allowed after an empty line or on the first line -->
157
<context name="find-code-block" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="#stay" fallthroughContext="#pop">
158
<RegExpr attribute="Code" String="^&indentedcodeblock;" column="0"/>
159
<RegExpr attribute="Normal Text" String="&end;" />
160
<RegExpr attribute="Comment" context="comment" String="^\s*&startcomment;|\s*&startcomment;(?=.*&endcomment;)" beginRegion="comment"/>
161
</context>
162
163
<!-- Table in Normal Text Document -->
164
<context name="table" attribute="Normal Text" lineEndContext="#pop" lineEmptyContext="#pop!find-code-block">
165
<IncludeRules context="find-table-element"/>
166
<IncludeRules context="Normal Text"/>
167
</context>
168
169
<context name="find-table-element" attribute="Normal Text" lineEndContext="#pop">
170
<RegExpr attribute="Table" String="(\|(\s*:?---+:?)?)++"/>
171
</context>
172
173
<context name="find-header" attribute="Normal Text" lineEndContext="#pop">
174
<RegExpr attribute="Header H1" context="#pop!close-H2-region" String="^#\s" column="0" endRegion="H1" beginRegion="H1" lookAhead="true"/>
175
<RegExpr attribute="Header H2" context="#pop!close-H3-region" String="^##\s" column="0" endRegion="H2" beginRegion="H2" lookAhead="true"/>
176
<RegExpr attribute="Header H3" context="#pop!close-H4-region" String="^###\s" column="0" endRegion="H3" beginRegion="H3" lookAhead="true"/>
177
<RegExpr attribute="Header H4" context="#pop!close-H5-region" String="^####\s" column="0" endRegion="H4" beginRegion="H4" lookAhead="true"/>
178
<RegExpr attribute="Header H5" context="#pop!close-H6-region" String="^#####\s" column="0" endRegion="H5" beginRegion="H5" lookAhead="true"/>
179
<RegExpr attribute="Header H6" context="#pop" String="^######\s.*" column="0" endRegion="H6" beginRegion="H6"/>
180
<DetectChar attribute="Normal Text" context="#pop" char="#"/>
181
</context>
182
<!-- BUG: 441278 sub-headers should be closed when their parent header is closed (e.g. in h1 h2 h3 h1, h1-h3 should all be closed at the 2nd h1) -->
183
<!-- TODO: Port to a less hacky version (maybe a new attribute for declaring multiple endRegions) -->
184
<context name="close-H2-region" attribute="Header H2" lineEndContext="#pop!close-H3-region" fallthroughContext="#pop!close-H3-region">
185
<DetectChar attribute="Header H2" context="#pop!close-H3-region" char="#" lookAhead="true" endRegion="H2"/>
186
</context>
187
<context name="close-H3-region" attribute="Header H3" lineEndContext="#pop!close-H4-region" fallthroughContext="#pop!close-H4-region">
188
<DetectChar attribute="Header H3" context="#pop!close-H4-region" char="#" lookAhead="true" endRegion="H3"/>
189
</context>
190
<context name="close-H4-region" attribute="Header H4" lineEndContext="#pop!close-H5-region" fallthroughContext="#pop!close-H5-region">
191
<DetectChar attribute="Header H4" context="#pop!close-H5-region" char="#" lookAhead="true" endRegion="H4"/>
192
</context>
193
<context name="close-H5-region" attribute="Header H5" lineEndContext="#pop!close-H6-region" fallthroughContext="#pop!close-H6-region">
194
<DetectChar attribute="Header H5" context="#pop!close-H6-region" char="#" lookAhead="true" endRegion="H5"/>
195
</context>
196
<context name="close-H6-region" attribute="Header H6" lineEndContext="#pop" fallthroughContext="#pop">
197
<DetectChar attribute="Header H6" context="#pop!close-sentinel-region" char="#" lookAhead="true" endRegion="H6"/>
198
</context>
199
<!-- This sentinel does not close any actual region, it's just here so that the proper attribute/highlighting is applied and -->
200
<!--to ensure that H6 headers won't be set as the "primary" region that was closed just because it was closed last -->
201
<context name="close-sentinel-region" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
202
<RegExpr attribute="Header H1" context="#pop" String="^#\s.*" column="0"/>
203
<RegExpr attribute="Header H2" context="#pop" String="^##\s.*" column="0"/>
204
<RegExpr attribute="Header H3" context="#pop" String="^###\s.*" column="0"/>
205
<RegExpr attribute="Header H4" context="#pop" String="^####\s.*" column="0"/>
206
<RegExpr attribute="Header H5" context="#pop" String="^#####\s.*" column="0"/>
207
</context>
208
209
210
<context name="find-strong-normal" attribute="Normal Text" lineEndContext="#pop">
211
<RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und;|&strongemphasisregex_ast_und2;"/>
212
<RegExpr attribute="Strong Text" context="#pop" minimal="true" String="&strongregex_ast;"/>
213
<RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast;"/>
214
<RegExpr attribute="Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_ast;"/>
215
<DetectChar attribute="Normal Text" context="#pop" char="*"/>
216
</context>
217
<context name="find-emphasis-normal" attribute="Normal Text" lineEndContext="#pop">
218
<RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und_ast;|&strongemphasisregex_und_ast2;"/>
219
<RegExpr attribute="Strong Text" context="#pop" minimal="true" String="&strongregex_und;"/>
220
<RegExpr attribute="Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_und;"/>
221
<RegExpr attribute="Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_und;"/>
222
<DetectChar attribute="Normal Text" context="#pop" char="_"/>
223
</context>
224
225
<!-- Blockquote -->
226
<context name="blockquote" attribute="Blockquote: Normal Text" lineEndContext="#stay" lineEmptyContext="#pop">
227
<IncludeRules context="default-blockquote-1"/>
228
<!-- Find code block -->
229
<RegExpr attribute="Normal Text" context="#pop!find-code-block" String="&emptyline;" column="0"/>
230
<StringDetect attribute="Comment" context="#pop!find-code-block" String="&startcomment;" column="0" lookAhead="true"/>
231
<IncludeRules context="default-blockquote-2"/>
232
<IncludeRules context="find-table-element"/>
233
</context>
234
<!-- Blockquote within a list -->
235
<context name="blockquote-list" attribute="Blockquote: Normal Text" lineEndContext="#stay" lineEmptyContext="#pop">
236
<IncludeRules context="default-blockquote-1"/>
237
<!-- Don't find code block -->
238
<RegExpr attribute="Normal Text" context="#pop" String="&emptyline;" column="0"/>
239
<StringDetect attribute="Comment" context="#pop!comment" String="&startcomment;" firstNonSpace="true"/>
240
<IncludeRules context="default-blockquote-2"/>
241
</context>
242
243
<context name="default-blockquote-1" attribute="Blockquote: Normal Text" lineEndContext="#stay">
244
<DetectChar attribute="Blockquote" char="&gt;" firstNonSpace="true"/>
245
<!-- End with header, horizontal rule or list/numlist -->
246
<RegExpr context="#pop" String="^(?:\s*(?:&listbullet;|[\d]+\.)\s|#{1,6}\s|&rulerregex;)" column="0" lookAhead="true"/>
247
</context>
248
<context name="default-blockquote-2" attribute="Blockquote: Normal Text" lineEndContext="#stay">
249
<!-- Strong, emphasis, strong-emphasis and strikethrough text -->
250
<AnyChar context="find-strong-emphasis-blockquote" String="*_" lookAhead="true"/>
251
<RegExpr attribute="Blockquote: Strikethrough Text" minimal="true" String="&strikeoutregex;"/>
252
<RegExpr attribute="Blockquote: Highlight Text" minimal="true" String="&highlightregex;"/>
253
<!-- Common -->
254
<IncludeRules context="inc"/>
255
<RegExpr attribute="Blockquote: Link" String="&implicitlink;"/>
256
</context>
257
<context name="find-strong-emphasis-blockquote" attribute="Blockquote: Normal Text" lineEndContext="#pop">
258
<RegExpr attribute="Blockquote: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und;|&strongemphasisregex_und_ast;|&strongemphasisregex_ast_und2;|&strongemphasisregex_und_ast2;"/>
259
<RegExpr attribute="Blockquote: Strong Text" context="#pop" minimal="true" String="&strongregex_ast;|&strongregex_und;"/>
260
<RegExpr attribute="Blockquote: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast;|&strongemphasisregex_und;"/>
261
<RegExpr attribute="Blockquote: Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_ast;|&emphasisregex_und;"/>
262
<AnyChar attribute="Blockquote: Normal Text" context="#pop" String="*_"/>
263
</context>
264
265
<!-- List and Numbered List -->
266
<!-- NOTE: The indentation of the lists is captured. New paragraphs, code blocks, blockquotes or
267
horizontal rules must have an indentation equal to or greater than the list, to be part of it. -->
268
<!-- * list -->
269
<context name="list" attribute="List: Normal Text" lineEndContext="#stay" fallthroughContext="content-list">
270
<!-- Find indented code blocks, blockquotes and horizontal rules -->
271
<RegExpr attribute="Code" String="^%1%2\s&indentedcodeblock;" column="0" dynamic="true"/>
272
<RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s+&gt;" column="0" dynamic="true"/>
273
<RegExpr attribute="Horizontal Rule" String="^%1%2\s+&rulerregex;" column="0" dynamic="true"/>
274
<RegExpr String="&emptyline;" column="0"/>
275
<!-- Text with the same indentation captured corresponds to the item list -->
276
<RegExpr context="content-list" String="^%1%2\s" column="0" lookAhead="true" dynamic="true"/>
277
<!-- Finish when the text has a lower indentation than the list -->
278
<RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
279
<!-- Highlight checkbox at the start of the item (task list) -->
280
<RegExpr attribute="List: Checkbox" context="content-list" String="\s*&checkbox;"/>
281
<!-- Highlight checkbox at the start of the item (task list) -->
282
<RegExpr attribute="Table" context="content-list-table" String="\s*\|"/>
283
</context>
284
<!-- 1. numlist (one digit) -->
285
<context name="numlist" attribute="List: Normal Text" lineEndContext="#stay" fallthroughContext="content-list">
286
<!-- Find indented code blocks, blockquotes and horizontal rules -->
287
<RegExpr attribute="Code" String="^%1%2\s{2}&indentedcodeblock;" column="0" dynamic="true"/>
288
<RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s{2,}&gt;" column="0" dynamic="true"/>
289
<RegExpr attribute="Horizontal Rule" String="^%1%2\s{2,}&rulerregex;" column="0" dynamic="true"/>
290
<RegExpr String="&emptyline;" column="0"/>
291
<!-- Text with the same indentation captured -->
292
<RegExpr context="content-list" String="^%1%2\s{2}" column="0" lookAhead="true" dynamic="true"/>
293
<!-- Finish when the text has a lower indentation than the list -->
294
<RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
295
</context>
296
<!-- 10. numlist (two or more digits) -->
297
<context name="numlist2" attribute="List: Normal Text" lineEndContext="#stay" fallthroughContext="content-list">
298
<!-- Find indented code blocks, blockquotes and horizontal rules -->
299
<RegExpr attribute="Code" String="^%1%2\s{3}&indentedcodeblock;" column="0" dynamic="true"/>
300
<RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s{3,}&gt;" column="0" dynamic="true"/>
301
<RegExpr attribute="Horizontal Rule" String="^%1%2\s{3,}&rulerregex;" column="0" dynamic="true"/>
302
<RegExpr String="&emptyline;" column="0"/>
303
<!-- Text with the same indentation captured -->
304
<RegExpr context="content-list" String="^%1%2\s{3}" column="0" lookAhead="true" dynamic="true"/>
305
<!-- Finish when the text has a lower indentation than the list -->
306
<RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
307
</context>
308
309
<!-- NOTE: Empty lines, blockquotes and horizontal rules send to contexts "list", "numlist" or "numlist2" (#pop),
310
to check the indentation of the text and determine if the content of the list ends. -->
311
<context name="content-list" attribute="List: Normal Text" lineEndContext="#stay" lineEmptyContext="#pop">
312
<RegExpr context="#pop" String="&emptyline;" column="0"/>
313
<!-- Blockquote and horizontal rule (check indentation) -->
314
<RegExpr context="#pop" String="^\s*(?:&gt;|&rulerregex;)" column="0" lookAhead="true"/>
315
<!-- End with header or new list/numlist -->
316
<RegExpr context="#pop#pop" String="^(?:\s*(?:&listbullet;|[\d]+\.)\s|#{1,6}\s)" column="0" lookAhead="true"/>
317
<!-- Strong, emphasis, strong-emphasis and strikethrough text -->
318
<AnyChar context="find-strong-emphasis-list" String="*_" lookAhead="true"/>
319
<RegExpr attribute="List: Strikethrough Text" minimal="true" String="&strikeoutregex;"/>
320
<RegExpr attribute="List: Highlight Text" minimal="true" String="&highlightregex;"/>
321
<!-- Common -->
322
<IncludeRules context="inc"/>
323
<RegExpr attribute="List: Link" String="&implicitlink;"/>
324
</context>
325
<context name="find-strong-emphasis-list" attribute="List: Normal Text" lineEndContext="#pop">
326
<RegExpr attribute="List: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast_und;|&strongemphasisregex_und_ast;|&strongemphasisregex_ast_und2;|&strongemphasisregex_und_ast2;"/>
327
<RegExpr attribute="List: Strong Text" context="#pop" minimal="true" String="&strongregex_ast;|&strongregex_und;"/>
328
<RegExpr attribute="List: Strong-Emphasis Text" context="#pop" minimal="true" String="&strongemphasisregex_ast;|&strongemphasisregex_und;"/>
329
<RegExpr attribute="List: Emphasis Text" context="#pop" minimal="true" String="&emphasisregex_ast;|&emphasisregex_und;"/>
330
<AnyChar attribute="List: Normal Text" context="#pop" String="*_"/>
331
</context>
332
333
<!-- Table in List -->
334
<context name="content-list-table" attribute="List: Normal Text" lineEndContext="#stay" lineEmptyContext="#pop">
335
<IncludeRules context="find-table-element"/>
336
<IncludeRules context="content-list"/>
337
</context>
338
339
<!-- Comments -->
340
<context name="comment" attribute="Comment" lineEndContext="#stay">
341
<StringDetect attribute="Comment" context="#pop" String="&endcomment;" endRegion="comment"/>
342
<IncludeRules context="##Comments"/>
343
</context>
344
345
<!-- Fenced Code Blocks -->
346
<context name="find-lang-fenced-code" attribute="Normal Text" lineEndContext="#pop">
347
<!-- Apply syntax highlighting to fenced code blocks for some languages -->
348
<RegExpr attribute="Fenced Code" context="#pop!code" String="&fcode;&end;" beginRegion="code-block"/>
349
<RegExpr attribute="Fenced Code" context="#pop!bash-code" String="&fcode;\s*\{?\.?(?:bash(?:rc|_profile|_login|_logout)?|shell|sh|profile|PKGBUILD|APKBUILD|ebuild|eclass|nix).*&end;" insensitive="true" beginRegion="code-block"/>
350
<RegExpr attribute="Fenced Code" context="#pop!zsh-code" String="&fcode;\s*\{?\.?(?:zsh).*&end;" insensitive="true" beginRegion="code-block"/>
351
<RegExpr attribute="Fenced Code" context="#pop!cpp-code" String="&fcode;\s*\{?\.?(?:[ch]pp|[ch]\+\+|[ch]xx|h?cc|hh|cuh?|ino|pde|moc).*&end;" insensitive="true" beginRegion="code-block"/>
352
<RegExpr attribute="Fenced Code" context="#pop!csharp-code" String="&fcode;\s*\{?\.?(?:cs|csharp|c\#).*&end;" insensitive="true" beginRegion="code-block"/>
353
<RegExpr attribute="Fenced Code" context="#pop!cmake-code" String="&fcode;\s*\{?\.?(?:cmake|CMakeLists(?:\.txt)?).*&end;" insensitive="true" beginRegion="code-block"/>
354
<RegExpr attribute="Fenced Code" context="#pop!css-code" String="&fcode;\s*\{?\.?css.*&end;" insensitive="true" beginRegion="code-block"/>
355
<RegExpr attribute="Fenced Code" context="#pop!c-code" String="&fcode;\s*\{?\.?[ch].*&end;" insensitive="true" beginRegion="code-block"/>
356
<RegExpr attribute="Fenced Code" context="#pop!doxygen-code" String="&fcode;\s*\{?\.?doxygen.*&end;" insensitive="true" beginRegion="code-block"/> <!-- Block comment of Doxygen -->
357
<RegExpr attribute="Fenced Code" context="#pop!dot-code" String="&fcode;\s*\{?\.?dot.*&end;" insensitive="true" beginRegion="code-block"/> <!-- Block comment of Doxygen -->
358
<RegExpr attribute="Fenced Code" context="#pop!email-code" String="&fcode;\s*\{?\.?(?:email|emlx?|mbo?x).*&end;" insensitive="true" beginRegion="code-block"/>
359
<RegExpr attribute="Fenced Code" context="#pop!go-code" String="&fcode;\s*\{?\.?go(?:lang)?.*&end;" insensitive="true" beginRegion="code-block"/>
360
<RegExpr attribute="Fenced Code" context="#pop!hamlet-code" String="&fcode;\s*\{?\.?[wxs]?hamlet.*&end;" insensitive="true" beginRegion="code-block"/> <!-- Included in the Haskell definition -->
361
<RegExpr attribute="Fenced Code" context="#pop!haskell-code" String="&fcode;\s*\{?\.?(?:haskell|c?hs|hs\-boot).*&end;" insensitive="true" beginRegion="code-block"/>
362
<RegExpr attribute="Fenced Code" context="#pop!html-code" String="&fcode;\s*\{?\.?(?:[sx]?html?|inc|tmpl|tpl).*&end;" insensitive="true" beginRegion="code-block"/>
363
<RegExpr attribute="Fenced Code" context="#pop!java-code" String="&fcode;\s*\{?\.?(?:java|bsh).*&end;" insensitive="true" beginRegion="code-block"/>
364
<RegExpr attribute="Fenced Code" context="#pop!javascript-code" String="&fcode;\s*\{?\.?(?:javascript|[mo]?js|es6|kwinscript|julius).*&end;" insensitive="true" beginRegion="code-block"/>
365
<RegExpr attribute="Fenced Code" context="#pop!jsx-code" String="&fcode;\s*\{?\.?(?:jsx|tsx|(?:java|type)script\-react).*&end;" insensitive="true" beginRegion="code-block"/> <!-- Included in the HTML definition. Also apply for TSX. -->
366
<RegExpr attribute="Fenced Code" context="#pop!json-code" String="&fcode;\s*\{?\.?(?:json5?|gltf).*&end;" insensitive="true" beginRegion="code-block"/>
367
<RegExpr attribute="Fenced Code" context="#pop!julia-code" String="&fcode;\s*\{?\.?(?:julia|jl).*&end;" insensitive="true" beginRegion="code-block"/>
368
<RegExpr attribute="Fenced Code" context="#pop!yaml-code" String="&fcode;\s*\{?\.?(?:ya?ml).*&end;" insensitive="true" beginRegion="code-block"/>
369
<RegExpr attribute="Fenced Code" context="#pop!matlab-code" String="&fcode;\s*\{?\.?matlab.*&end;" insensitive="true" beginRegion="code-block"/>
370
<RegExpr attribute="Fenced Code" context="#pop!markdown-code" String="&fcode;\s*\{?\.?(?:markdown|m?md).*&end;" insensitive="true" beginRegion="code-block"/>
371
<RegExpr attribute="Fenced Code" context="#pop!mustache-code" String="&fcode;\s*\{?\.?(?:handlebars|hbs|mustache|mst|ractive|hogan|hulk).*&end;" insensitive="true" beginRegion="code-block"/> <!-- Included in the HTML definition -->
372
<RegExpr attribute="Fenced Code" context="#pop!perl-code" String="&fcode;\s*\{?\.?(?:mermaid|perl|p[lm]|pod|psgi|vcl).*&end;" insensitive="true" beginRegion="code-block"/>
373
<RegExpr attribute="Fenced Code" context="#pop!php-code" String="&fcode;\s*\{?\.?(?:php[3457t]?|wml|phtml?|aw|ctp).*&end;" insensitive="true" beginRegion="code-block"/>
374
<RegExpr attribute="Fenced Code" context="#pop!python-code" String="&fcode;\s*\{?\.?(?:python[23]?|py[23w]?|[rc]py|sconstruct|gypi?).*&end;" insensitive="true" beginRegion="code-block"/>
375
<RegExpr attribute="Fenced Code" context="#pop!qml-code" String="&fcode;\s*\{?\.?qml(?:types)?.*&end;" insensitive="true" beginRegion="code-block"/>
376
<RegExpr attribute="Fenced Code" context="#pop!r-code" String="&fcode;\s*\{?\.?(?:r|rprofile|rscript).*&end;" insensitive="true" beginRegion="code-block"/>
377
<RegExpr attribute="Fenced Code" context="#pop!rest-code" String="&fcode;\s*\{?\.?(?:rst|rest|restructuredtext).*&end;" insensitive="true" beginRegion="code-block"/> <!-- Included in the CMake definition -->
378
<RegExpr attribute="Fenced Code" context="#pop!ruby-code" String="&fcode;\s*\{?\.?(?:ruby|rbx?|rjs|rake|f?cgi|gemspec|irbrc|ru|prawn|Appraisals|(?:Rake|Cap|Chef|Gem|Guard|Hobo|Vagrant||Rant|Berks|Thor|Puppet)file|rxml|(?:xml|js)\.erb).*&end;" insensitive="true" beginRegion="code-block"/>
379
<RegExpr attribute="Fenced Code" context="#pop!rust-code" String="&fcode;\s*\{?\.?(?:rust|rs).*&end;" insensitive="true" beginRegion="code-block"/>
380
<RegExpr attribute="Fenced Code" context="#pop!mysql-code" String="&fcode;\s*\{?\.?(?:mysql|sql|ddl).*&end;" insensitive="true" beginRegion="code-block"/> <!-- Included in the PHP definition -->
381
<RegExpr attribute="Fenced Code" context="#pop!nim-code" String="&fcode;\s*\{?\.?(?:nims?).*&end;" insensitive="true" beginRegion="code-block"/>
382
<RegExpr attribute="Fenced Code" context="#pop!typescript-code" String="&fcode;\s*\{?\.?(?:typescript|ts).*&end;" insensitive="true" beginRegion="code-block"/>
383
<RegExpr attribute="Fenced Code" context="#pop!xml-code" String="&fcode;\s*\{?\.?(?:xml|xsd|xspf|tld|jsp|c?pt|dtml|rss|opml|svg|daml|rdf|ui|kcfg|qrc|wsdl|scxml|xbel|dae|sch|brd|docbook).*&end;" insensitive="true" beginRegion="code-block"/>
384
<RegExpr attribute="Fenced Code" context="#pop!code" String="&fcode;.*$" beginRegion="code-block"/>
385
</context>
386
<context name="code" attribute="Code" lineEndContext="#stay"> <!-- Unknown language -->
387
<RegExpr attribute="Fenced Code" context="#pop" String="%1[~`]*(?=&end;)" firstNonSpace="true" dynamic="true" endRegion="code-block"/>
388
</context>
389
<context attribute="Normal Text" lineEndContext="#stay" name="bash-code" fallthroughContext="Command##Bash">
390
<IncludeRules context="code"/>
391
<IncludeRules context="##Bash" includeAttrib="true"/>
392
</context>
393
<context attribute="Normal Text" lineEndContext="#stay" name="zsh-code" fallthroughContext="Command##Zsh">
394
<IncludeRules context="code"/>
395
<IncludeRules context="##Zsh" includeAttrib="true"/>
396
</context>
397
<context attribute="Normal Text" lineEndContext="#stay" name="cmake-code">
398
<IncludeRules context="code"/>
399
<IncludeRules context="##CMake" includeAttrib="true"/>
400
</context>
401
<context attribute="Normal Text" lineEndContext="#stay" name="c-code">
402
<IncludeRules context="code"/>
403
<IncludeRules context="##C" includeAttrib="true"/>
404
</context>
405
<context attribute="Normal Text" lineEndContext="#stay" name="cpp-code">
406
<IncludeRules context="code"/>
407
<IncludeRules context="##C++" includeAttrib="true"/>
408
</context>
409
<context attribute="Normal Text" lineEndContext="#stay" name="csharp-code">
410
<IncludeRules context="code"/>
411
<IncludeRules context="##C#" includeAttrib="true"/>
412
</context>
413
<context attribute="Normal Text" lineEndContext="#stay" name="css-code">
414
<IncludeRules context="code"/>
415
<IncludeRules context="##CSS" includeAttrib="true"/>
416
</context>
417
<context attribute="Normal Text" lineEndContext="#stay" name="doxygen-code">
418
<IncludeRules context="code"/>
419
<IncludeRules context="BlockComment##Doxygen" includeAttrib="true"/>
420
</context>
421
<context attribute="Normal Text" lineEndContext="#stay" name="dot-code">
422
<IncludeRules context="code"/>
423
<IncludeRules context="##dot" includeAttrib="true"/>
424
</context>
425
<context attribute="Normal Text" lineEndContext="#stay" name="email-code">
426
<IncludeRules context="code"/>
427
<IncludeRules context="##Email" includeAttrib="true"/>
428
</context>
429
<context attribute="Normal Text" lineEndContext="#stay" name="go-code">
430
<IncludeRules context="code"/>
431
<IncludeRules context="##Go" includeAttrib="true"/>
432
</context>
433
<context attribute="Normal Text" lineEndContext="#stay" name="hamlet-code">
434
<IncludeRules context="code"/>
435
<IncludeRules context="##Hamlet" includeAttrib="true"/>
436
</context>
437
<context attribute="Normal Text" lineEndContext="#stay" name="haskell-code">
438
<IncludeRules context="code"/>
439
<IncludeRules context="##Haskell" includeAttrib="true"/>
440
</context>
441
<context attribute="Normal Text" lineEndContext="#stay" name="html-code">
442
<IncludeRules context="code"/>
443
<IncludeRules context="##HTML" includeAttrib="true"/>
444
</context>
445
<context attribute="Normal Text" lineEndContext="#stay" name="java-code">
446
<IncludeRules context="code"/>
447
<IncludeRules context="##Java" includeAttrib="true"/>
448
</context>
449
<context attribute="Normal Text" lineEndContext="#stay" name="javascript-code">
450
<IncludeRules context="code"/>
451
<IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
452
</context>
453
<context attribute="Normal Text" lineEndContext="#stay" name="jsx-code">
454
<IncludeRules context="code"/>
455
<IncludeRules context="Normal##JavaScript React (JSX)" includeAttrib="true"/>
456
</context>
457
<context attribute="Normal Text" lineEndContext="#stay" name="json-code">
458
<IncludeRules context="code"/>
459
<IncludeRules context="##JSON" includeAttrib="true"/>
460
</context>
461
<context attribute="Normal Text" lineEndContext="#stay" name="julia-code">
462
<IncludeRules context="code"/>
463
<IncludeRules context="##Julia" includeAttrib="true"/>
464
</context>
465
<context attribute="Normal Text" lineEndContext="#stay" name="yaml-code">
466
<IncludeRules context="code"/>
467
<IncludeRules context="##YAML" includeAttrib="true"/>
468
</context>
469
<context attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="find-code-block" name="markdown-code">
470
<IncludeRules context="code"/>
471
<IncludeRules context="Normal Text"/>
472
</context>
473
<context attribute="Normal Text" lineEndContext="#stay" name="matlab-code">
474
<IncludeRules context="code"/>
475
<IncludeRules context="##Matlab" includeAttrib="true"/>
476
</context>
477
<context attribute="Normal Text" lineEndContext="#stay" name="mustache-code">
478
<IncludeRules context="code"/>
479
<IncludeRules context="##Mustache/Handlebars (HTML)" includeAttrib="true"/>
480
</context>
481
<context attribute="Normal Text" lineEndContext="#stay" name="perl-code">
482
<IncludeRules context="code"/>
483
<IncludeRules context="##Perl" includeAttrib="true"/>
484
</context>
485
<context attribute="Normal Text" lineEndContext="#stay" name="php-code">
486
<IncludeRules context="code"/>
487
<IncludeRules context="phpsource##PHP/PHP" includeAttrib="true"/>
488
</context>
489
<context attribute="Normal Text" lineEndContext="#stay" name="python-code">
490
<IncludeRules context="code"/>
491
<IncludeRules context="##Python" includeAttrib="true"/>
492
</context>
493
<context attribute="Normal Text" lineEndContext="#stay" name="qml-code">
494
<IncludeRules context="code"/>
495
<IncludeRules context="Normal##QML" includeAttrib="true"/>
496
</context>
497
<context attribute="Normal Text" lineEndContext="#stay" name="r-code">
498
<IncludeRules context="code"/>
499
<IncludeRules context="##R Script" includeAttrib="true"/>
500
</context>
501
<context attribute="Normal Text" lineEndContext="#stay" name="raku-code" fallthroughContext="term##Raku">
502
<IncludeRules context="code"/>
503
<IncludeRules context="base##Raku" includeAttrib="true"/>
504
</context>
505
<context attribute="Normal Text" lineEndContext="#stay" name="rest-code">
506
<IncludeRules context="code"/>
507
<IncludeRules context="##reStructuredText" includeAttrib="true"/>
508
</context>
509
<context attribute="Normal Text" lineEndContext="#stay" name="ruby-code">
510
<IncludeRules context="code"/>
511
<IncludeRules context="##Ruby" includeAttrib="true"/>
512
</context>
513
<context attribute="Normal Text" lineEndContext="#stay" name="rust-code">
514
<IncludeRules context="code"/>
515
<IncludeRules context="##Rust" includeAttrib="true"/>
516
</context>
517
<context attribute="Normal Text" lineEndContext="#stay" name="mysql-code">
518
<IncludeRules context="code"/>
519
<IncludeRules context="##SQL (MySQL)" includeAttrib="true"/>
520
</context>
521
<context attribute="Normal Text" lineEndContext="#stay" name="nim-code">
522
<IncludeRules context="code"/>
523
<IncludeRules context="##Nim" includeAttrib="true"/>
524
</context>
525
<context attribute="Normal Text" lineEndContext="#stay" name="typescript-code">
526
<IncludeRules context="code"/>
527
<IncludeRules context="Normal##TypeScript" includeAttrib="true"/>
528
</context>
529
<context attribute="Normal Text" lineEndContext="#stay" name="xml-code">
530
<IncludeRules context="code"/>
531
<IncludeRules context="##XML" includeAttrib="true"/>
532
</context>
533
534
<!-- Common -->
535
<context name="inc" attribute="Normal Text" lineEndContext="#stay">
536
<!-- Code -->
537
<RegExpr attribute="Code" String="`[^`]+`(?!`)|`{2}[^`](?:.*?[^`])?`{2}(?!`)|`{3}[^`](?:.*?[^`])?`{3}(?!`)|`{4}[^`](?:.*?[^`])?`{4}(?!`)|`{5,}[^`](?:.*?[^`])?`{5,}"/>
538
<!-- Find Fenced Code Block -->
539
<RegExpr attribute="Fenced Code" context="find-lang-fenced-code" String="`{3,}(?=[^`]*$)|~{3,}(?=[^~]*$)" firstNonSpace="true" lookAhead="true"/>
540
<!-- Comment -->
541
<StringDetect attribute="Comment" context="comment" String="&startcomment;" beginRegion="comment"/>
542
<!-- Links and References -->
543
<RegExpr attribute="Reference-Link Target" context="reflinktarget" String="&reflinktargetregex;" firstNonSpace="true"/>
544
<RegExpr attribute="Footnote" String="&footnoteregex;"/>
545
<RegExpr attribute="Reference-Link" context="find-reflink" String="&reflinkregex;"/>
546
<RegExpr attribute="Inline Image" context="inlineimage" String="&inlineimageregex;"/>
547
<RegExpr attribute="Reference Image" String="&refimageregex;"/>
548
<RegExpr attribute="Auto-Link" context="autolink" String="&autolinkregex;" lookAhead="true"/>
549
<RegExpr attribute="Mailto-Link" context="mailtolink" String="&mailtolinkregex;"/>
550
<!-- Emoji -->
551
<RegExpr attribute="Emoji" String="&emojiregex;"/>
552
<!-- Line Break -->
553
<RegExpr attribute="Line Break" minimal="true" String="&linebreakregex;"/>
554
<!-- Backslash Escapes -->
555
<Detect2Chars attribute="Backslash Escape" char="\" char1="\"/>
556
<Detect2Chars attribute="Backslash Escape" char="\" char1="`"/>
557
<Detect2Chars attribute="Backslash Escape" char="\" char1="*"/>
558
<Detect2Chars attribute="Backslash Escape" char="\" char1="_"/>
559
<Detect2Chars attribute="Backslash Escape" char="\" char1="{"/>
560
<Detect2Chars attribute="Backslash Escape" char="\" char1="}"/>
561
<Detect2Chars attribute="Backslash Escape" char="\" char1="["/>
562
<Detect2Chars attribute="Backslash Escape" char="\" char1="]"/>
563
<Detect2Chars attribute="Backslash Escape" char="\" char1="("/>
564
<Detect2Chars attribute="Backslash Escape" char="\" char1=")"/>
565
<Detect2Chars attribute="Backslash Escape" char="\" char1="#"/>
566
<Detect2Chars attribute="Backslash Escape" char="\" char1="+"/>
567
<Detect2Chars attribute="Backslash Escape" char="\" char1="-"/>
568
<Detect2Chars attribute="Backslash Escape" char="\" char1="."/>
569
<Detect2Chars attribute="Backslash Escape" char="\" char1="!"/>
570
<Detect2Chars attribute="Backslash Escape" char="\" char1="|"/>
571
<Detect2Chars attribute="Backslash Escape" char="\" char1="&lt;"/>
572
<Detect2Chars attribute="Backslash Escape" char="\" char1="&gt;"/>
573
<Detect2Chars attribute="Backslash Escape" char="\" char1="&amp;"/>
574
<!-- Inline HTML -->
575
<RegExpr attribute="EntityRef" String="&amp;(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&htmlname;);"/>
576
<RegExpr context="find-html-block" String="&lt;/?&htmlname;(?:[\s&gt;]|/&gt;|$)" lookAhead="true"/>
577
</context>
578
<context name="find-html-block" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
579
<IncludeRules context="FindElements##HTML"/>
580
</context>
581
582
<!-- Links and email: <https://example.com>, <[email protected]> -->
583
<context name="autolink" attribute="Auto-Link" lineEndContext="#pop" fallthroughContext="#pop">
584
<DetectChar attribute="Auto-Link" char="&lt;"/>
585
<DetectChar attribute="Auto-Link" context="#pop" char="&gt;"/>
586
<RegExpr attribute="Link" String="&startlink;[^&quot;&gt;\s]+"/>
587
</context>
588
<context name="mailtolink" attribute="Email" lineEndContext="#pop">
589
<DetectChar attribute="Mailto-Link" context="#pop" char="&gt;"/>
590
</context>
591
592
<!-- References: [example][id], [example](http://example.com) -->
593
<context name="find-reflink" attribute="Reference-Link Name" lineEndContext="#pop">
594
<Detect2Chars attribute="Reference-Link Name" char="\" char1="]"/>
595
<RegExpr attribute="Reference-Link" context="#pop!find-reflink-id" String="\](?=&reflinkidregex;)"/> <!-- Find id -->
596
<DetectChar attribute="Reference-Link" context="#pop" char="]"/>
597
<!-- Image as link or reference -->
598
<RegExpr attribute="Inline Image" context="inlineimage" String="&startinlineimage;(?=&endinlineimage;&refchar;*\])"/>
599
<RegExpr attribute="Reference Image" String="&refimageregex;(?=&refchar;*\])"/>
600
<RegExpr attribute="Reference-Link Name" context="#stay" String="(?:\[(?:\\.|[^\[\]\\])*\](?:\\.|[^\[\]\\])*)+(?=\])" minimal="true"/>
601
</context>
602
<context name="find-reflink-id" attribute="Reference-Link" lineEndContext="#pop">
603
<DetectSpaces />
604
<!-- Ref.: [an example][id] "Optional title" -->
605
<DetectChar attribute="Reference-Link" context="#pop!reflink-id" char="["/>
606
<!-- Inline Ref.: [an example](http://example.com/ "Title") -->
607
<DetectChar attribute="Reference-Link" context="#pop!reflink-inline-id" char="("/>
608
</context>
609
<context name="reflink-inline-id" attribute="Reference-Link" lineEndContext="#pop">
610
<Detect2Chars attribute="Reference-Link" char="\" char1=")"/>
611
<DetectChar attribute="Reference-Link" context="#pop" char=")"/>
612
<RegExpr attribute="Reference-Link: Link" String="\b&startlink;(?:\\.|[^&quot;&gt;\s\)\\])+"/>
613
<RegExpr attribute="Reference-Link: Email" String="\b&email;\b"/>
614
</context>
615
<context name="reflink-id" attribute="Reference-Link ID" lineEndContext="#pop">
616
<Detect2Chars attribute="Reference-Link ID" char="\" char1="]"/>
617
<DetectChar attribute="Reference-Link" context="#pop!reflink-title" char="]"/>
618
<RegExpr attribute="Reference-Link: Link" String="\b&startlink;(?:\\.|[^&quot;&gt;\s\]\\])+"/>
619
</context>
620
<!-- [an example][id] "title" -->
621
<context name="reflink-title" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
622
<RegExpr attribute="Reference-Link" context="#pop" String="\s+&quot;(?:\\.|[^&quot;\\])*&quot;"/>
623
</context>
624
625
<!-- Target Ref.: [foo]: http://example.com/ "Optional Title Here" -->
626
<context name="reflinktarget" attribute="Reference-Link Target" lineEndContext="#pop" fallthroughContext="#pop">
627
<RegExpr attribute="Reference-Link Target: Link" context="#pop!reflinktarget-title" String="\s*&link;(?=\s|$)"/>
628
<RegExpr attribute="Reference-Link Target" context="#pop!reflinktarget-link" String="\s*&lt;(?=&link;&gt;(?:\s|$))"/>
629
<RegExpr attribute="Reference-Link Target" context="#pop!reflinktarget-title" String="\s*#[\w\.\:\-]+\b"/>
630
</context>
631
<context name="reflinktarget-link" attribute="Reference-Link Target" lineEndContext="#pop" fallthroughContext="#pop">
632
<DetectChar attribute="Reference-Link Target" context="#pop!reflinktarget-title" char="&gt;"/>
633
<RegExpr attribute="Reference-Link Target: Link" String="&link;"/>
634
</context>
635
<context name="reflinktarget-title" attribute="Reference-Link Target" lineEndContext="#pop" fallthroughContext="#pop">
636
<DetectSpaces attribute="Reference-Link Target"/>
637
<RegExpr attribute="Reference-Link Target" context="#pop" String="&quot;(?:\\.|[^&quot;\\])*&quot;|&apos;(?:\\.|[^&apos;\\])*&apos;|\((?:\\.|[^\)\\])*\)"/>
638
</context>
639
640
<!-- Image -->
641
<context name="inlineimage" attribute="Inline Image" lineEndContext="#pop">
642
<DetectChar attribute="Inline Image" context="#pop" char=")"/>
643
<Detect2Chars attribute="Inline Image" char="\" char1=")"/>
644
<RegExpr attribute="Inline Image: Link" String="\b&startlink;(?:\\.|[^&quot;&gt;\s\)\\])+"/>
645
</context>
646
</contexts>
647
<itemDatas>
648
<itemData name="Normal Text" defStyleNum="dsNormal"/>
649
<itemData name="Emphasis Text" defStyleNum="dsNormal" italic="true"/>
650
<itemData name="Strong Text" defStyleNum="dsNormal" bold="true"/>
651
<itemData name="Strong-Emphasis Text" defStyleNum="dsNormal" italic="true" bold="true"/>
652
<itemData name="Strikethrough Text" defStyleNum="dsNormal" strikeOut="true"/>
653
<itemData name="Highlight Text" defStyleNum="dsAlert"/>
654
<itemData name="Normal Text: Link" defStyleNum="dsNormal" underline="true" spellChecking="false"/>
655
<itemData name="Horizontal Rule" defStyleNum="dsNormal" bold="true" spellChecking="false"/>
656
<itemData name="Line Break" defStyleNum="dsNormal" underline="true" color="#999999" spellChecking="false"/>
657
<itemData name="Header H1" defStyleNum="dsFunction" bold="true"/>
658
<itemData name="Header H2" defStyleNum="dsFunction" bold="true"/>
659
<itemData name="Header H3" defStyleNum="dsFunction" bold="true"/>
660
<itemData name="Header H4" defStyleNum="dsFunction" bold="true"/>
661
<itemData name="Header H5" defStyleNum="dsFunction" bold="true"/>
662
<itemData name="Header H6" defStyleNum="dsFunction" bold="true"/>
663
<itemData name="Blockquote" defStyleNum="dsAttribute" spellChecking="false"/>
664
<itemData name="Blockquote: Normal Text" defStyleNum="dsAttribute"/>
665
<itemData name="Blockquote: Emphasis Text" defStyleNum="dsAttribute" italic="true"/>
666
<itemData name="Blockquote: Strong Text" defStyleNum="dsAttribute" bold="true"/>
667
<itemData name="Blockquote: Strong-Emphasis Text" defStyleNum="dsAttribute" italic="true" bold="true"/>
668
<itemData name="Blockquote: Strikethrough Text" defStyleNum="dsAttribute" strikeOut="true"/>
669
<itemData name="Blockquote: Highlight Text" defStyleNum="dsAlert"/>
670
<itemData name="Blockquote: Link" defStyleNum="dsAttribute" underline="true" spellChecking="false"/>
671
<itemData name="List" defStyleNum="dsSpecialString" bold="1" spellChecking="false"/>
672
<itemData name="Number List" defStyleNum="dsSpecialString" spellChecking="false"/>
673
<itemData name="List: Normal Text" defStyleNum="dsNormal"/>
674
<itemData name="List: Emphasis Text" defStyleNum="dsNormal" italic="true"/>
675
<itemData name="List: Strong Text" defStyleNum="dsNormal" bold="true"/>
676
<itemData name="List: Strong-Emphasis Text" defStyleNum="dsNormal" italic="true" bold="true"/>
677
<itemData name="List: Strikethrough Text" defStyleNum="dsNormal" strikeOut="true"/>
678
<itemData name="List: Highlight Text" defStyleNum="dsAlert"/>
679
<itemData name="List: Link" defStyleNum="dsNormal" underline="true" spellChecking="false"/>
680
<itemData name="List: Checkbox" defStyleNum="dsVariable" spellChecking="false"/>
681
<itemData name="Comment" defStyleNum="dsComment"/>
682
<itemData name="Code" defStyleNum="dsInformation"/>
683
<itemData name="Fenced Code" defStyleNum="dsInformation" spellChecking="false"/>
684
<itemData name="Table" defStyleNum="dsPreprocessor"/>
685
<itemData name="Emoji" defStyleNum="dsSpecialChar" spellChecking="false"/>
686
<itemData name="Auto-Link" defStyleNum="dsOthers" spellChecking="false"/>
687
<itemData name="Link" defStyleNum="dsOthers" underline="true" spellChecking="false"/>
688
<itemData name="Mailto-Link" defStyleNum="dsOthers" spellChecking="false"/>
689
<itemData name="Email" defStyleNum="dsOthers" italic="true" underline="true" spellChecking="false"/>
690
<itemData name="Footnote" defStyleNum="dsOthers" italic="true"/>
691
<itemData name="Reference-Link" defStyleNum="dsComment" italic="false"/>
692
<itemData name="Reference-Link Name" defStyleNum="dsOthers" underline="true" italic="false"/>
693
<itemData name="Reference-Link ID" defStyleNum="dsComment" italic="false"/>
694
<itemData name="Reference-Link: Link" defStyleNum="dsComment" underline="true" italic="false" spellChecking="false"/>
695
<itemData name="Reference-Link: Email" defStyleNum="dsComment" italic="true" underline="true" spellChecking="false"/>
696
<itemData name="Reference-Link Target" defStyleNum="dsOthers" italic="false" bold="false"/>
697
<itemData name="Reference-Link Target: Link" defStyleNum="dsOthers" underline="true" spellChecking="false"/>
698
<itemData name="Inline Image" defStyleNum="dsAlert" italic="false" bold="false"/>
699
<itemData name="Reference Image" defStyleNum="dsAlert" italic="false" bold="false"/>
700
<itemData name="Inline Image: Link" defStyleNum="dsAlert" italic="false" bold="false" underline="true"/>
701
<itemData name="Metadata Title" defStyleNum="dsAnnotation"/>
702
<itemData name="Metadata" defStyleNum="dsComment" italic="0"/>
703
<itemData name="Backslash Escape" defStyleNum="dsSpecialChar" spellChecking="false"/>
704
<itemData name="EntityRef" defStyleNum="dsDecVal" spellChecking="false"/>
705
</itemDatas>
706
</highlighting>
707
<general>
708
<keywords additionalDeliminator="`"/>
709
<comments>
710
<comment name="multiLine" start="&startcomment;" end="&endcomment;" region="comment"/>
711
</comments>
712
</general>
713
</language>
714
<!-- kate: replace-tabs on; indent-width 2; tab-width 2; -->
715
716