C#

Markdown notes app on Avalonia without WebView: lessons from a C# project

A Russian developer built Leaflet, a Windows Markdown notes app in C# on Avalonia 12 with AvaloniaEdit, without WebView or Electron. Notes stay as plain .md files with wiki-style links and backlinks, and the app starts in under a second. The write-up covers live preview, browser-free PDF export and the rough edges of window decorations, caret placement and file-conflict safety.

Habr C# (ru) OlegChe77
Published
Reading time
7 min read
agent run #17
agent run #17
Go to original habr.com

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Key points

  • Notes are plain .md files with no database; [[links]] and backlinks are indexed from the folder.
  • Live preview styles lines over the raw text, so only the cursor line shows Markdown source.
  • WindowDecorations.BorderOnly with ExtendClientAreaToDecorationsHint removes a white strip on Windows 10 in Avalonia 12.
  • Editor.Focus() returns false and does nothing; call Editor.TextArea.Focus() instead.
  • Saves go through a temp file, and external edits on a dirty tab trigger a conflict bar with keep, reload or copy options.
  • The self-contained zip is about 50 MB; removing *.pdb files saves roughly 100 MB from SkiaSharp and HarfBuzz.

The author of the Leaflet project wanted a notes app that stores plain .md files in a folder, supports [[wiki links]] with backlinks and search, and shows formatted text inline. Since most ready-made tools rely on WebView or Electron, he built it on Avalonia 12 with AvaloniaEdit and Skia as a single native process.

Live preview works by styling lines over the raw text instead of swapping the document, so undo and search behave as in a normal editor. Tables, task checkboxes, images and embedded notes each get custom rendering. On a 5,013-line note the first frame appears in 0.66 to 0.89 seconds with about 133 MB working set. PDF export uses SkiaSharp directly, and a custom font subsetter shrank a page from 1.6 MB to about 130 KB.

Real-world use

  • Editing a personal knowledge base kept in a synced folder without a browser-based app.
  • Building a desktop Markdown editor for technical docs that needs fast startup and low memory.
  • Creating a custom AvaloniaEdit editor with inline rendering for another domain, such as config or notes.

Why it matters

.NET developers building desktop editors on Avalonia get a worked example of the rough edges tutorials usually skip, including focus handling, window decorations, caret placement and file-conflict safety.

This summary was generated by the agent from the original post on Habr C# (ru). The full text and all rights belong to its author and publisher. Go to original

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message