Skip to main content

📝 Markdown Viewer (GitHub-Style)

PyPI Homebrew License: MIT PyPI Downloads

A GitHub-style Markdown viewer for local docs, with file tree, search, and live reload.

A local Markdown documentation browser that:

  • Renders .md files with GitHub-flavored styles
  • Displays a recursive file/folder tree
  • Supports live plain-text filtering (client-side)
  • Supports filename/content search with built-in Python search; optionally uses fd/fdfind or rg when installed
  • Auto-reloads edited files
  • Dark/light mode toggle
  • Print or save to PDF through the browser
  • Optional LaTeX PDF export add-on (requires the separate md-to-lualatex project)
  • Breadcrumb navigation with folder/file icons
  • Highlights current file in tree and auto-expands

🔍 Preview

mdviewer opens a clean, local browser UI to view Markdown files — with a collapsible file tree, file filtering, fuzzy search, and full-text content search built in.

Screenshot showing file tree and search

🧭 Idea & Architecture

mdviewer turns a local folder of Markdown files into a browsable documentation site with one command. The files remain the source of truth: the Python server discovers and renders them, while the browser provides navigation, search, and reading tools.

flowchart LR
    User["Reader / author"] --> CLI["mdv PATH<br/>target · port · browser"]

    subgraph Server["Local Python server"]
        Flask["Flask routes<br/>/ · /view · /search"]
        Tree["File discovery<br/>recursive .md tree"]
        Render["Markdown renderer<br/>Markdown → HTML"]
        Search["Search adapters<br/>fd · rg"]
        Reload["Live reload<br/>file watcher"]

        Flask --> Tree
        Flask --> Render
        Flask --> Search
        Flask --> Reload
    end

    subgraph Browser["Browser UI"]
        Templates["Jinja templates"]
        Client["Client JavaScript<br/>filter · history · theme"]
        Document["Rendered document<br/>read · navigate · print"]

        Templates --> Client
        Client --> Document
    end

    Files[("Local Markdown folder")] --> Tree
    Files --> Render
    CLI --> Flask
    Flask --> Templates
    Render --> Document
    Reload -. refresh .-> Document
flowchart TB
    MDV["mdviewer<br/>local documentation browser"]

    MDV --> Discover["Discover<br/>file tree · folders · live filter"]
    MDV --> Find["Find<br/>filename search · content search"]
    MDV --> Read["Read<br/>GitHub-style Markdown · math · footnotes"]
    MDV --> Navigate["Navigate<br/>breadcrumbs · browser history"]
    MDV --> Iterate["Iterate<br/>live reload · themes · PDF export"]

🚀 Installation

🔧 Option 1: Homebrew (macOS/Linux)

brew tap biaojiang/mdviewer
brew install biaojiang/mdviewer/mdviewer

🐍 Option 2: Python (via pip)

pip install mdviewer

Search works immediately with no extra tools. If fd (or Debian’s fdfind) and rg are on PATH, mdviewer uses them automatically for faster searches. Missing tools use the built-in Python backend; no binaries are downloaded.

Optional: LaTeX PDF export

The LaTeX PDF button is an optional add-on in mdviewer 0.5.0. You can keep using mdviewer and the regular browser print/export without installing Pandoc, LaTeX, or the separate converter. When enabled, the button uses the md-to-lualatex project to compile the current Markdown file.

To enable LaTeX export, clone or install md-to-lualatex on the machine running mdviewer, and install its prerequisites: Pandoc and a LuaLaTeX toolchain that provides latexmk. The project bundles its monochrome Noto Emoji font and Pandoc emoji filter. Point mdviewer at the checkout by setting MDVIEWER_LATEX_REPO before launching it. The default path is /Volumes/Work/repos/md-to-lualatex.

For example, in zsh:

export MDVIEWER_LATEX_REPO="$HOME/path/to/md-to-lualatex"
mdviewer ~/Documents/notes

Optionally add an alias:

echo 'alias mdv="mdviewer"' >> ~/.zshrc
source ~/.zshrc
# or symlink
sudo ln -s $(which mdviewer) /usr/local/bin/mdv

🔧 Option 3: Build from Source

# Install Python deps
pip install -r requirements.txt

# Optional: use a venv
python -m venv .venv
source .venv/bin/activate

# Optional: install faster search tools
brew install fd ripgrep
# or
sudo apt install fd-find ripgrep

# ▶️ Run the Server
python app.py

Open [http://127.0.0.1:5000](http://127.0.0.1:5000/) in your browser.

🛠️ Usage

mdviewer [PATH] or mdv [PATH]

# e.g.:
mdv # serve the current directory and open the browser when Markdown is found
mdv .
mdv /path/to/README.md
mdv --no-open # serve without opening a browser

🚀 Features

  • ✅ GitHub-style rendering via markdown-it-py + GitHub CSS
  • ✅ Footnote references with links to definitions and return links
  • ✅ Auto-expandable file tree using <details>
  • ✅ Live filtering with reset button
  • ✅ Backend-powered search:
    • filename regular-expression matching (smart case)
    • rg: content search
  • ✅ Flask-based local webserver
  • ✅ MathJax support for LaTeX
  • ✅ Reload current buffer on changes (with livereload)
  • ✅ Font Awesome icons for folders/files
  • ✅ Breadcrumb that reflects navigation path
  • ✅ Highlight + auto-expand tree for active file
  • ✅ Browser print/export to PDF
  • ✅ Optional LaTeX PDF export add-on via md-to-lualatex (see setup above)

📁 File Structure

.
├── docs
│   └── math
│       └── math-test.md
├── pyproject.toml
├── README.md
├── requirements.txt
├── screenshot.png
└── src
    ├── mdviewer
    │   ├── __init__.py
    │   ├── app.py
    │   ├── cli.py
    │   ├── search
    │   │   ├── __init__.py
    │   │   ├── __pycache__
    │   │   ├── fd_search.py
    │   │   └── rg_search.py
    │   ├── static
    │   │   ├── script.js
    │   │   └── style.css
    │   └── templates
    │       ├── index.html
    │       ├── search.html
    │       └── viewer.html
    └── 

🔍 Search Modes

  • filename regex search (smart case; optional fd/fdfind accelerator)
  • rg: full-text content match (powerful)

⚙️ Keyboard & UI

  • 🌓 Dark/light toggle
  • ⌨️ Live tree filter with reset
  • 🗂 Expandable nested folders
  • 🔗 Click to render .md file in browser
  • 🖨 Export/Print to PDF button
  • 📁 Breadcrumb with Font Awesome icons
  • 📄 Highlight + expand tree for active file

⏭️ Next Steps


📄 License

MIT

Document safety

Raw HTML inside Markdown is displayed as text. Markdown formatting, tables, footnotes, math, and images remain supported. Raw files such as HTML and SVG are served with a browser sandbox that disables scripts and same-origin access; SVG diagrams can still be embedded as images.

Files and folders reached through symlinks inside the served tree are not served or listed. The folder explicitly selected on the command line may itself be a symlink. This keeps document reads inside the selected folder even when a file is replaced while a request is being handled.

Search backends

Filename searches use regular expressions with smart case: lowercase patterns ignore case; patterns containing uppercase letters are case-sensitive. Content searches are case-insensitive and match individual lines. Queries beginning with - remain search patterns.

The Python fallback searches .md files, skips hidden entries and the viewer's excluded directories, and never follows descendant symlinks. It uses Python-compatible regular-expression syntax through the automatically installed regex package. Patterns are limited to 4,096 characters; matches have a 0.1-second timeout and the fallback has a five-second search budget. Invalid or timed-out searches return no results. The optional external tools use their own regex engines, ignore-file rules, and Markdown file-type definitions, so advanced patterns and file selection can differ. The fallback does not interpret .gitignore files.

Metadata

Release files for mdviewer 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdviewer 0.5.0
File Size Uploaded Provenance Actions
mdviewer-0.5.0.tar.gz 26.2 kB With provenance Details for mdviewer-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mdviewer 0.5.0
File Interpreter ABI Platform Actions
mdviewer-0.5.0-py3-none-any.whl Python 3 none any Details for mdviewer-0.5.0-py3-none-any.whl

Total release size: 47.6 kB

Release files / mdviewer-0.5.0.tar.gz

Download URL mdviewer-0.5.0.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e66442aa053b5f3361a10c94ac435b13392ed6f896e648888d5d3b209386f5fc
BLAKE2b-256 checksum
How to use checksums
b0347cabfbc12f64257a899111a36e1893ff6e7b5591114116a05b21e42f808b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / mdviewer-0.5.0-py3-none-any.whl

Download URL mdviewer-0.5.0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adcadb6bdddbd6cc4b33ef390a95eb53c03f44ceeef894c7bd31f24937aa74a2
BLAKE2b-256 checksum
How to use checksums
e10b3794880bd3577467684e5562bf478ceb7fc20103bd24c0087515a9b2ddb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for mdviewer 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mdviewer-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page