MarkView.Avalonia 12.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MarkView.Avalonia --version 12.4.0
                    
NuGet\Install-Package MarkView.Avalonia -Version 12.4.0
                    
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.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MarkView.Avalonia" Version="12.4.0" />
                    
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.4.0
                    
#r "nuget: MarkView.Avalonia, 12.4.0"
                    
#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.4.0
                    
#: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.4.0
                    
Install as a Cake Addin
#tool nuget:?package=MarkView.Avalonia&version=12.4.0
                    
Install as a Cake Tool

MarkView.Avalonia

NuGet Version NuGet Downloads Avalonia License CI

Markview.Avalonia logo

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 customisable theme.

Documentation: kryptos-fr.github.io/MarkView.Avalonia · Try it in your browser: demo

Installation

dotnet add package MarkView.Avalonia

The package targets .NET 10 and Avalonia 12.

Quick start

Include the theme in App.axaml, after Avalonia's own theme. It holds the viewer's template, which makes the document scroll:

<Application.Styles>
  <FluentTheme />
  <StyleInclude Source="avares://MarkView.Avalonia/Themes/MarkdownTheme.axaml" />
</Application.Styles>

Then put a MarkdownViewer in a window, and give it a string or a file:

<Window xmlns="https://github.com/avaloniaui"
        xmlns:mv="using:MarkView.Avalonia">
  <mv:MarkdownViewer Markdown="# Hello, MarkView!" />
  
</Window>

Stream a language model's answer as it arrives:

viewer.Markdown = "";
using var session = viewer.BeginStreaming();
foreach (var token in tokens)
    session.Append(token);

See Getting started for the next steps.

Features

  • GitHub-flavoured Markdown out of the box: tables, task lists, alerts, footnotes, <details> and the HTML subset that READMEs use, plus Markdig's opt-in syntax. Markdown syntax
  • Built for AI chat: streaming that re-renders only the end of the document and closes unfinished syntax, foldable thinking blocks, and a compact chat preset. Chat and AI answers
  • Code blocks with a copy button, language label, line numbers, wrapping and TextMate syntax highlighting, or your own control for any fence language. Code blocks
  • Images and diagrams: sizing, a zoomable lightbox, saving, an image cache, SVG and Mermaid diagrams, all in .NET. Images and diagrams
  • Math: $…$ and $$…$$ LaTeX formulas. Math
  • Themes: GitHub, Chat and Docs presets, light and dark switching live, and every colour and size a resource you can redefine. Themes and presets
  • Selection, copy and find across the whole document, with copy as Markdown and as HTML. Selection and copy · Find in document
  • Navigation: heading anchors, a table of contents, foldable headings and interactive task lists. Displaying documents
  • Accessible: keyboard navigation, screen reader roles, WCAG AA colours, a high-contrast palette and right-to-left text. Accessibility
  • Lazy rendering: images, formulas, diagrams and code colours are built as they come near the visible area. Lazy rendering
  • Extensible: renderers, image loaders and code highlighters are extension points. Custom extensions

Packages

All five packages are released together under the same version.

Package Adds Enable with
MarkView.Avalonia The MarkdownViewer control and its theme
MarkView.Avalonia.SyntaxHighlighting TextMate syntax highlighting of code blocks UseTextMateHighlighting()
MarkView.Avalonia.Svg SVG images UseSvg()
MarkView.Avalonia.Mermaid Mermaid diagrams, rendered in .NET UseMermaid()
MarkView.Avalonia.Math LaTeX math UseMath()

Enable an extension on one viewer (viewer.UseMermaid()), or on every viewer of the application at startup (MarkdownViewerDefaults.Extensions.AddMermaid()). See Choosing packages.

Versioning

Versions read 12.MAJOR.MINOR: 12 is the Avalonia version, the second number changes with breaking changes, and the third with features and fixes. To receive only compatible updates, use a floating version such as 12.4.*. See Versioning and, when upgrading from 12.3, Upgrading to 12.4.

Contributing

Issues and pull requests are welcome. The demo app shows every feature, and CLAUDE.md describes how to build and test the repository and how the code is organised.

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 (5)

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

Package Downloads
MarkView.Avalonia.SyntaxHighlighting

TextMate syntax highlighting extension for MarkView.Avalonia, the markdown viewer for Avalonia UI 12.

MarkView.Avalonia.Mermaid

Mermaid diagram rendering extension for MarkView.Avalonia, the markdown viewer for Avalonia UI 12.

MarkView.Avalonia.Svg

SVG image rendering extension for MarkView.Avalonia, the markdown viewer for Avalonia UI 12.

Niddy.Avalonia

Niddy: my personal .NET utilities. Avalonia UI helpers: app hosting, dialogs (window and overlay, including color, markdown with Mermaid diagrams and math, table and web), a page system with menus and keyboard shortcuts, toasts with actions and progress, paged and sortable data tables, window and layout memory, a global exception handler, converters, responsive layout, theming and file pickers.

MarkView.Avalonia.Math

LaTeX math rendering extension for MarkView.Avalonia, the markdown viewer for Avalonia UI 12.

GitHub repositories

This package is not used by any popular GitHub repositories.