Skip to content

shonescript/MarkdownViewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET Windows Linux macOS NativeAOT License: MIT


MarkdownViewer is a high-performance and cross-platform markdown viewer based on MewUI, built with .NET 10 and implemented in 100% C#, with support for Native AOT publishing.

Feature Highlights

  • Real-time Markdown rendering: 50 ms debounce
  • Supports supper long document
  • Supports export files as .png, .pdf, .docx, .html, all codes in the control, no more third party library referenced
  • Selectable preview: supports selection and copy via SelectableTextBlock
  • Table rendering: supports GFM tables and column alignment (left/center/right)
  • GitHub-style formatting: headings, bold, italic, strikethrough, code blocks, tables, task lists, blockquotes, indented code blocks, and more
  • Cross-platform: Windows, Linux, macOS
  • AOT publishing: can be compiled into a standalone executable with no .NET runtime required

Technical Implementation

  • Graphics backend: using MewUI.Skia and interops with Direct2D/Gdi/MewVG
  • Markdown parser: pure C# implementation with no external dependencies, optimized using ReadOnlySpan<char> and [MethodImpl(AggressiveInlining)]
  • GFM support: tables, task lists - [ ] / - [x], fenced code blocks, inline code, links, images, and more
  • Rendering control: custom MarkdownRenderer that transforms the AST into native MewUI controls

[!NOTE]

  • Relies on the latest MewUI project since 2026/06/03.
  • 😺 MewUI (https://github.com/aprillz/MewUI) is a cross-platform and lightweight, code-first .NET GUI framework aimed at NativeAOT.
  • Thanks to LumNote (https://github.com/LdotJdot/LumNote) for the high-performance Avalonia.Net editor. This project ported many codes from LumNote.MarkdownEditor.

Screenshots

markdownviewer

✨ Highlights

  • 📦 NativeAOT + trimming first
  • 🪶 Lightweight by design (small EXE, low memory footprint, fast first frame)
  • 🧩 Support MewUI Fluent C# markup (no XAML)

🚀 Quickstart


🧪 C# Markup at a Glance

  • Sample source

     var window = new Window()
         .Title("Hello MarkdownViewer for MewUI")
         .Size(520, 360)
         .Padding(12)
         .Content(
             new StackPanel()
                 .Spacing(8)
                 .Children(
                     new MarkdownViewer()
                         .Text("# Markdown texts ...")
    
                     new Button()
                         .Content("Quit")
                         .OnClick(() => Application.Quit())
                 )
         );
    
     Application.Run(window);

About

A high performance cross-platform markdown viewer for MewUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages