Skip to content

roscodetech/markdown-viewer

Repository files navigation

Markdown Viewer

A small Windows utility that opens .md files in a native window and renders them the way GitHub does. Switch between Rendered, Raw, and Edit modes with one click. Edits save back to the original file.

  • GitHub-flavored Markdown (tables, task lists, strikethrough, footnotes, fenced code)
  • Pygments syntax highlighting
  • Light + dark themes (auto-detects system, toggleable)
  • Lives in a single Python file plus three asset files — no Electron, no bundle
  • Uses Edge WebView2 (already on Windows 11), so the window is light

Install

install.bat

Installs pywebview, markdown-it-py, mdit-py-plugins, linkify-it-py, and Pygments.

Make it the default .md handler

register.bat

Registers the viewer for .md, .markdown, .mdown, and .mkd under HKCU\Software\Classes (no admin required) and clears Windows' UserChoice override so double-click opens this app.

If Windows still opens .md with a different app:

  1. Right-click any .md file
  2. Open with → Choose another app
  3. Pick Markdown Viewer and tick Always use this app

To revert:

unregister.bat

Run manually

python viewer.py path\to\file.md

Keyboard shortcuts

Shortcut Action
Ctrl+1 Rendered view
Ctrl+2 Raw view
Ctrl+3 Edit view
Ctrl+S Save (in Edit mode)

Toolbar buttons: 📂 reveals the file in Explorer, 🌓 toggles theme.

Layout

markdown-viewer/
├── viewer.py            main app + pywebview bridge
├── requirements.txt
├── install.bat
├── register.bat         binds .md → this viewer (HKCU)
├── unregister.bat
└── assets/
    ├── github.css       GitHub markdown styles (light + dark)
    ├── app.css          toolbar, tabs, panes
    └── app.js           tab switching, save, theme

Notes

  • Registration is per-user (HKCU). No UAC prompt.
  • The viewer trusts the file content (html: false in markdown-it) — raw HTML in .md files is escaped, matching GitHub's default behaviour.
  • Edit mode preserves Unix line endings on save.

About

Lightweight Windows Markdown viewer — render .md files like GitHub on double-click.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors