MarkView.Avalonia 12.0.1-beta.2

This is a prerelease version of MarkView.Avalonia.
There is a newer version of this package available.
See the version list below for details.
dotnet add package MarkView.Avalonia --version 12.0.1-beta.2
                    
NuGet\Install-Package MarkView.Avalonia -Version 12.0.1-beta.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MarkView.Avalonia" Version="12.0.1-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MarkView.Avalonia" Version="12.0.1-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="MarkView.Avalonia" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MarkView.Avalonia --version 12.0.1-beta.2
                    
#r "nuget: MarkView.Avalonia, 12.0.1-beta.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MarkView.Avalonia@12.0.1-beta.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MarkView.Avalonia&version=12.0.1-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MarkView.Avalonia&version=12.0.1-beta.2&prerelease
                    
Install as a Cake Tool

MarkView.Avalonia

NuGet Version NuGet Downloads Avalonia License CI

A Markdig-powered markdown viewer control for Avalonia UI v12. Drop MarkdownViewer into any Avalonia window or panel to render rich markdown — headings, code blocks, tables, task lists, links, images, and more — using native Avalonia controls with a fully customizable theme.

Installation

dotnet add package MarkView.Avalonia

Quick Start

Include the default theme and add MarkdownViewer to your XAML:

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mv="using:MarkView.Avalonia">
  <Window.Styles>
    <StyleInclude Source="avares://MarkView.Avalonia/Themes/MarkdownTheme.axaml" />
  </Window.Styles>

  <mv:MarkdownViewer Markdown="# Hello, MarkView!" />
</Window>

To handle link clicks in code-behind:

viewer.LinkClicked += (_, e) =>
{
    // e.Url contains the clicked URL
    Process.Start(new ProcessStartInfo(e.Url) { UseShellExecute = true });
};

To use a custom Markdig pipeline:

viewer.Pipeline = new MarkdownPipelineBuilder()
    .UseAdvancedExtensions()
    .Build();

Supported Markdown Features

Feature Notes
Headings H1–H6 CommonMark
Bold, italic CommonMark
Strikethrough Extension (~~text~~)
Inline code CommonMark
Fenced code blocks CommonMark
Blockquotes CommonMark
Ordered and unordered lists CommonMark, tight and loose
Task lists Extension (- [x] item)
Pipe tables Extension
Links and autolinks CommonMark + extension
Images CommonMark, remote URLs loaded async
Thematic breaks CommonMark
Hard line breaks CommonMark (\ or two spaces)
HTML <br> / <br /> Rendered as line break

Extension Packages

MarkView.Avalonia ships optional NuGet packages that add richer rendering capabilities. Each package implements IMarkViewExtension and is activated via a convenience method on MarkdownViewer.

Syntax Highlighting (MarkView.Avalonia.SyntaxHighlighting)

Adds TextMate grammar-based syntax highlighting to fenced code blocks.

dotnet add package MarkView.Avalonia.SyntaxHighlighting
using TextMateSharp.Grammars;

viewer.UseTextMateHighlighting(ThemeName.DarkPlus); // default theme

The extension replaces the built-in CodeBlockRenderer with TextMateCodeBlockRenderer, which tokenises each line and emits coloured Run elements. Unsupported languages fall back to the default monochrome rendering automatically.

Available ThemeName values are defined by TextMateSharp.Grammars: DarkPlus, LightPlus, Monokai, SolarizedDark, SolarizedLight, and more.

SVG Images (MarkView.Avalonia.Svg)

Renders SVG images embedded in markdown (![desc](path/to/image.svg)), including data:image/svg+xml data URIs.

dotnet add package MarkView.Avalonia.Svg
viewer.UseSvg();

The extension inserts SvgImageLoader at the front of the image loader chain. Regular raster images continue to load via the built-in HTTP fallback.

Mermaid Diagrams (MarkView.Avalonia.Mermaid)

Renders fenced mermaid code blocks as live diagrams using an embedded NativeWebView and bundled mermaid.min.js (v11). On Linux, a plain-text fallback is shown instead.

dotnet add package MarkView.Avalonia.Mermaid
viewer.UseMermaid(initialHeight: 300); // height in device-independent pixels

Markdown syntax:

```mermaid
graph TD
  A[Start] --> B{Decision}
  B -- Yes --> C[End]
  B -- No  --> A
```

Combining extensions

All three can be stacked:

viewer
    .UseTextMateHighlighting()
    .UseSvg()
    .UseMermaid();

Extensions are applied in the order they are added to viewer.Extensions. Each extension's Register method is called once per render pass, before the Markdig pipeline is set up.

Writing your own extension

Implement IMarkViewExtension from the core package:

using MarkView.Avalonia.Extensions;
using MarkView.Avalonia.Rendering;

public class MyExtension : IMarkViewExtension
{
    public void Register(AvaloniaRenderer renderer)
    {
        // swap a renderer, add an image loader, or set a code highlighter
        renderer.ReplaceOrAdd<CodeBlockRenderer>(new MyCodeBlockRenderer());
    }
}

viewer.Extensions.Add(new MyExtension());

Theming / Customization

Include MarkdownTheme.axaml for default styles. Override any style class in your own Styles to customise appearance:

Style class Applied to Controls
markdown-h1markdown-h6 Headings TextBlock
markdown-paragraph Paragraphs TextBlock
markdown-code-block Code blocks Border
markdown-code-inline Inline code Border
markdown-blockquote Blockquotes Border
markdown-list Lists StackPanel
markdown-thematic-break Horizontal rules Separator
markdown-image Images Image
markdown-link Hyperlinks HyperlinkButton
markdown-table Tables Grid
markdown-table-cell Table cells Border
markdown-table-header Header cells Border

Example — increase heading size and add a bottom border:

<Style Selector="TextBlock.markdown-h1">
  <Setter Property="FontSize" Value="36" />
  <Setter Property="Foreground" Value="#1A1A2E" />
  <Setter Property="Margin" Value="0,12,0,6" />
</Style>

Known Limitations

Text selection is scoped to individual blocks (paragraphs, headings). Selecting text across multiple blocks (e.g. from a heading into the next paragraph) is not supported in v1.

Limitation Detail
Within-block selection only Each text block is an independent SelectableTextBlock. Cross-block selection requires a custom document container — see Markdown.Avalonia's CTextBlock for a geometry-based reference.
Images are non-selectable Images in inline position are embedded as InlineUIContainer — selection skips around them. This is the same behaviour as all reference libraries.
Task checkboxes are non-selectable Same reason as images.
Anchor scroll is instant BringIntoView() jumps without animation. Smooth scrolling is a future improvement.

License

MIT © Nicolas Musset

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on MarkView.Avalonia:

Package Downloads
MarkView.Avalonia.SyntaxHighlighting

TextMate syntax highlighting extension for MarkView.Avalonia.

MarkView.Avalonia.Mermaid

Mermaid diagram rendering extension for MarkView.Avalonia.

MarkView.Avalonia.Svg

SVG image rendering extension for MarkView.Avalonia.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
12.0.3 143 5/9/2026
12.0.2 153 4/21/2026
12.0.1 156 4/16/2026
12.0.1-beta.3 69 4/15/2026
12.0.1-beta.2 64 4/10/2026
12.0.1-beta.1 52 4/8/2026