Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whistyun/mdxaml
Markdown for WPF - alternate version of Markdown.Xaml
https://github.com/whistyun/mdxaml
flowdocument markdown wpf
Last synced: 4 days ago
JSON representation
Markdown for WPF - alternate version of Markdown.Xaml
- Host: GitHub
- URL: https://github.com/whistyun/mdxaml
- Owner: whistyun
- License: mit
- Created: 2020-02-20T16:02:12.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-27T09:02:03.000Z (9 months ago)
- Last Synced: 2024-08-11T09:09:34.018Z (5 months ago)
- Topics: flowdocument, markdown, wpf
- Language: C#
- Size: 3.91 MB
- Stars: 230
- Watchers: 3
- Forks: 38
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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](https://github.com/theunrepentantgeek/Markdown.XAML)
Markdown XAML is a port of the popular
[MarkdownSharp](http://code.google.com/p/markdownsharp/) Markdown processor, but with one very
significant difference: Instead of rendering to a string containing HTML, it renders to a
[FlowDocument](http://msdn.microsoft.com/en-us/library/system.windows.documents.flowdocument.aspx)
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](docs/img.demo/sc1.png)
![sc2](docs/img.demo/sc2.png)
![sc3](docs/img.demo/sc3.png)
![sc4](docs/img.demo/sc4.png)
![sc5](docs/img.demo/sc5.png)## Nuget
[https://www.nuget.org/packages/MdXaml/](https://www.nuget.org/packages/MdXaml/)
## Quick start
### Convert markdown-string in a code.
```cs
// 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.
```xml
# sample title
* document1
* two
* three
* document2
```
We can use MarkdownScrollViewer with code-behind and with binding.## How to use (Markdown standard)
* [Transform markdow to flowdocument](docs/transform_markdow_to_flowdocument.md)
* [Render markdown in Control](docs/render_markdown_in_control.md)
* [Image reading priority order](docs/image_load_priority.md)## [How to use (Markdown enhance)](docs/original_enhance.md)
* 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
```cmd
git clone https://github.com/whistyun/MdXaml.git
```2. If you use VisualStudio, open MdXaml.sln.
If you use dotnet CLI.
```cmd
dotnet build
```## License
MdXaml is licensed under the MIT license.
## Dependencies (Runtime)
* MdXaml
* AvalonEdit (MIT) https://github.com/icsharpcode/AvalonEdit* MdXaml.Html
* AvalonEdit (MIT) https://github.com/icsharpcode/AvalonEdit
* HtmlAgilityPack (MIT) https://github.com/zzzprojects/html-agility-pack* MdXaml.Svg
* Svg (MIT) https://github.com/svg-net/SVG* MdXaml.AnimatedGif
* WpfAnimatedGif (Apache-2.0) https://github.com/XamlAnimatedGif/WpfAnimatedGif