MdXaml
MdXaml is a modify version of Markdown.Xaml. It can convert Markdown to FlowDocument of WPF. (for japanese|日本語)
What are Markdown.Xaml and MdXaml ?
About Markdown.Xaml, see the origin project page.
Markdown.Xaml( and MdXaml ) is a port of the popular MarkdownSharp Markdown processor, but with one very significant difference: Instead of rendering to a string containing HTML, it renders to a FlowDocument suitable for embedding into a WPF window or usercontrol.
Additionary, MdXaml add the bellow.
- Put some styles that are scattered in Markdown.Xaml together.
- Embedded Image resource.
- Custom extension of Markdown
- table-colspan/rowspan
- other list mark(alphabet, italic)
- text-decoration(strikethrough, underline, color)
- text-align
Sample
If you want to try yourself, please download Demo-application and execute it.
Nuget
If you want to change dependency library from Markdown.Xaml to MdXaml quickly. use the second link. It keeps the namespace to “Markdown.Xaml”.
Quick start
Transform markdown to flowdocument
// using MdXaml;
// using System.Windows.Documents;
Markdown engine = new Markdown();
string markdownTxt = System.IO.File.ReadAllText("example.md");
FlowDocument document = engine.Transform(markdownTxt);
Render markdown in Control
MainWindow.xaml
<Window x:Class="HeredocSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
Title="MainWindow" Height="450" Width="800">
<mdxam:MarkdownScrollViewer xml:space="preserve">
# sample title
* document1
* two
* three
* document2
</mdxam:MarkdownScrollViewer>
</Window>
More document
License
MdXaml is licensed under the MIT license.