Code Monkey home page Code Monkey logo

mdxaml's Introduction

MdXaml

MdXaml is a modify version of Markdown.Xaml. It can convert Markdown to FlowDocument of WPF.

What is Markdown XAML?

see the origin project page

Markdown XAML 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.

With HTML output, details of fonts and colours (and so on) are handled by CSS, but with a FlowDocument there's no direct equivalent. Instead of the HTML approch of linking a stylesheet to the rendered output, MarkDown.Xaml uses WPF styles that are linked to the rendering engine and applied to the output as it is generated. See the included demo application for an example of how this can be configured.

Samle

sc1 sc2 sc3 sc4 sc5

Nuget

https://www.nuget.org/packages/MdXaml/

Quick start

Convert markdown-string in a code.

// using MdXaml;
// using System.Windows.Documents;

Markdown engine = new Markdown();

string markdownTxt = System.IO.File.ReadAllText("example.md");

FlowDocument document = engine.Transform(markdownTxt);

Write markdown in a 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>

We can use MarkdownScrollViewer with code-behind and with binding.

How to use (Markdown standard)

  • list; alphabet-order, roman-order
  • table; row-span, columnspan
  • text alignment
  • text decoration(bold, italic, strikethrough, underline, color)

Development

IDE: Visual Studio 2019
Framework: .NET Framework 4.6.2, .NET Core 3, .NET 5

Build

  1. Clone the repository

    git clone https://github.com/whistyun/MdXaml.git
  2. If you use VisualStudio, open MdXaml.sln.

    If you use dotnet CLI.

    dotnet build

License

MdXaml is licensed under the MIT license.

mdxaml's People

Contributors

whistyun avatar theunrepentantgeek avatar maxaquila avatar akiotakahashi avatar cuiliang avatar gpailler avatar fjch1997 avatar trigger-segfault avatar thoemmi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.