BlackSharp.UI.Avalonia.Markdown
1.0.1
Prefix Reserved
dotnet add package BlackSharp.UI.Avalonia.Markdown --version 1.0.1
NuGet\Install-Package BlackSharp.UI.Avalonia.Markdown -Version 1.0.1
<PackageReference Include="BlackSharp.UI.Avalonia.Markdown" Version="1.0.1" />
<PackageVersion Include="BlackSharp.UI.Avalonia.Markdown" Version="1.0.1" />
<PackageReference Include="BlackSharp.UI.Avalonia.Markdown" />
paket add BlackSharp.UI.Avalonia.Markdown --version 1.0.1
#r "nuget: BlackSharp.UI.Avalonia.Markdown, 1.0.1"
#:package BlackSharp.UI.Avalonia.Markdown@1.0.1
#addin nuget:?package=BlackSharp.UI.Avalonia.Markdown&version=1.0.1
#tool nuget:?package=BlackSharp.UI.Avalonia.Markdown&version=1.0.1
<h1 align="center">BlackSharp Markdown Viewer for Avalonia</h1>
<p align="center"> <img src="https://raw.githubusercontent.com/Blacktempel/BlackSharp.UI.Avalonia.Markdown/master/Assets/BlackSharpFull.png" width="128" height="128" alt="BlackSharp"/> </p>
Display Markdown release notes and documentation.
BlackSharp.UI.Avalonia.Markdown renders documents with native Avalonia controls.
This is not an official Avalonia release.
Key capabilities
MarkdownViewerrenders CommonMark, including headings, links, emphasis, lists, quotes, code blocks and imagesGitHubMarkdownVieweradds tables, task lists, strikethrough, autolinks, alerts, emoji shortcodes, footnotes and heading anchors- Relative link and image resolution, opt-in remote images and a custom image loader
The demo uses a shared text box to compare the same source in the GitHub Markdown and CommonMark previews.
Supported .NET versions
| .NET version | Support |
|---|---|
| .NET 8 | ✅ |
| .NET 10 | ✅ |
| .NET 11 | ✅ |
Requirements
Add the package to a local NuGet feed or reference the library project directly. Once the feed is configured, add the package to your application:
dotnet add package BlackSharp.UI.Avalonia.Markdown
Add the following namespace to the XAML root. No additional theme include is required:
xmlns:md="clr-namespace:BlackSharp.UI.Avalonia.Markdown.Controls;assembly=BlackSharp.UI.Avalonia.Markdown"
Examples
Read-only release notes
Both controls show only the preview by default:
<md:GitHubMarkdownViewer Text="{Binding ReleaseNotes, Mode=OneWay}" />
Source editor and live preview
Set ShowEditor="True" to display the source editor. The panes sit side by side
on wide layouts and stack on narrow layouts. Text binds two-way by default.
Set IsReadOnly="True" to prevent edits while keeping the editor visible and
its text selectable.
<md:GitHubMarkdownViewer Text="{Binding ReadmeText}"
ShowEditor="True"
EditorWatermark="Enter Markdown"
AllowRemoteImages="True"
BaseUri="https://github.com/Blacktempel/BlackSharp/blob/master/"
ImageBaseUri="https://raw.githubusercontent.com/Blacktempel/BlackSharp/master/"
LinkClicked="OnLinkClicked" />
Links, images and GitHub support
The preview handles local fragment navigation. HTTP, HTTPS and mail links raise
LinkClicked for the host to handle. The event argument is
MarkdownLinkClickedEventArgs. An ILogger from BlackSharp.Core receives
render and image errors, when configured.
Remote images are off by default. Enable them only if the document may trigger
HTTPS requests, or supply an ImageLoader with your own allowlist and image policy.
The built-in loader loads up to 16 raster images per preview, with a 4 MiB and
2 megapixel limit per image. Alt text remains visible when an image is not loaded.
A custom provider can add formats such as SVG.
Scripts, frames, arbitrary CSS and local-file destinations are not supported.
Projects and development
| Project | Purpose |
|---|---|
BlackSharp.UI.Avalonia.Markdown |
Reusable controls and NuGet package |
BlackSharp.UI.Avalonia.Markdown.Demo |
Interactive editor and preview comparison |
License
This repository is licensed under the Mozilla Public License 2.0.
Origin
Markdown parsing is provided by Markdig and HTML parsing by Html Agility Pack.
GitHub syntax follows the GFM specification and the GitHub formatting documentation.
Alert icons use GitHub's Primer Octicons under the MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. net11.0 is compatible. |
-
net10.0
- Avalonia (>= 12.1.6)
- BlackSharp.Core (>= 1.2.12)
- HtmlAgilityPack (>= 1.13.1)
- Markdig (>= 1.6.0)
- SkiaSharp (>= 3.119.4)
- SkiaSharp.NativeAssets.Linux (>= 3.119.4)
-
net11.0
- Avalonia (>= 12.1.6)
- BlackSharp.Core (>= 1.2.12)
- HtmlAgilityPack (>= 1.13.1)
- Markdig (>= 1.6.0)
- SkiaSharp (>= 3.119.4)
- SkiaSharp.NativeAssets.Linux (>= 3.119.4)
-
net8.0
- Avalonia (>= 12.1.6)
- BlackSharp.Core (>= 1.2.12)
- HtmlAgilityPack (>= 1.13.1)
- Markdig (>= 1.6.0)
- SkiaSharp (>= 3.119.4)
- SkiaSharp.NativeAssets.Linux (>= 3.119.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.