MarkView.Avalonia.Svg
12.0.3
dotnet add package MarkView.Avalonia.Svg --version 12.0.3
NuGet\Install-Package MarkView.Avalonia.Svg -Version 12.0.3
<PackageReference Include="MarkView.Avalonia.Svg" Version="12.0.3" />
<PackageVersion Include="MarkView.Avalonia.Svg" Version="12.0.3" />
<PackageReference Include="MarkView.Avalonia.Svg" />
paket add MarkView.Avalonia.Svg --version 12.0.3
#r "nuget: MarkView.Avalonia.Svg, 12.0.3"
#:package MarkView.Avalonia.Svg@12.0.3
#addin nuget:?package=MarkView.Avalonia.Svg&version=12.0.3
#tool nuget:?package=MarkView.Avalonia.Svg&version=12.0.3
MarkView.Avalonia.Svg
SVG image rendering extension for MarkView.Avalonia. Renders SVG files referenced in markdown images using Svg.Skia — the same backend that Avalonia itself uses for vector icons.
Installation
dotnet add package MarkView.Avalonia.Svg
Quick Start
Call UseSvg() before setting Markdown:
var viewer = new MarkdownViewer();
viewer.UseSvg();
viewer.Markdown = markdownText;
Or activate globally at application startup:
// App.axaml.cs
MarkdownViewerDefaults.Extensions.AddSvg();
Markdown syntax is unchanged — standard image syntax with an .svg URL:



Supported URL Formats
| URL form | Handled by |
|---|---|
https://example.com/icon.svg |
HTTP download, SVG parse |
relative/path/icon.svg (with BaseUri set) |
Resolved first; handled if the resolved URL is supported by SvgImageLoader |
Any https:// / http:// URL |
Attempted speculatively; returns null if response is not valid SVG, letting the bitmap fallback load it |
data:image/svg+xml;base64,… |
Base64 decode, SVG parse |
data:image/svg+xml,… |
URL-decode, SVG parse |
data:image/png;base64,… |
Not handled — passed to the next loader |
The speculative HTTP/HTTPS rule means badge services like shields.io that return SVG without a .svg extension are handled transparently.
When using relative image paths, set MarkdownViewer.BaseUri to an HTTP/HTTPS base URL if you want this extension to fetch and parse those images as SVG.
How It Works
UseSvg() registers a SvgExtension which inserts SvgImageLoader at index 0 of renderer.ImageLoaders. Being first in the chain, it gets first pick on every image URL. If CanLoad returns false (e.g. a data:image/png URI), or if LoadAsync returns null (e.g. the HTTP response is not valid SVG), the next loader in the chain is tried.
Loading is asynchronous. The Image control is placed in the visual tree immediately; the SVG source is set once the download and parse complete. SvgImage is an AvaloniaObject and is created on the UI thread via Dispatcher.UIThread.
Writing a Custom Image Loader
Implement IImageLoader from the core package to handle any image source:
using MarkView.Avalonia.Extensions;
public class MyLoader : IImageLoader
{
public bool CanLoad(string url) => url.StartsWith("myscheme://");
public async Task<IImage?> LoadAsync(string url, CancellationToken ct = default)
{
// Return null to fall through to the next loader
var bitmap = await FetchBitmapAsync(url, ct);
return bitmap;
}
}
// Insert at 0 to take priority, or Add() to run after built-in loaders
renderer.ImageLoaders.Insert(0, new MyLoader());
Or register via a IMarkViewExtension:
public class MyExtension : IMarkViewExtension
{
public void Register(AvaloniaRenderer renderer)
=> renderer.ImageLoaders.Insert(0, new MyLoader());
}
viewer.Extensions.Add(new MyExtension());
License
MIT © Nicolas Musset
| Product | Versions 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. |
-
net10.0
- MarkView.Avalonia (>= 12.0.3)
- Svg.Controls.Skia.Avalonia (>= 12.0.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 12.0.3 | 44 | 5/9/2026 |
| 12.0.2 | 114 | 4/21/2026 |
| 12.0.1 | 94 | 4/16/2026 |
| 12.0.1-beta.3 | 56 | 4/15/2026 |
| 12.0.1-beta.2 | 53 | 4/10/2026 |