View on GitHub

MdXaml

Markdown for WPF - alternate version of Markdown.Xaml

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.

Sample

If you want to try yourself, please download Demo-application and execute it.

sc1 sc2 sc3 sc4 sc5

Nuget

  1. https://www.nuget.org/packages/MdXaml/
  2. https://www.nuget.org/packages/MdXaml_migfree/

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.