Huskui.Avalonia.Markdown
1.6.0
dotnet add package Huskui.Avalonia.Markdown --version 1.6.0
NuGet\Install-Package Huskui.Avalonia.Markdown -Version 1.6.0
<PackageReference Include="Huskui.Avalonia.Markdown" Version="1.6.0" />
<PackageVersion Include="Huskui.Avalonia.Markdown" Version="1.6.0" />
<PackageReference Include="Huskui.Avalonia.Markdown" />
paket add Huskui.Avalonia.Markdown --version 1.6.0
#r "nuget: Huskui.Avalonia.Markdown, 1.6.0"
#:package Huskui.Avalonia.Markdown@1.6.0
#addin nuget:?package=Huskui.Avalonia.Markdown&version=1.6.0
#tool nuget:?package=Huskui.Avalonia.Markdown&version=1.6.0
Huskui.Avalonia.Markdown
A Markdown rendering extension for Huskui.Avalonia that converts Markdown text into native Avalonia control trees using Markdig.
Relationship to Huskui.Avalonia
Huskui.Avalonia.Markdown is an extension library for Huskui.Avalonia — it cannot be used standalone.
- Prerequisite: You must install
Huskui.Avaloniaand useHuskuiThemein your application - Auto-loading: Once the assembly is loaded,
HuskuiThemeautomatically merges the extension's theme resources via the[HuskuiExtension]mechanism — no manual style includes needed - Shared namespace: Controls are mapped to
https://github.com/d3ara1n/Huskui.Avalonia, using the samehusk:XAML prefix as the core library
Installation
dotnet add package Huskui.Avalonia
dotnet add package Huskui.Avalonia.Markdown
Usage
Basic
<husk:MarkdownViewer Markdown="{Binding MarkdownText}" />
Properties
| Property | Type | Default | Description |
|---|---|---|---|
Markdown |
string? |
null |
Raw Markdown text to render |
Spacing |
double |
4 |
Spacing between block-level elements |
XAML Example
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:husk="https://github.com/d3ara1n/Huskui.Avalonia"
x:Class="YourApp.MarkdownPage">
<husk:MarkdownViewer
Spacing="8"
Markdown="# Hello World

This is **bold** and *italic* text.

- Item 1
- Item 2

```csharp
Console.WriteLine("Hello");
```" />
</UserControl>
C# Example
var viewer = new MarkdownViewer();
viewer.Markdown = """
# Hello World
This is **bold** and *italic* text.
- Item 1
- Item 2
```csharp
Console.WriteLine("Hello");
```
""";
Text Selection
Headings, paragraphs, list item text, and table cells support selection and copying within each text block. Link labels remain non-selectable to preserve button interaction. Embedded controls such as links and inline code are represented by object placeholders when copied as part of a surrounding selection.
Styling
MarkdownViewer generates bare controls with semantic CSS classes but no built-in visual styles, with tables rendered through the fully-themed TableView control. The extension ships a default theme bundle that is auto-loaded by HuskuiTheme, but you can override or extend styles by targeting the generated class names.
The class naming convention is Control.Markdown.Variant. Here are some examples:
| Selector | Target |
|---|---|
:is(TextBlock).Markdown.Heading1 |
Level-1 heading |
:is(TextBlock).Markdown.Heading2 |
Level-2 heading |
:is(TextBlock).Markdown.Paragraph |
Paragraph block |
Run.Markdown.Literal.Bold |
Bold text run |
Run.Markdown.Literal.Italic |
Italic text run |
Run.Markdown.Literal.Deleted |
Strikethrough text run |
Run.Markdown.Literal.Highlighted |
Highlighted text run (==text==) |
Run.Markdown.Literal.Subscripted |
Subscript text run |
Run.Markdown.Literal.Superscripted |
Superscript text run |
DockPanel.Markdown.List.Item |
List item container |
husk:CodeViewer.Markdown.Code |
Fenced code block |
husk:InfoBar.Markdown.Quote |
Blockquote |
husk:Divider.Markdown.Rule |
Horizontal rule |
TableView.Markdown |
Markdown table |
TableView.Markdown.Headerless |
Headerless table (grid tables without a header row) |
Custom Style Example
<Styles>
<Style Selector=":is(TextBlock).Markdown.Heading1">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="28" />
</Style>
<Style Selector="husk|InfoBar.Markdown.Quote">
<Setter Property="BorderBrush" Value="Blue" />
<Setter Property="BorderThickness" Value="3,0,0,0" />
<Setter Property="Padding" Value="12,8" />
</Style>
<Style Selector="husk|CodeViewer.Markdown.Code">
<Setter Property="Background" Value="#1e1e1e" />
<Setter Property="Foreground" Value="#d4d4d4" />
</Style>
<Style Selector="DockPanel.Markdown.List.Item">
<Setter Property="Margin" Value="16,0,0,0" />
</Style>
</Styles>
Markdown Support
Supported
| Syntax | Example | Notes |
|---|---|---|
| Headings | # H1 ~ ###### H6 |
6 levels, mapped to font size resources |
| Paragraphs | plain text | Supports inline formatting |
| Bold | **bold** |
|
| Italic | *italic* |
|
~~text~~ |
||
| ++Inserted++ | ++text++ |
EmphasisExtras extension |
| ==Highlighted== | ==text== |
EmphasisExtras extension |
| Subscript | ~text~ |
EmphasisExtras extension |
| Superscript | ^text^ |
EmphasisExtras extension |
Inline code |
`code` |
Rendered as HighlightInline |
| Code blocks | ```lang |
Rendered as CodeViewer |
| Unordered lists | - item |
Nested; bullet varies by depth (●○■□) |
| Ordered lists | 1. item |
Nested |
| Task lists | - [x] done |
Rendered as CheckBox |
| Links | [text](url) |
Rendered as HyperlinkButton |
| Images |  |
Async loading via AsyncImageLoader |
| Blockquotes | > quote |
Rendered as InfoBar |
| Horizontal rules | --- |
Rendered as Divider |
| Auto-links | <https://example.com> |
AutoLinks extension |
| Tables | \| a \| b \| |
Pipe & grid tables, per-column alignment, rendered via TableView |
Not Yet Supported
| Syntax | Notes |
|---|---|
| Math | No math rendering extension integrated |
| Footnotes | Markdig footnotes extension not enabled |
| Syntax highlighting | Code blocks use CodeViewer as plain text — no syntax coloring |
Dependencies
- Huskui.Avalonia — Core control library
- Huskui.Avalonia.Code — Code block rendering (CodeViewer)
- Markdig — Markdown parsing
- AsyncImageLoader.Avalonia — Async image loading
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. |
-
net10.0
- AsyncImageLoader.Avalonia (>= 3.8.0)
- Huskui.Avalonia (>= 2.1.3)
- Huskui.Avalonia.Code (>= 1.6.0)
- Markdig (>= 1.3.2)
-
net8.0
- AsyncImageLoader.Avalonia (>= 3.8.0)
- Huskui.Avalonia (>= 2.1.3)
- Huskui.Avalonia.Code (>= 1.6.0)
- Markdig (>= 1.3.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Huskui.Avalonia.Markdown:
| Repository | Stars |
|---|---|
|
d3ara1n/Polymerium
🐿️ A metadata-driven Minecraft launcher for reproducible, storage-efficient instances and a built-in CLI with MCP mode for AI agents.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.6.0 | 139 | 10/6/2026 |
| 1.5.1 | 278 | 8/19/2026 |
| 1.5.0 | 137 | 8/16/2026 |
| 1.4.0 | 163 | 7/24/2026 |
| 1.3.4 | 163 | 7/11/2026 |
| 1.3.3 | 131 | 7/11/2026 |
| 1.3.2 | 143 | 7/10/2026 |
| 1.3.1 | 135 | 7/9/2026 |
| 1.3.0 | 135 | 7/6/2026 |
| 1.2.2 | 163 | 6/20/2026 |
| 1.2.1 | 155 | 6/15/2026 |
| 1.2.0 | 199 | 5/26/2026 |
| 1.1.3 | 721 | 5/21/2026 |
| 1.1.2 | 199 | 5/7/2026 |
| 1.1.1 | 147 | 5/5/2026 |
| 1.1.0 | 158 | 5/3/2026 |
| 1.0.1 | 133 | 4/22/2026 |
| 1.0.0 | 144 | 4/22/2026 |
| 0.17.0 | 138 | 4/21/2026 |
| 0.16.1 | 131 | 4/17/2026 |
# Changelog
All notable changes to this project will be documented in this file.
## [Huskui.Avalonia.Markdown@v1.6.0] - 2026-10-06
### 🚀 Features
- *(Markdown)* Support text selection within blocks
<!-- generated by git-cliff -->