Huskui.Avalonia.Markdown 1.2.0

dotnet add package Huskui.Avalonia.Markdown --version 1.2.0
                    
NuGet\Install-Package Huskui.Avalonia.Markdown -Version 1.2.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="Huskui.Avalonia.Markdown" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Huskui.Avalonia.Markdown" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Huskui.Avalonia.Markdown" />
                    
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 Huskui.Avalonia.Markdown --version 1.2.0
                    
#r "nuget: Huskui.Avalonia.Markdown, 1.2.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 Huskui.Avalonia.Markdown@1.2.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=Huskui.Avalonia.Markdown&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Huskui.Avalonia.Markdown&version=1.2.0
                    
Install as a Cake Tool

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.Avalonia and use HuskuiTheme in your application
  • Auto-loading: Once the assembly is loaded, HuskuiTheme automatically 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 same husk: 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&#x0a;&#x0a;This is **bold** and *italic* text.&#x0a;&#x0a;- Item 1&#x0a;- Item 2&#x0a;&#x0a;```csharp&#x0a;Console.WriteLine(&quot;Hello&quot;);&#x0a;```" />
</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");
    ```
    """;

Styling

MarkdownViewer generates bare controls with semantic CSS classes but no built-in visual styles. 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
TextBlock.Markdown.Heading1 Level-1 heading
TextBlock.Markdown.Heading2 Level-2 heading
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

Custom Style Example

<Styles>
    
    <Style Selector="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*
Strikethrough ~~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 ![alt](url) Async loading via AsyncImageLoader
Blockquotes > quote Rendered as InfoBar
Horizontal rules --- Rendered as Divider
Auto-links <https://example.com> AutoLinks extension

Not Yet Supported

Syntax Notes
Tables Markdig pipeline includes UsePipeTables / UseGridTables, but the renderer does not yet handle TableBlock
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

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.2.0 0 5/26/2026
1.1.3 40 5/21/2026
1.1.2 154 5/7/2026
1.1.1 108 5/5/2026
1.1.0 116 5/3/2026
1.0.1 101 4/22/2026
1.0.0 103 4/22/2026
0.17.0 92 4/21/2026
0.16.1 97 4/17/2026
0.16.0 107 4/16/2026
0.15.0 104 4/13/2026
0.14.2 98 4/9/2026
0.14.1 95 4/8/2026
0.14.0 108 4/2/2026

# Changelog

All notable changes to this project will be documented in this file.

## [unreleased]

### ⚙️ Miscellaneous Tasks

- Move props to .props

<!-- generated by git-cliff -->