A local, read-only web viewer that lists Markdown / PDF / SVG files in a directory tree and renders the selected one (stdlib only).
Project description
md-tree-viewer
A local, read-only web viewer for the Markdown / PDF / SVG files in a directory tree. Point it at a folder full of docs and browse them by title + opening description instead of by filename alone.
- Left pane — a collapsible tree of just the
.md/.markdown/.pdf/.svgfiles under the root, with a live search filter. Each Markdown file shows its title and a one-line description so you can tell files apart at a glance. - Right pane — the selected file rendered:
- Markdown with GitHub-flavored tables, code, Mermaid diagrams, and CJK text
- PDF embedded in the page
- SVG shown as an image
- Fast & quiet — dependency dirs, virtualenvs, caches and
.gitare skipped while scanning, so a tree with thousands of files stays responsive. - Recently opened / Recently modified quick sections, and folders that contain recently changed files are highlighted so you can find your active work.
- No build, no dependencies — Python standard library only. (Rendering loads
marked.jsandmermaid.jsfrom a CDN, so Markdown styling needs a network connection; the tree, PDF and SVG work offline.)
Install
pip install md-tree-viewer
Requires Python 3.10+.
Usage
mdtree # scan the current directory, open the browser
mdtree path/to/docs # scan a specific directory
mdtree --port 9000 # use a different port (default 8765)
mdtree --no-browser # do not open a browser automatically
You can also run it as a module:
python -m md_tree_viewer path/to/docs
Then open http://127.0.0.1:8765/ (opened automatically unless --no-browser).
Options
| Argument | Default | Description |
|---|---|---|
root |
current directory | the directory to scan |
--port |
8765 |
local server port |
--no-browser |
(browser opens) | do not open a browser automatically |
Features in detail
Titles and descriptions
For each .md file the viewer reads only the head of the file and extracts:
- Title — the first heading (
#) or the first non-empty line. - Description — the first real paragraph, or the YAML frontmatter
description:field when present (frontmatter wins).
Cross-file links
- Relative links inside a rendered document open the target document inside the viewer (no 404s when browsing a doc set).
- Inline-code file paths (e.g.
`docs/guide.md`) become clickable: local.md/.pdfopen in the viewer; anything else links to the file on GitHub if the containing repository has a GitHuboriginremote.
Security
- The server is read-only (HTTP
GETonly) and binds to127.0.0.1. - Only
.md/.markdown/.pdf/.svgfiles under the root are served. Requests are resolved against the root and path traversal is rejected.
Why
When a folder accumulates hundreds or thousands of Markdown notes, design docs, diagrams and reports, the filenames stop being enough to find anything. This viewer gives every file a human-readable title and summary in one scrollable, searchable tree — and renders Mermaid and tables the way you expect — without installing a static-site generator or any third-party packages.
Development
git clone https://github.com/furuse-kazufumi/md-tree-viewer
cd md-tree-viewer
pip install -e ".[test]" # or: pip install pytest && pip install -e .
pytest
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file md_tree_viewer-0.1.0.tar.gz.
File metadata
- Download URL: md_tree_viewer-0.1.0.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79879d0591d3b59e7216c8e565d8081d7433e2ca185ecddc52a3a7ded53e0d5a
|
|
| MD5 |
4c3bbc0330bf05b4cfa45e7cd8f74a6b
|
|
| BLAKE2b-256 |
4a62b225fc55b833e0d5641afab941fc41b136967a5d1322487df386c8123606
|
File details
Details for the file md_tree_viewer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: md_tree_viewer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc8c68523cdb8c85d39df9cedf70b94607d5313f1dc07aeeffa583363cbb49c9
|
|
| MD5 |
ebc3376cf2906d3098be02ab90d486a2
|
|
| BLAKE2b-256 |
d9d5315f449e2ad070f57970f6cae5c9c057d0cc6d29e945704ea1a37dff0bc2
|