add highlighting definition for MarkDown syntax

This commit is contained in:
Siegfried Pammer 2013-03-29 19:13:59 +01:00
Родитель 20fbc16c6e
Коммит 3d3f07f076
3 изменённых файлов: 65 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,61 @@
<?xml version="1.0"?>
<SyntaxDefinition name="MarkDown" extensions=".md" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Heading" foreground="Maroon" exampleText="# Title #" />
<Color name="Emphasis" fontStyle="italic" exampleText="*this* is important!" />
<Color name="StrongEmphasis" fontWeight="bold" exampleText="**this** is more important!" />
<Color name="Code" exampleText="this is `int.GetHashCode()`" />
<Color name="BlockQuote" foreground="DarkBlue" exampleText="&gt; This is a\r\n&gt; quote." />
<Color name="Link" foreground="Blue" exampleText="[text](http://example.com)" />
<Color name="Image" foreground="Green" exampleText="[text][http://example.com/test.png]" />
<Color name="LineBreak" background="LightGray" exampleText="end of line \r\n2nd line " />
<RuleSet ignoreCase="true">
<Span color="Heading">
<Begin>^\#</Begin>
</Span>
<Span color="StrongEmphasis" multiline="true">
<Begin>\*\*</Begin>
<End>\*\*</End>
</Span>
<Span color="StrongEmphasis" multiline="true">
<Begin>__</Begin>
<End>__</End>
</Span>
<Span color="Emphasis" multiline="true">
<Begin>\*(?![ ])</Begin>
<End>\*</End>
</Span>
<Span color="Emphasis" multiline="true">
<Begin>_</Begin>
<End>_</End>
</Span>
<Span color="Code" ruleSet="C#/">
<Begin>`</Begin>
<End>`</End>
</Span>
<Span color="Code" ruleSet="C#/">
<Begin>^\t</Begin>
<End>^(?!\t)</End>
</Span>
<Span color="Code" ruleSet="C#/">
<Begin>^[ ]{4}</Begin>
<End>^(?![ ]{4})</End>
</Span>
<Span color="BlockQuote">
<Begin>^&gt;</Begin>
<End>^(?!&gt;)</End>
</Span>
<Rule color="Image">
\!\[.*\]\[.*\]
</Rule>
<Rule color="Link">
\[.*\]\(.*\)
</Rule>
<Rule color="Link">
\[.*\]\[.*\]
</Rule>
<Rule color="LineBreak">
[ ]{2}$
</Rule>
</RuleSet>
</SyntaxDefinition>

Просмотреть файл

@ -42,6 +42,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
".booproj;.build;.xfrm;.targets;.xaml;.xpt;" +
".xft;.map;.wsdl;.disco;.ps1xml;.nuspec").Split(';'),
"XML-Mode.xshd");
hlm.RegisterHighlighting("MarkDown", new[] { ".md" }, "MarkDown-Mode.xshd");
}
}
}

Просмотреть файл

@ -448,4 +448,7 @@
<ItemGroup>
<EmbeddedResource Include="Highlighting\Resources\PowerShell.xshd" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Highlighting\Resources\MarkDown-Mode.xshd" />
</ItemGroup>
</Project>