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
|
<?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 R Markdown
(c) 2014 Dirk Sarpe (dsarpe@posteo.de)
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="R Markdown"
section="Markup"
extensions="*.rmd;*.Rmd;*.RMD"
mimetype="text/x-r-markdown"
version="9"
kateversion="5.79"
casesensitive="true"
author="Dirk Sarpe (dsarpe@posteo.de)"
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"/>
<RegExpr String="`r\b" attribute="Structure"
context="R inline"/>
<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>
<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=">" 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+>" 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,}>" 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,}>" 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="<!--" end="-->"/>
</comments>
</general>
</language>
|