Skip to main content

Fast Markdown previewer with GitHub-dark theme, sidebar TOC, multi-file tabs, and .openmd.css theming

Project description

openmd

Markdown viewer for humans — not AI models.

I got tired of reading raw Markdown with less or opening VS Code/Cursor just to see it nicely rendered. So I built openmd.

Run openmd *.md (or any Markdown files) from the shell and a window pops up instantly — the shell prompt returns immediately, no blocking, no & needed.

Python 3.8+ License: MIT Platform: macOS / Linux PyPI version

GitHub: RufusLin/openmd

Warning - Lazy Maintainer: Yeah, not a fan of reading PRs, but will pay attention to issues to fix bugs. Feel free to fork, but remember to give credit, please.🙏🏻

X: @rufuslinjapan


What it looks like

openmd with multiple tabs and TOC sidebar Mermaid diagram and KaTeX math rendered

(Click any image to enlarge)


Usage

# Open a single file
openmd README.md

# Open multiple files (each in its own tab)
openmd doc1.md doc2.md doc3.md

# No arguments — interactive picker (choose from .md files in current directory)
openmd

# Glob expansion
openmd docs/*.md

Shell function (optional, for quick access)

Add to your ~/.zshrc or ~/.bashrc:

openmd() { "$HOME/lab/openmd/openmd.py" "$@" 2>&1 }

Or if installed via pip, the openmd command is already in your PATH.

Remote preview via SSH (optional)

remotemd() {
    local remote_path="$1"
    local filename=$(basename "$remote_path")
    local tmp_file="/tmp/remote_preview_${filename}.md"
    scp "home:$remote_path" "$tmp_file" && openmd "$tmp_file"
}

Features

  • Instant launch — the shell prompt returns immediately; openmd runs as a fully detached GUI app (no & needed, no blocking)
  • GitHub-dark theme by default — comfortable reading in low-light environments
  • 16 built-in themes — dark and light, switch instantly via the swatch bar at the bottom of the sidebar; fully customizable via .openmd.css
  • Live reload — the preview updates instantly when the file is saved; no manual refresh needed
  • Mermaid diagrams — fenced ```mermaid blocks render automatically via CDN
  • KaTeX math — inline $…$ and display $$…$$ expressions render out of the box
  • Collapsible sidebar TOC — hierarchical (H1 → H2 → H3); click or press Return to jump to any heading
  • Multi-file tabs — pass multiple .md files (even *.md globs) and each opens in its own tab, max 6
  • Interactive file picker — run with no arguments and choose from .md files in the current directory via a curses-based picker
  • Remote image caching — remote images in your Markdown are downloaded to a local temp cache so they render correctly in the Qt WebEngine view
  • External link handling — clicking any http/https link opens it in your default browser; the preview window never navigates away
  • Update notifications — on startup, openmd quietly checks PyPI (at most once every 6 hours) and shows a non-intrusive popup if a newer version is available
  • Version in title bar — the window title shows the running version for quick reference
  • Keyboard shortcutsEsc closes the window; arrow keys and Return navigate the sidebar

Theming with .openmd.css

openmd ships with 16 built-in themes (8 dark, 8 light) selectable from the swatch bar. To customize further, create a .openmd.css file — it is appended after the built-in CSS so any rule you write overrides the default via normal CSS cascade.

Lookup order (first match wins):

Priority Location
1 Current working directory (./)
2 openmd install directory
3 Home directory (~/)

To switch themes programmatically, add body.theme-yourname { ... } blocks to your .openmd.css. The swatch bar automatically discovers and displays any themes defined there.


Requirements

Note: Mermaid and KaTeX require an internet connection to load from CDN.


Installation

pip (recommended)

pip install openmd

After installing, the openmd command is available in your shell.

From source

git clone https://github.com/RufusLin/openmd.git
cd openmd
pip install -e .

Keyboard shortcuts

Key Action
Esc Close the preview window
/ Navigate the sidebar TOC
Return Jump to selected heading

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openmd-1.4.18.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openmd-1.4.18-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file openmd-1.4.18.tar.gz.

File metadata

  • Download URL: openmd-1.4.18.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for openmd-1.4.18.tar.gz
Algorithm Hash digest
SHA256 f5b4e80e59d72b4f09c894f8fd59632aaa5eda560c62c178073deb39dc976ef5
MD5 87630da7b70e070ab91b4a2b72929030
BLAKE2b-256 9707153343b5154281b06735634dfdb15c414ac7932cbe56c14f1b389a53f80e

See more details on using hashes here.

File details

Details for the file openmd-1.4.18-py3-none-any.whl.

File metadata

  • Download URL: openmd-1.4.18-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for openmd-1.4.18-py3-none-any.whl
Algorithm Hash digest
SHA256 35f6cc3d3358befca452b4eab63cdbd74ceb122f941737a385c6cee4c1b8bea2
MD5 6db37c62b468d3590fc91244bf742c2f
BLAKE2b-256 bbad9dd4eede4cd4c64c62a8a2fc5663b82160dcac3c3e5f9e03e4821483bbd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page