Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MD Editor

A local markdown editor for Windows. Source on the left, live preview on the right, and a dark theme that stays out of the way.

It's a Flask server and a pywebview window — no Electron, no network access, no accounts.

Features

  • Live preview with full CommonMark and GitHub-flavored markdown
  • Syntax highlighting for JavaScript/TypeScript, Python, CSS, JSON and shell
  • Tables, task lists, footnotes, definition lists, and YAML front matter
  • Registers as an "Open with" handler for .md files
  • Opening a second file reuses the window that's already open
  • Autosave, with edits to disk-backed files written straight back
  • Recently-closed list, so a closed document can be restored

Install

Grab the latest build from Releases, unpack it, and run MD_Editor.exe. Keep _internal next to the exe — it holds the Python runtime and the front-end files.

Running from source

pip install flask pywebview
python main.py

Python 3.10 or newer.

Building

pip install pyinstaller
pyinstaller MD_Editor.spec

The result is dist\MD_Editor\MD_Editor.exe.

This is a onedir build on purpose. A onefile build unpacks its whole archive into %TEMP% on every launch, and the virus scanner re-reads those fresh files each time, which made startup take four to seven seconds instead of about 1.4.

Note that build\MD_Editor\MD_Editor.exe also appears during a build. That one is a bootloader stub with no _internal beside it and will not run — always launch the copy under dist\.

How it works

main.py starts the Flask server on port 5177, then opens a pywebview window pointing at it. If that port is already serving another MD Editor, the new launch hands over its file and skips starting a second server.

server.py serves the editor and exposes a small API: /api/startup-file for the file the app was opened with, /api/open-file for handoff between instances, and /api/save-file for writing edits back to disk.

The front end is a single mdeditor.html. Markdown is rendered by markdown-it, bundled into vendor.js.

Where documents live

A .md opened from disk is tied to its path and saves back to that file.

A document created with "+ New" lives only in the editor's local storage and has no file on disk. There's no Save As yet, so treat those as scratch notes.

Markdown support

CommonMark and GFM, via markdown-it, plus footnotes, definition lists, abbreviations, subscript, superscript, ++inserted++, ==highlighted==, and :emoji: shortcodes. YAML front matter is recognised and hidden.

Raw HTML is escaped rather than rendered. That's a deliberate choice: the save endpoint writes to any path it's given, so letting a markdown file inject markup would turn a downloaded note into arbitrary file access.

Regenerating vendor.js

vendor.js is a bundle of markdown-it and its plugins. Edit vendor.entry.js, never vendor.js. The exact npm and esbuild commands are in the header of vendor.entry.js.

License

MIT. See LICENSE.

About

A fast, offline markdown editor for Windows. Live side-by-side preview, full CommonMark support, and syntax-highlighted code blocks — Flask and pywebview in a native window.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages