A lightweight, feature-rich Markdown reader and editor built with Avalonia UI and .NET 8.
- CommonMark + GitHub Flavored Markdown (GFM)
- All basic syntax: headings, bold, italic, strikethrough
- Lists (ordered, unordered, nested)
- Links and images
- Code blocks with syntax highlighting
- Tables with alignment
- Task lists (checkboxes)
- Blockquotes
- Horizontal rules
- Footnotes
- Definition lists
- Abbreviations
- Emoji support (:smile: :heart:)
- Math expressions (LaTeX/KaTeX)
- Mermaid diagrams (flowcharts, sequence, class, etc.)
- HTML embedding
- Syntax-highlighted editor using AvaloniaEdit with TextMate
- Live preview with debounced rendering (300ms)
- Split-pane layout with resizable splitter
- Line numbers
- Word and character count
- Auto-save support
- Keyboard shortcuts for common operations
- Create new documents (Ctrl+N)
- Open markdown files (Ctrl+O)
- Save and Save As (Ctrl+S, Ctrl+Shift+S)
- Export to HTML and PDF
- Recent files tracking
- Multi-tab document management
- 11 Beautiful Themes including Glass Light/Dark, Acrylic Light/Dark, Pure Dark, Ocean Breeze, Forest Canopy, Sunset Glow, Midnight Purple, Rose Gold, and Arctic Mint
- Clean, modern interface with acrylic blur effects
- Read mode for distraction-free reading
- Zoom controls for preview
- Status bar with document stats
- Right-click context menu with copy options
- Beautiful typography and styling
Ctrl+N- New fileCtrl+O- Open fileCtrl+S- SaveCtrl+Shift+S- Save AsAlt+F4- Exit
Ctrl+B- Insert boldCtrl+I- Insert italicCtrl+K- Insert linkCtrl+Shift+I- Insert imageCtrl+Shift+C- Insert code blockCtrl+T- Insert table
F6- Toggle read modeCtrl+Shift+H- Copy HTML to clipboardCtrl+W- Close active tabCtrl+Shift+W- Close all tabsCtrl+Tab- Next tabCtrl+Shift+Tab- Previous tab
- .NET 8 - Modern, cross-platform framework
- Avalonia UI 11.3 - Cross-platform UI framework
- Markdig - Fast, extensible Markdown processor
- AvaloniaEdit - Syntax-highlighted text editor
- CommunityToolkit.Mvvm - MVVM helpers and code generation
MarkdownViewer/
├── Models/ # Data models
├── ViewModels/ # MVVM view models
├── Views/ # Avalonia XAML views
├── Services/ # Business logic services
└── Assets/ # Resources and styles
- MVVM - Model-View-ViewModel architecture
- Dependency Injection - Microsoft.Extensions.DependencyInjection
- Service Layer - Separation of concerns
- Observable Pattern - CommunityToolkit.Mvvm
- .NET 8.0 SDK or later
- Any OS: Windows, macOS, or Linux
# Clone the repository
git clone <repository-url>
cd Markdown_viewer
# Restore dependencies
dotnet restore
# Build the project
dotnet build
# Run the application
dotnet run# Build in Release mode
dotnet build -c Release
# Publish for your platform
dotnet publish -c Release -r win-x64 --self-contained
dotnet publish -c Release -r linux-x64 --self-contained
dotnet publish -c Release -r osx-x64 --self-contained- Headings (H1-H6)
- Paragraphs and line breaks
- Bold, italic, strikethrough
- Lists (ordered, unordered, nested)
- Links and images
- Code (inline and blocks)
- Blockquotes
- Horizontal rules
- Tables
- Task lists
- Footnotes
- Definition lists
- Abbreviations
- Subscript and superscript
- Syntax highlighting in code blocks
- Autolinks
- Strikethrough
- Tables
- Task lists
- Emoji support
- Math expressions (LaTeX/KaTeX)
- Mermaid diagrams
- HTML embedding
- Front matter (YAML)
-
Image Handling: Images must be accessible via file path or URL.
-
Text Selection: Cross-element text selection in preview is limited. Use the right-click context menu to copy markdown or plain text.
- Custom CSS theme editor
- Advanced find and replace
- Outline/Table of contents navigation
- Git integration for version control
- Spell checker
- Custom keyboard shortcuts configuration
This project is open source and available under the MIT License.
Built with:
To make .md files open with this app when double-clicked on Windows, you can register a file association. There are two common ways:
-
During installer/publish: add a file-association entry in your installer (recommended).
-
Per-user registration script: run
scripts/register-md-association.ps1with the path to your installed exe. This registers entries under HKCU so “Open with” works and lets you set ViewMD as default in Windows Settings.
pwsh -ExecutionPolicy Bypass -File .\scripts\register-md-association.ps1 -ExePath "C:\\Program Files\\ViewMD\\MarkdownViewer.exe" -SetDefault- Manual registry merge: a
.regfile is provided indocs/associate-md.regas an example. Edit the executable path in that file to point to your installedMarkdownViewer.exe, then double-click the.regfile to merge it into the registry (requires appropriate permissions).
Example usage (for testing):
- Build and publish the app for Windows (self-contained recommended):
dotnet publish -c Release -r win-x64 --self-contained -o publish\win-x64-
Edit
docs\associate-md.regto point to the published executable path (or copy the EXE intoC:\Program Files\\ViewMD\\). -
Double-click the
.regfile to merge it. After that, double-clicking a.mdfile should start ViewMD and open the file. -
Alternatively for testing without registry edits, you can run the app with a file path argument:
dotnet run -- "C:\path\to\example.md"
# or run the published exe directly:
publish\win-x64\MarkdownViewer.exe "C:\path\to\example.md"To undo the per-user registration:
pwsh -ExecutionPolicy Bypass -File .\scripts\unregister-md-association.ps1Security: editing the registry affects your system configuration — only run scripts/merge .reg files you trust. Installer-based registration is safer for end users.
An Inno Setup script is provided at installer/inno-setup.iss which:
- Copies the published binaries to Program Files
- Registers
.mdfile associations (optional task during install) - Adds the app to "Open with"
Steps:
- Publish your app to
publish\win-x64:dotnet publish -c Release -r win-x64 --self-contained -o publish\win-x64 MarkdownViewer.csproj
- Open
installer\inno-setup.issin Inno Setup and build the installer. - Run the generated
MarkdownViewer-Setup.exe. Choose the file association task if desired.
An MSIX AppxManifest.xml template is under installer/ with file type associations for .md, .markdown, and .txt, and full-trust desktop process enabled.
Notes:
- You’ll need to sign the package and supply required assets (icons) referenced in the manifest.
- The app runs as a full-trust desktop app; ensure the executable path in the manifest matches your package layout.
- Generate stub icons (optional) and validate assets:
pwsh -ExecutionPolicy Bypass -File .\scripts\advanced\create-stub-icons.ps1
pwsh -ExecutionPolicy Bypass -File .\scripts\advanced\check-msix-assets.ps1- Build and create a signed MSIX (optional signing):
# Unsigned (for quick local testing, may require sideloading)
pwsh -ExecutionPolicy Bypass -File .\scripts\advanced\package-msix.ps1 -Configuration Release -Runtime win-x64 -MsixPath ViewMD.msix
# Signed (provide your PFX and password securely)
$sec = Read-Host -AsSecureString "PFX password"
pwsh -ExecutionPolicy Bypass -File .\scripts\advanced\package-msix.ps1 -Configuration Release -Runtime win-x64 -MsixPath ViewMD.msix -PfxPath ".\signing-test.pfx" -PfxPassword $sec- Install the MSIX
- Double-click the
.msixfile. - If signed with a self-signed cert, install the cert to CurrentUser\Trusted People first.
- Ensure sideloading is enabled if required.
Troubleshooting
- Icons missing: run the asset check script and ensure all listed files exist under
Assets/. - Default app choice: Windows manages default apps; your file associations appear, but users may need to confirm defaults in Settings.
- Packaging tools: Make sure
MakeAppx.exeandsigntool.exeare available (Windows SDK).
-
Run the app for debugging:
pwsh -ExecutionPolicy Bypass -File .\scripts\dev-run.ps1
Pass files to open:
pwsh -ExecutionPolicy Bypass -File .\scripts\dev-run.ps1 -- "C:\\Docs\\README.md" "C:\\Notes\\todo.txt"
-
Package for Microsoft Store (.msixbundle):
pwsh -ExecutionPolicy Bypass -File .\scripts\package-store.ps1 -PfxPath .\certs\ViewMD.pfx
You will be prompted for the PFX password (used only for local/sideload testing; the Store re-signs). Artifacts:
ViewMD.msix(x64),ViewMD-arm64.msix,ViewMD.msixbundle. -
Install locally (sideload):
pwsh -ExecutionPolicy Bypass -File .\scripts\install-local.ps1
If you see 0x800B010A, see
docs/LOCAL-SIDELOAD.md.