Notepad.Avalonia 0.3.1

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

Notepad.Avalonia

Two Avalonia UI controls for a single markdown note:

  • NoteEditor — editable source view with inline image pasting.
  • MarkdownViewer — read-only rendered view with full markdown support, free text selection and copy.

Features

NoteEditor

  • Markdown text editing for a single note
  • Inline image support (paste from clipboard or programmatic insert)
  • Full undo/redo with intelligent coalescing
  • Text selection (single and multi-line); dropped on lost focus like Avalonia's TextBox, with ClearSelectionOnLostFocus / InactiveSelectionBrush to opt out
  • Caret shown only while the control has focus
  • Clipboard integration (text + images)
  • Text wrapping
  • Light/Dark theme support
  • MVVM-ready via MarkdownText property binding
  • Optimized for large documents (FormattedText caching, incremental layout, viewport culling)

MarkdownViewer

Renders markdown instead of showing its source. Read-only, but every rendered character can be selected and copied.

  • Blocks: ATX and setext headings, paragraphs, thematic breaks, fenced and indented code blocks, nested blockquotes, nested ordered/unordered/task lists, GFM pipe tables (with column alignment)
  • Inline: **bold**, *italic*, ***both***, ~~strikethrough~~, `code`, links (inline, reference and autolinks), images, hard line breaks, backslash escapes and HTML entities
  • Selection: drag, Shift+click, double-click (word), triple-click (line), Ctrl+A, auto-scroll while dragging past the edge. The selection is dropped on lost focus (like Avalonia's TextBox); set ClearSelectionOnLostFocus="False" to keep it — it is then drawn with InactiveSelectionBrush
  • Copy: Ctrl+C / context menu — copies the rendered text, not the markup
  • Links: LinkClicked event, opens http/https/mailto in the browser by default
  • Built-in scrollbar with viewport virtualization and light/dark themes

Quick Start

var editor = new NoteEditor
{
    DefaultFont = new FontFamily("Segoe UI"),
    DefaultFontSize = 15,
    MarkdownText = "Hello world\nSecond line with ![alt](imageKey)"
};
var viewer = new MarkdownViewer
{
    DefaultFontSize = 15,
    MarkdownText = "# Title\n\nSome **bold** text and a [link](https://example.com)."
};

viewer.SelectAll();
var text = viewer.SelectedText;   // rendered text, without the markup

Scrolling

Both controls scroll their own content. Give them a finite height (a DockPanel/Grid cell) and they show a scrollbar and render only the visible blocks.

Given an unbounded height — the usual case being an outer ScrollViewer — they instead report their full content height and render every block, so the outer container does the scrolling. That is the supported way to stack several notes in one scroll area, at the cost of the built-in scrollbar and virtualization; prefer a finite height for a single long document.

Either way, clicking to select never makes an enclosing ScrollViewer jump, while Tab navigation still scrolls the control into view.

One thing the unbounded mode does not do: dragging a selection past the top or bottom edge does not auto-scroll, because that is driven by the built-in scrollbar. Scroll the outer container yourself and Shift+click to extend, or give the control a finite height.

Copying from your own toolbar

CopySelection() (and NoteEditor.CopyToClipboard()) fall back to the whole document when nothing is selected. Since the selection is dropped on lost focus, a toolbar button that takes focus will silently turn "copy selection" into "copy everything". Either make the button non-focusable:

<Button Content="Copy" Focusable="False" Click="OnCopy" />

or keep the selection across focus changes with ClearSelectionOnLostFocus="False".

MVVM Usage

<notepad:NoteEditor MarkdownText="{Binding MarkdownText}"
                    Images="{Binding Images}" />

<notepad:MarkdownViewer MarkdownText="{Binding MarkdownText}"
                        Images="{Binding Images}" />
public class MyViewModel : INotifyPropertyChanged
{
    public string? MarkdownText { get; set; }
    public ObservableCollection<ImageEntry> Images { get; } = new();
}

Installation

dotnet add package Notepad.Avalonia

License

MIT

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

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
0.3.1 6 8/25/2026
0.3.0 12 8/25/2026
0.2.2 11 8/25/2026
0.2.1 32 8/25/2026
0.2.0 27 8/25/2026
0.1.4 248 6/23/2026
0.1.3 113 6/22/2026
0.1.2 118 6/21/2026
0.1.1 114 6/21/2026