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