File: quarto.xml

package info (click to toggle)
kf6-syntax-highlighting 6.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 49,872 kB
  • sloc: xml: 205,656; cpp: 12,882; python: 3,055; sh: 965; perl: 814; ruby: 494; pascal: 393; javascript: 161; php: 150; jsp: 132; lisp: 131; haskell: 124; ada: 119; ansic: 107; makefile: 96; f90: 94; ml: 85; cobol: 81; yacc: 71; csh: 62; exp: 61; erlang: 54; sql: 51; java: 47; sed: 45; objc: 37; tcl: 36; awk: 31; asm: 30; fortran: 18; cs: 10
file content (233 lines) | stat: -rw-r--r-- 12,202 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language
[
<!-- Replicated from "markdown.xml": -->
<!ENTITY rulerregex "\s*(?:(?:\*\s*){3,}|(?:_\s*){3,}|(?:\-\s*){3,})\s*$">
<!ENTITY indentedcodeblock "(?:\s{4}|\t).*$">
<!ENTITY listbullet "[\*\+\-]">
<!ENTITY emptyline "^\s*$">
<!ENTITY checkbox "\[[ x]\](?=\s)">
]>
<!--
  Kate highlighting module for Quarto
  (c) 2025 Thomas Friedrichsmeier (thomas.friedrichsmeier@kdemail.net)
  Heavily based on the R markdown highlighting definition, originally by:
  (c) 2014 Dirk Sarpe (dsarpe@posteo.de)

  NOTE: In fact this definition is identical to R markdown in very many parts,
        and the two should be kept in sync, except for the regions marked with
        "Quarto_specific"!

  depends on:
    Kate highlighting module for Markdown
    Kate highlighting module for R script
    Kate highlighting module for LaTeX
    Kate highlighting module for YAML
-->

<language name="Quarto"
section="Markup"
extensions="*.qmd;*.Qmd;*.QMD"
mimetype="text/x-quarto"
version="9"
kateversion="5.79"
casesensitive="true"
author="Thomas Friedrichsmeier (thomas.friedrichsmeier@kdemail.net)"
license="GPL">

  <highlighting>
    <contexts>

      <context name="Start Document" attribute="Markdown" lineEndContext="Normal Text" lineEmptyContext="Normal Text" fallthroughContext="Normal Text">
        <RegExpr String="^---$" column="0" attribute="Markdown" context="YAMLhead" beginRegion="YAMLhead block"/>
      </context>

      <context name="Normal Text" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="find-code-block">
        <IncludeRules context="Common"/>
        <IncludeRules context="Overwrite Markdown Normal Text"/>
        <IncludeRules context="Normal Text##Markdown" includeAttrib="true"/>
      </context>
      <context name="find-code-block" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="find-code-block##Markdown" includeAttrib="true"/>
      </context>

      <context name="Common" attribute="Markdown" lineEndContext="#stay">
        <RegExpr String="```\{r.*\}" firstNonSpace="true" attribute="Structure"
                 context="R block" beginRegion="R block"/>
        <!-- BEGIN Quarto_specific: Alway require braced language sepcifier "{r}" rather than "r" at head of code blocks -->
        <RegExpr String="`\{r.*\}" attribute="Structure"
                 context="R inline"/>
        <!-- END Quarto_specific -->
        <!-- BEGIN Quarto_specific: Allow python, julia, and ojs blocks in the same was as R bloks -->
        <!-- NOTE: contrary to R, no (legacy) options seem to be allowed within the braces, for the other languages -->
        <StringDetect String="```{python}" firstNonSpace="true" attribute="Structure"
                 context="Python block" beginRegion="Python block"/>
        <StringDetect String="`{python}" attribute="Structure"
                 context="Python inline"/>
        <StringDetect String="```{julia}" firstNonSpace="true" attribute="Structure"
                 context="Julia block" beginRegion="Julia block"/>
        <StringDetect String="`{julia}" attribute="Structure"
                 context="Julia inline"/>
        <StringDetect String="```{ojs}" firstNonSpace="true" attribute="Structure"
                 context="OJS block" beginRegion="OJS block"/>
        <StringDetect String="`{ojs}" attribute="Structure"
                 context="OJS inline"/>
        <!-- END Quarto_specific -->
        <Detect2Chars char="$" char1="$" attribute="MathMode"
                      context="LaTeX equation block" beginRegion="LaTeX equation block"/>
        <DetectChar char="$" attribute="MathMode"
                    context="LaTeX inline equation"/>
        <Detect2Chars char="\" char1="$" attribute="Backslash Escape" context="#stay"/>
      </context>

      <context name="R block" attribute="Markdown" lineEndContext="#stay">
        <RegExpr String="```+(?=\s*$)" firstNonSpace="true" attribute="Structure" context="#pop"
                 endRegion="R block"/>
        <IncludeRules context="##R Script" includeAttrib="true"/>
      </context>

      <context name="R inline" attribute="Markdown" lineEndContext="#stay">
        <DetectChar char="`" attribute="Structure" context="#pop"/>
        <IncludeRules context="##R Script" includeAttrib="true"/>
      </context>

      <!-- BEGIN Quarto_specific: Allow python, julia, and ojs blocks in the same was as R bloks -->
      <context name="Python block" attribute="Markdown" lineEndContext="#stay">
        <RegExpr String="```+(?=\s*$)" firstNonSpace="true" attribute="Structure" context="#pop"
                 endRegion="Python block"/>
        <IncludeRules context="##Python" includeAttrib="true"/>
      </context>

      <context name="Python inline" attribute="Markdown" lineEndContext="#stay">
        <DetectChar char="`" attribute="Structure" context="#pop"/>
        <IncludeRules context="##Python" includeAttrib="true"/>
      </context>

      <context name="Julia block" attribute="Markdown" lineEndContext="#stay">
        <RegExpr String="```+(?=\s*$)" firstNonSpace="true" attribute="Structure" context="#pop"
                 endRegion="Julia block"/>
        <IncludeRules context="##Julia" includeAttrib="true"/>
      </context>

      <context name="Julia inline" attribute="Markdown" lineEndContext="#stay">
        <DetectChar char="`" attribute="Structure" context="#pop"/>
        <IncludeRules context="##Julia" includeAttrib="true"/>
      </context>

      <context name="OJS block" attribute="Markdown" lineEndContext="#stay">
        <RegExpr String="```+(?=\s*$)" firstNonSpace="true" attribute="Structure" context="#pop"
                 endRegion="OJS block"/>
        <IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
      </context>

      <context name="OJS inline" attribute="Markdown" lineEndContext="#stay">
        <DetectChar char="`" attribute="Structure" context="#pop"/>
        <IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
      </context>
      <!-- END Quarto_specific -->

      <context name="LaTeX equation block" attribute="MathMode"
               lineEndContext="#stay">
        <Detect2Chars char="$" char1="$" attribute="MathMode"
                      context="#pop" endRegion="LaTeX equation block"/>
        <IncludeRules context="MathModeDisplay##LaTeX" includeAttrib="true"/>
      </context>

      <context name="LaTeX inline equation" attribute="MathMode"
               lineEndContext="#stay">
        <DetectChar char="$" attribute="MathMode" context="#pop"/>
        <IncludeRules context="MathMode##LaTeX" includeAttrib="true"/>
      </context>

      <context name="YAMLhead" attribute="Document Headers"
               lineEndContext="#stay">
        <RegExpr String="^---$" column="0" attribute="Markdown" context="#pop"
                 endRegion="YAMLhead block"/>
        <IncludeRules context="##YAML" includeAttrib="true"/>
      </context>

      <!-- Markdown -->
      <!-- These contexts are replicated from "markdown.xml" to add the features of R Markdown. -->

      <context name="Overwrite Markdown Normal Text" attribute="Markdown" lineEndContext="#stay">
        <!-- Blockquotes -->
        <DetectChar attribute="Blockquote" context="blockquote" char="&gt;" firstNonSpace="true"/>
        <!-- Lists: avoid highlighting code blocks incorrectly, capturing indentation -->
        <RegExpr attribute="List" context="list" String="^(\s*)&listbullet;(\s+)" column="0"/>
        <RegExpr attribute="Number List" context="numlist" String="^(\s*)\d\.(\s+)" column="0"/>
        <RegExpr attribute="Number List" context="numlist2" String="^(\s*)\d\d+\.(\s+)" column="0"/>
      </context>

      <context name="list" attribute="Markdown" lineEndContext="#stay" fallthroughContext="content-list">
        <!-- Find indented code blocks, blockquotes and horizontal rules -->
        <RegExpr attribute="List: Code" String="^%1%2\s&indentedcodeblock;" column="0" dynamic="true"/>
        <RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s+&gt;" column="0" dynamic="true"/>
        <RegExpr attribute="List: Horizontal Rule" String="^%1%2\s+&rulerregex;" column="0" dynamic="true"/>
        <RegExpr String="&emptyline;" column="0"/>
        <!-- Text with the same indentation captured corresponds to the item list -->
        <RegExpr context="content-list" String="^%1%2\s" column="0" lookAhead="true" dynamic="true"/>
        <!-- Finish when the text has a lower indentation than the list -->
        <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
        <!-- Highlight checkbox at the start of the item (task list) -->
        <RegExpr attribute="List: Checkbox" context="content-list" String="\s*&checkbox;"/>
      </context>
      <!-- 1. numlist (one digit) -->
      <context name="numlist" attribute="Markdown" lineEndContext="#stay" fallthroughContext="content-list">
        <RegExpr attribute="List: Code" String="^%1%2\s{2}&indentedcodeblock;" column="0" dynamic="true"/>
        <RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s{2,}&gt;" column="0" dynamic="true"/>
        <RegExpr attribute="List: Horizontal Rule" String="^%1%2\s{2,}&rulerregex;" column="0" dynamic="true"/>
        <RegExpr String="&emptyline;" column="0"/>
        <RegExpr context="content-list" String="^%1%2\s{2}" column="0" lookAhead="true" dynamic="true"/>
        <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
      </context>
      <!-- 10. numlist (two or more digits) -->
      <context name="numlist2" attribute="Markdown" lineEndContext="#stay" fallthroughContext="content-list">
        <RegExpr attribute="List: Code" String="^%1%2\s{3}&indentedcodeblock;" column="0" dynamic="true"/>
        <RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s{3,}&gt;" column="0" dynamic="true"/>
        <RegExpr attribute="List: Horizontal Rule" String="^%1%2\s{3,}&rulerregex;" column="0" dynamic="true"/>
        <RegExpr String="&emptyline;" column="0"/>
        <RegExpr context="content-list" String="^%1%2\s{3}" column="0" lookAhead="true" dynamic="true"/>
        <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
      </context>

      <context name="content-list" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="#pop">
        <IncludeRules context="Common"/>
        <IncludeRules context="content-list##Markdown" includeAttrib="true"/>
      </context>

      <context name="blockquote" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="#pop">
        <IncludeRules context="Common"/>
        <IncludeRules context="blockquote##Markdown" includeAttrib="true"/>
      </context>
      <context name="blockquote-list" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="#pop">
        <IncludeRules context="Common"/>
        <IncludeRules context="blockquote-list##Markdown" includeAttrib="true"/>
      </context>

    </contexts>

    <itemDatas>
      <itemData name="Markdown" defStyleNum="dsNormal"/>
      <itemData name="Structure" defStyleNum="dsRegionMarker"/>
      <itemData name="MathMode" defStyleNum="dsRegionMarker" color="#00A000"/>
      <itemData name="Document Headers" defStyleNum="dsOthers"/>

      <itemData name="Blockquote" defStyleNum="dsAttribute" spellChecking="false"/>
      <itemData name="List" defStyleNum="dsSpecialString" bold="1" spellChecking="false"/>
      <itemData name="Number List" defStyleNum="dsSpecialString" spellChecking="false"/>
      <itemData name="List: Horizontal Rule" defStyleNum="dsNormal" bold="true" spellChecking="false"/>
      <itemData name="List: Code" defStyleNum="dsInformation"/>
      <itemData name="List: Checkbox" defStyleNum="dsVariable" spellChecking="false"/>
      <itemData name="Backslash Escape" defStyleNum="dsSpecialChar" spellChecking="false"/>
    </itemDatas>

  </highlighting>

  <general>
    <keywords additionalDeliminator="`"/>
    <comments>
      <comment name="multiLine" start="&lt;!--" end="--&gt;"/>
    </comments>
  </general>

</language>