Kate: syntax highlighting for Markdown

Source:  https://github.com/claes/kate-markdown
Licence: GPL or BSD (dual)

Copyright 2008 Darrin Yeager. http://dyeager.org/
Extended  2009 Claes Holmerson. http://github.com/claes/kate-markdown

Per mailing list recommendation by Dr. Niklaus Klepp <dr.klepp@gmx.at>

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
(cherry picked from commit 65ab72853b)
r14.0.x
Mavridis Philippe 2 years ago
parent 18c8dbb466
commit f8c1d05234
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -45,9 +45,9 @@ install( FILES
ini.xml isocpp.xml jam.xml javadoc.xml javascript.xml java.xml json.xml ini.xml isocpp.xml jam.xml javadoc.xml javascript.xml java.xml json.xml
jsp.xml julia.xml j.xml kbasic.xml latex.xml ldif.xml ld.xml less.xml lex.xml lilypond.xml jsp.xml julia.xml j.xml kbasic.xml latex.xml ldif.xml ld.xml less.xml lex.xml lilypond.xml
literate-curry.xml literate-haskell.xml logtalk.xml lpc.xml lsl.xml lua.xml m3u.xml literate-curry.xml literate-haskell.xml logtalk.xml lpc.xml lsl.xml lua.xml m3u.xml
m4.xml mab.xml magma.xml makefile.xml mako.xml mandoc.xml mason.xml mathematica.xml matlab.xml m4.xml mab.xml magma.xml makefile.xml mako.xml mandoc.xml markdown.xml mason.xml mathematica.xml
maxima.xml mediawiki.xml mel.xml mergetagtext.xml meson.xml metafont.xml mips.xml modelica.xml matlab.xml maxima.xml mediawiki.xml mel.xml mergetagtext.xml meson.xml metafont.xml mips.xml
modelines.xml modula-2-iso-only.xml modula-2-pim-only.xml modula-2-r10-only.xml modelica.xml modelines.xml modula-2-iso-only.xml modula-2-pim-only.xml modula-2-r10-only.xml
modula-2.xml monobasic.xml mup.xml nagios.xml nasm.xml nemerle.xml nesc.xml modula-2.xml monobasic.xml mup.xml nagios.xml nasm.xml nemerle.xml nesc.xml
noweb.xml objectivecpp.xml objectivec.xml ocaml.xml ocamllex.xml ocamlyacc.xml noweb.xml objectivecpp.xml objectivec.xml ocaml.xml ocamllex.xml ocamlyacc.xml
octave.xml oors.xml opal.xml opencl.xml octave.xml oors.xml opal.xml opencl.xml

@ -23,9 +23,9 @@ syntaxkate_DATA = language.dtd syntax.template \
ini.xml isocpp.xml jam.xml javadoc.xml javascript.xml javascript-php.xml java.xml json.xml \ ini.xml isocpp.xml jam.xml javadoc.xml javascript.xml javascript-php.xml java.xml json.xml \
jsp.xml julia.xml j.xml kbasic.xml latex.xml ldif.xml ld.xml less.xml lex.xml lilypond.xml \ jsp.xml julia.xml j.xml kbasic.xml latex.xml ldif.xml ld.xml less.xml lex.xml lilypond.xml \
literate-curry.xml literate-haskell.xml logtalk.xml lpc.xml lsl.xml lua.xml m3u.xml \ literate-curry.xml literate-haskell.xml logtalk.xml lpc.xml lsl.xml lua.xml m3u.xml \
m4.xml mab.xml magma.xml makefile.xml mako.xml mandoc.xml mason.xml mathematica.xml matlab.xml \ m4.xml mab.xml magma.xml makefile.xml mako.xml mandoc.xml markdown.xml mason.xml mathematica.xml \
maxima.xml mediawiki.xml mel.xml mergetagtext.xml meson.xml metafont.xml mips.xml modelica.xml \ matlab.xml maxima.xml mediawiki.xml mel.xml mergetagtext.xml meson.xml metafont.xml mips.xml \
modelines.xml modula-2-iso-only.xml modula-2-pim-only.xml modula-2-r10-only.xml \ modelica.xml modelines.xml modula-2-iso-only.xml modula-2-pim-only.xml modula-2-r10-only.xml \
modula-2.xml monobasic.xml mup.xml nagios.xml nasm.xml nemerle.xml nesc.xml \ modula-2.xml monobasic.xml mup.xml nagios.xml nasm.xml nemerle.xml nesc.xml \
noweb.xml objectivecpp.xml objectivec.xml ocaml.xml ocamllex.xml ocamlyacc.xml \ noweb.xml objectivecpp.xml objectivec.xml ocaml.xml ocamllex.xml ocamlyacc.xml \
octave.xml oors.xml opal.xml opencl.xml \ octave.xml oors.xml opal.xml opencl.xml \

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Kate syntax highlight filter for Markdown/MultiMarkdown documents.
Copyright 2008 Darrin Yeager. http://www.dyeager.org/
Dual-Licensed under both GPL and BSD licenses.
Extended 2009 Claes Holmerson. http://github.com/claes/kate-markdown/
-->
<!-- the [^\s]{1} is in the regex to avoid interfering with bullet list which
starts "* item". Thus emphasis/strong MUST be formed like *words here*
with the asterisks next to the beginning of the first word.
Match space or newline, followed by "*", followed by one non-space,
followed by anything non-asterisk, followed by "*", followed by
space, end-of-sentence punctuation, or the end of the line.
-->
<!DOCTYPE language SYSTEM "language.dtd"
[
<!ENTITY strongemphasisregex "(\s|^)[\*_]{3}[^\*_]+[\*_]{3}(\s|\.|,|;|:|\-|\?|$)">
<!ENTITY strongregex "(\s|^)[\*_]{2}[^\s]{1}[^\*_]+[\*_]{2}(\s|\.|,|;|:|\-|\?|$)">
<!ENTITY emphasisregex "(\s|^)[\*_]{1}[^\s]{1}[^\*_]+[\*_]{1}(\s|\.|,|;|:|\-|\?|$)">
<!ENTITY reflinkregex '\[[^\]\^]+\]\s*\[[^\]]*\]\s*(\s+\"[^\"]*\"){0,1}'>
<!ENTITY reflinktargetregex '\[[^\]\^]+\]\:\s+[^\s]+(\s+\"[^\"]*\"){0,1}'>
<!ENTITY footnoteregex "\[\^[^\]]+\]">
<!ENTITY inlinelinkregex '\[[^\]\^]+\]\s*\([^\(]*\)'>
<!ENTITY inlineimageregex '\!\[[^\]\^]+\]\([^\(]*\)'>
<!ENTITY refimageregex '\!\[[^\]\^]+\]\[[^\[]*\]'>
<!ENTITY autolinkregex '&lt;(https?|ftp):[^\"&gt;\s]+&gt;'>
<!ENTITY mailtolinkregex '&lt;(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)&gt;'>
<!ENTITY rulerregex '\s*([\*\-_]\s?){3,}\s*'>
<!-- two spaces at end of line generates linebreak -->
<!ENTITY linebreakregex " $">
<!ENTITY strikeoutregex "[~]{2}[^~].*[^~][~]{2}"> <!-- pandoc style -->
]>
<language name="Markdown" version="1.2" section="Markup"
extensions="*.text;*.md;*.mmd;*.mdwn" priority="15"
author="Darrin Yeager, Claes Holmerson"
license="GPL,BSD" >
<highlighting>
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="Normal Text" >
<DetectChar context="blockquote" char="&gt;" column="0"/>
<RegExpr attribute="h1" String="^#\s.*[#]?$" />
<RegExpr attribute="h2" String="^##\s.*[#]?$" />
<RegExpr attribute="h3" String="^###\s.*[#]?$" />
<RegExpr attribute="h4" String="^####\s.*[#]?$" />
<RegExpr attribute="h5" String="^#####\s.*[#]?$" />
<RegExpr attribute="ruler" String="&rulerregex;" />
<RegExpr attribute="strong" String="&strongregex;" />
<RegExpr attribute="emphasis" String="&emphasisregex;" />
<RegExpr attribute="strongemphasis" String="&strongemphasisregex;" />
<RegExpr attribute="code" String="^([\s]{4,}|\t+).*$" />
<RegExpr context="bullet" String="^[\*\+\-]\s" />
<RegExpr context="numlist" String="^[\d]+\.\s" />
<RegExpr attribute="meta" String="^(Title|Author|Date|Copyright|Revision|CSS|LaTeX\ XSLT|Categories|Tags|BaseName|Excerpt):(.*)+$" />
<IncludeRules context="inc" />
</context>
<context attribute="blockquote" lineEndContext="#pop" name="blockquote">
<RegExpr attribute="bq-strong" String="&strongregex;" />
<RegExpr attribute="bq-emphasis" String="&emphasisregex;" />
<IncludeRules context="inc" />
</context>
<context attribute="bullet" lineEndContext="#pop" name="bullet" >
<RegExpr attribute="bl-strong" String="&strongregex;" />
<RegExpr attribute="bl-emphasis" String="&emphasisregex;" />
<IncludeRules context="inc" />
</context>
<context attribute="numlist" lineEndContext="#pop" name="numlist" >
<RegExpr attribute="nl-strong" String="&strongregex;" />
<RegExpr attribute="nl-emphasis" String="&emphasisregex;" />
<IncludeRules context="inc" />
</context>
<context attribute="comment" lineEndContext="#stay" name="comment" >
<RegExpr String="--&gt;" attribute="comment" context="#pop" endRegion="comment"/>
</context>
<context attribute="common" name="inc" lineEndContext="#stay" >
<RegExpr attribute="code" String="`[^`]+`" />
<RegExpr context="comment" String="&lt;!--" beginRegion="comment" />
<RegExpr attribute="reflink" String="&reflinkregex;" />
<RegExpr attribute="footnote" String="&footnoteregex;" />
<RegExpr attribute="inlinelink" String="&inlinelinkregex;"/>
<RegExpr attribute="reflinktarget" String="&reflinktargetregex;"/>
<RegExpr attribute="inlineimage" String="&inlineimageregex;"/>
<RegExpr attribute="refimage" String="&refimageregex;"/>
<RegExpr attribute="autolink" String="&autolinkregex;"/>
<RegExpr attribute="mailtolink" String="&mailtolinkregex;"/>
<RegExpr attribute="strikeout" minimal="true" String="&strikeoutregex;"/>
<RegExpr attribute="linebreak" minimal="true" String="&linebreakregex;"/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="common" defStyleNum="dsNormal" />
<itemData name="strongemphasis" defStyleNum="dsNormal" italic="true" bold="true"/>
<itemData name="emphasis" defStyleNum="dsNormal" italic="true" />
<itemData name="strong" defStyleNum="dsNormal" bold="true" />
<itemData name="ruler" defStyleNum="dsNormal" bold="true" />
<itemData name="strikeout" defStyleNum="dsNormal" strikeOut="true" />
<itemData name="linebreak" defStyleNum="dsNormal" underline="true" color="#999999"/>
<itemData name="h1" defStyleNum="dsFunction" bold="true" />
<itemData name="h2" defStyleNum="dsFunction" bold="true" />
<itemData name="h3" defStyleNum="dsFunction" bold="true" />
<itemData name="h4" defStyleNum="dsFunction" bold="true" />
<itemData name="h5" defStyleNum="dsFunction" bold="true" />
<itemData name="blockquote" defStyleNum="dsDataType" />
<itemData name="bq-emphasis" defStyleNum="dsDataType" italic="true" />
<itemData name="bq-strong" defStyleNum="dsDataType" bold="true" />
<itemData name="bullet" defStyleNum="dsFloat" />
<itemData name="bl-emphasis" defStyleNum="dsFloat" italic="true" />
<itemData name="bl-strong" defStyleNum="dsFloat" bold="true" />
<itemData name="numlist" defStyleNum="dsFloat" />
<itemData name="nl-emphasis" defStyleNum="dsFloat" italic="true" />
<itemData name="nl-strong" defStyleNum="dsFloat" bold="true" />
<itemData name="comment" defStyleNum="dsComment" />
<itemData name="code" defStyleNum="dsBaseN" />
<itemData name="reflink" defStyleNum="dsOthers" underline="true" />
<itemData name="inlinelink" defStyleNum="dsOthers" underline="true" />
<itemData name="autolink" defStyleNum="dsOthers" underline="true" />
<itemData name="mailtolink" defStyleNum="dsOthers" underline="true" />
<itemData name="footnote" defStyleNum="dsOthers" italic="true" />
<itemData name="meta" defStyleNum="dsComment" />
<itemData name="reflinktarget" defStyleNum="dsOthers" italic="false" bold="false" />
<itemData name="inlineimage" defStyleNum="dsAlert" italic="false" bold="false" />
<itemData name="refimage" defStyleNum="dsAlert" italic="false" bold="false" />
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="multiLine" start="&lt;!--" end="--&gt;" region="comment" />
</comments>
</general>
</language>

@ -136,6 +136,7 @@
<Definition name="Makefile" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/makefile.xml" version="2.1"/> <Definition name="Makefile" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/makefile.xml" version="2.1"/>
<Definition name="Mako" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/mako.xml" version="1.0"/> <Definition name="Mako" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/mako.xml" version="1.0"/>
<Definition name="Troff Mandoc" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/mandoc.xml" version="2"/> <Definition name="Troff Mandoc" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/mandoc.xml" version="2"/>
<Definition name="Markdown" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/markdown.xml" version="1.2"/>
<Definition name="Mason" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/mason.xml" version="4"/> <Definition name="Mason" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/mason.xml" version="4"/>
<Definition name="Mathematica" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/mathematica.xml" version="8.1"/> <Definition name="Mathematica" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/mathematica.xml" version="8.1"/>
<Definition name="Matlab" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/matlab.xml" version="2-2"/> <Definition name="Matlab" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/matlab.xml" version="2-2"/>

Loading…
Cancel
Save