https://github.com/felix-codingclimber/dotnetelements.wpf.markdown
This project provides a simple markdown renderer for WPF.
https://github.com/felix-codingclimber/dotnetelements.wpf.markdown
csharp dotnet markdig markdown wpf
Last synced: 3 months ago
JSON representation
This project provides a simple markdown renderer for WPF.
- Host: GitHub
- URL: https://github.com/felix-codingclimber/dotnetelements.wpf.markdown
- Owner: Felix-CodingClimber
- License: mit
- Created: 2024-12-17T17:02:08.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-23T06:54:50.000Z (7 months ago)
- Last Synced: 2025-04-11T05:09:19.458Z (3 months ago)
- Topics: csharp, dotnet, markdig, markdown, wpf
- Language: C#
- Homepage:
- Size: 145 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About
This project provides a markdown renderer for WPF.
Markdown is rendered to a FlowDocument.
This implementation uses the popular [Markdig](https://github.com/xoofx/markdig) library for parsing.At the current state, all common markdown features are supported (There might be some missing edge cases).
Some of the most used Markdig extensions are also supported.#### Supported features:
- CommonMark
> [!IMPORTANT]
> Currently there are no plans to support [Raw HTML](https://spec.commonmark.org/0.31.2/#raw-html) and [HTML blocks](https://spec.commonmark.org/0.31.2/#html-blocks)
- Pipe tables
- Alert blocks (github)
- Task lists
- Code block syntax highlighting
- Emphasis extras
- Defined image size (``)
- Auto links#### Missing features we would like to implement:
- Footnotes
- Emoji extension (add support for colored font emoji)
- Option to implement other Markdig extensions and provide custom renderers
- Improved theme for light mode
- Default theme for dark mode## Recommended setup
1. Install nuget package `> dotnet add package DotNetElements.Wpf.Markdown --version `
2. Add styles to `App.xaml`
```xaml
```
2. Add xaml namespace
```xaml
xmlns:markdown="clr-namespace:DotNetElements.Wpf.Markdown;assembly=DotNetElements.Wpf.Markdown"
```3. Add `MarkdownTextBlock`
```xaml```
4. Set the `Text` property (binding is supported)
```cs
MarkdownTextBlock.Text = "Hello world from **DotNetElements.Wpf.Markdown**";
```5. To change the styling options for the different markdown blocks, add a customized `MarkdownThemes.cs`
```cs
MarkdownThemes myTheme = MarkdownThemes.Default;
myTheme.InlineCodeBackground = new SolidColorBrush(Colors.HotPink);MarkdownTextBlock.Theme = myTheme;
```## Third party notices
The project is a port of the CommunityToolkit MarkdownTextBlock component to the WPF framework.
See [CommunityToolkit/Labs-Windows/MarkdownTextBlock](https://github.com/CommunityToolkit/Labs-Windows/tree/a37acd33031037daa4d39318e3a10741b1c046ea/components/MarkdownTextBlock)
The code block syntax highlighting uses [ColorCode-Universal](https://github.com/CommunityToolkit/ColorCode-Universal) and a customized version of [ColorCode-WPF](https://github.com/coltrane2ny/ColorCode-WPF)