Warning, /frameworks/syntax-highlighting/data/syntax/rmarkdown.xml is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" encoding="UTF-8"?>
0002 <!DOCTYPE language
0003 [
0004 <!-- Replicated from "markdown.xml": -->
0005 <!ENTITY rulerregex "\s*(?:(?:\*\s*){3,}|(?:_\s*){3,}|(?:\-\s*){3,})\s*$">
0006 <!ENTITY indentedcodeblock "(?:\s{4}|\t).*$">
0007 <!ENTITY listbullet "[\*\+\-]">
0008 <!ENTITY emptyline "^\s*$">
0009 <!ENTITY checkbox "\[[ x]\](?=\s)">
0010 ]>
0011 <!--
0012   Kate highlighting module for R Markdown
0013   (c) 2014 Dirk Sarpe (dsarpe@posteo.de)
0014 
0015   depends on:
0016     Kate highlighting module for Markdown
0017     Kate highlighting module for R script
0018     Kate highlighting module for LaTeX
0019     Kate highlighting module for YAML
0020 -->
0021 
0022 <language name="R Markdown"
0023 section="Markup"
0024 extensions="*.rmd;*.Rmd;*.RMD"
0025 mimetype="text/x-r-markdown"
0026 version="9"
0027 kateversion="5.79"
0028 casesensitive="true"
0029 author="Dirk Sarpe (dsarpe@posteo.de)"
0030 license="GPL">
0031 
0032   <highlighting>
0033     <contexts>
0034 
0035       <context name="Start Document" attribute="Markdown" lineEndContext="Normal Text" lineEmptyContext="Normal Text" fallthroughContext="Normal Text">
0036         <RegExpr String="^---$" column="0" attribute="Markdown" context="YAMLhead" beginRegion="YAMLhead block"/>
0037       </context>
0038 
0039       <context name="Normal Text" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="find-code-block">
0040         <IncludeRules context="Common"/>
0041         <IncludeRules context="Overwrite Markdown Normal Text"/>
0042         <IncludeRules context="Normal Text##Markdown" includeAttrib="true"/>
0043       </context>
0044       <context name="find-code-block" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="#stay" fallthroughContext="#pop">
0045         <IncludeRules context="find-code-block##Markdown" includeAttrib="true"/>
0046       </context>
0047 
0048       <context name="Common" attribute="Markdown" lineEndContext="#stay">
0049         <RegExpr String="```+\{r.*\}" firstNonSpace="true" attribute="Structure"
0050                  context="R block" beginRegion="R block"/>
0051         <RegExpr String="`r\b" attribute="Structure"
0052                  context="R inline"/>
0053         <Detect2Chars char="$" char1="$" attribute="MathMode"
0054                       context="LaTeX equation block" beginRegion="LaTeX equation block"/>
0055         <DetectChar char="$" attribute="MathMode"
0056                     context="LaTeX inline equation"/>
0057         <Detect2Chars char="\" char1="$" attribute="Backslash Escape" context="#stay"/>
0058       </context>
0059 
0060       <context name="R block" attribute="Markdown" lineEndContext="#stay">
0061         <RegExpr String="```+(?=\s*$)" firstNonSpace="true" attribute="Structure" context="#pop"
0062                  endRegion="R block"/>
0063         <IncludeRules context="##R Script" includeAttrib="true"/>
0064       </context>
0065 
0066       <context name="R inline" attribute="Markdown" lineEndContext="#stay">
0067         <DetectChar char="`" attribute="Structure" context="#pop"/>
0068         <IncludeRules context="##R Script" includeAttrib="true"/>
0069       </context>
0070 
0071       <context name="LaTeX equation block" attribute="MathMode"
0072                lineEndContext="#stay">
0073         <Detect2Chars char="$" char1="$" attribute="MathMode"
0074                       context="#pop" endRegion="LaTeX equation block"/>
0075         <IncludeRules context="MathModeDisplay##LaTeX" includeAttrib="true"/>
0076       </context>
0077 
0078       <context name="LaTeX inline equation" attribute="MathMode"
0079                lineEndContext="#stay">
0080         <DetectChar char="$" attribute="MathMode" context="#pop"/>
0081         <IncludeRules context="MathMode##LaTeX" includeAttrib="true"/>
0082       </context>
0083 
0084       <context name="YAMLhead" attribute="Document Headers"
0085                lineEndContext="#stay">
0086         <RegExpr String="^---$" column="0" attribute="Markdown" context="#pop"
0087                  endRegion="YAMLhead block"/>
0088         <IncludeRules context="##YAML" includeAttrib="true"/>
0089       </context>
0090 
0091       <!-- Markdown -->
0092       <!-- These contexts are replicated from "markdown.xml" to add the features of R Markdown. -->
0093 
0094       <context name="Overwrite Markdown Normal Text" attribute="Markdown" lineEndContext="#stay">
0095         <!-- Blockquotes -->
0096         <DetectChar attribute="Blockquote" context="blockquote" char="&gt;" firstNonSpace="true"/>
0097         <!-- Lists: avoid highlighting code blocks incorrectly, capturing indentation -->
0098         <RegExpr attribute="List" context="list" String="^(\s*)&listbullet;(\s+)" column="0"/>
0099         <RegExpr attribute="Number List" context="numlist" String="^(\s*)\d\.(\s+)" column="0"/>
0100         <RegExpr attribute="Number List" context="numlist2" String="^(\s*)\d\d+\.(\s+)" column="0"/>
0101       </context>
0102 
0103       <context name="list" attribute="Markdown" lineEndContext="#stay" fallthroughContext="content-list">
0104         <!-- Find indented code blocks, blockquotes and horizontal rules -->
0105         <RegExpr attribute="List: Code" String="^%1%2\s&indentedcodeblock;" column="0" dynamic="true"/>
0106         <RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s+&gt;" column="0" dynamic="true"/>
0107         <RegExpr attribute="List: Horizontal Rule" String="^%1%2\s+&rulerregex;" column="0" dynamic="true"/>
0108         <RegExpr String="&emptyline;" column="0"/>
0109         <!-- Text with the same indentation captured corresponds to the item list -->
0110         <RegExpr context="content-list" String="^%1%2\s" column="0" lookAhead="true" dynamic="true"/>
0111         <!-- Finish when the text has a lower indentation than the list -->
0112         <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
0113         <!-- Highlight checkbox at the start of the item (task list) -->
0114         <RegExpr attribute="List: Checkbox" context="content-list" String="\s*&checkbox;"/>
0115       </context>
0116       <!-- 1. numlist (one digit) -->
0117       <context name="numlist" attribute="Markdown" lineEndContext="#stay" fallthroughContext="content-list">
0118         <RegExpr attribute="List: Code" String="^%1%2\s{2}&indentedcodeblock;" column="0" dynamic="true"/>
0119         <RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s{2,}&gt;" column="0" dynamic="true"/>
0120         <RegExpr attribute="List: Horizontal Rule" String="^%1%2\s{2,}&rulerregex;" column="0" dynamic="true"/>
0121         <RegExpr String="&emptyline;" column="0"/>
0122         <RegExpr context="content-list" String="^%1%2\s{2}" column="0" lookAhead="true" dynamic="true"/>
0123         <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
0124       </context>
0125       <!-- 10. numlist (two or more digits) -->
0126       <context name="numlist2" attribute="Markdown" lineEndContext="#stay" fallthroughContext="content-list">
0127         <RegExpr attribute="List: Code" String="^%1%2\s{3}&indentedcodeblock;" column="0" dynamic="true"/>
0128         <RegExpr attribute="Blockquote" context="blockquote-list" String="^%1%2\s{3,}&gt;" column="0" dynamic="true"/>
0129         <RegExpr attribute="List: Horizontal Rule" String="^%1%2\s{3,}&rulerregex;" column="0" dynamic="true"/>
0130         <RegExpr String="&emptyline;" column="0"/>
0131         <RegExpr context="content-list" String="^%1%2\s{3}" column="0" lookAhead="true" dynamic="true"/>
0132         <RegExpr context="#pop" String="^\s*\S" column="0" lookAhead="true"/>
0133       </context>
0134 
0135       <context name="content-list" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="#pop">
0136         <IncludeRules context="Common"/>
0137         <IncludeRules context="content-list##Markdown" includeAttrib="true"/>
0138       </context>
0139 
0140       <context name="blockquote" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="#pop">
0141         <IncludeRules context="Common"/>
0142         <IncludeRules context="blockquote##Markdown" includeAttrib="true"/>
0143       </context>
0144       <context name="blockquote-list" attribute="Markdown" lineEndContext="#stay" lineEmptyContext="#pop">
0145         <IncludeRules context="Common"/>
0146         <IncludeRules context="blockquote-list##Markdown" includeAttrib="true"/>
0147       </context>
0148 
0149     </contexts>
0150 
0151     <itemDatas>
0152       <itemData name="Markdown" defStyleNum="dsNormal"/>
0153       <itemData name="Structure" defStyleNum="dsRegionMarker"/>
0154       <itemData name="MathMode" defStyleNum="dsRegionMarker" color="#00A000"/>
0155       <itemData name="Document Headers" defStyleNum="dsOthers"/>
0156 
0157       <itemData name="Blockquote" defStyleNum="dsAttribute" spellChecking="false"/>
0158       <itemData name="List" defStyleNum="dsSpecialString" bold="1" spellChecking="false"/>
0159       <itemData name="Number List" defStyleNum="dsSpecialString" spellChecking="false"/>
0160       <itemData name="List: Horizontal Rule" defStyleNum="dsNormal" bold="true" spellChecking="false"/>
0161       <itemData name="List: Code" defStyleNum="dsInformation"/>
0162       <itemData name="List: Checkbox" defStyleNum="dsVariable" spellChecking="false"/>
0163       <itemData name="Backslash Escape" defStyleNum="dsSpecialChar" spellChecking="false"/>
0164     </itemDatas>
0165 
0166   </highlighting>
0167 
0168   <general>
0169     <keywords additionalDeliminator="`"/>
0170     <comments>
0171       <comment name="multiLine" start="&lt;!--" end="--&gt;"/>
0172     </comments>
0173   </general>
0174 
0175 </language>