MCPcopy Index your code
hub / github.com/CleverCloud/mdr

github.com/CleverCloud/mdr @0.9

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.9 ↗ · + Follow
103 symbols 240 edges 10 files 26 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

mdr — Markdown Reader

A lightweight, fast Markdown viewer with Mermaid diagram support and live reload. Built in Rust.

Why?

Developers working with LLMs constantly receive Markdown with code blocks, tables, and Mermaid diagrams. There's no simple mdr file.md command to view it all rendered properly.

  • Not an editor — read-only viewer, opens instantly
  • Not Electron — native Rust binary, no Node.js, no npm
  • Mermaid built-in — diagrams render as SVG natively (no headless browser)
  • Live reload — edit your file, see changes instantly

Backends

mdr offers multiple rendering backends, selectable at runtime:

Backend Stack Strengths
egui (default) Pure Rust GPU rendering Single static binary, fast startup, cross-platform
webview OS native WebView (WebKit/WebView2) GitHub-quality HTML/CSS rendering, full CSS support
tui Terminal UI (ratatui + crossterm) Works over SSH, no GUI needed, keyboard-driven

Install

From source

git clone https://github.com/CleverCloud/mdr.git
cd mdr
cargo install --path .

Build with specific backends only

# egui only (smaller binary, no WebView dependency)
cargo install --path . --no-default-features --features egui-backend

# webview only
cargo install --path . --no-default-features --features webview-backend

Usage

# Open with default backend (egui)
mdr README.md

# Open with webview backend
mdr --backend webview README.md

# Open in terminal (TUI)
mdr --backend tui README.md

# Show help
mdr --help

TUI keybindings

Key Action
q / Esc Quit
j / Scroll down
k / Scroll up
Space / PgDn Page down
PgUp Page up
g / Home Go to top
G / End Go to bottom
Tab Switch focus between TOC and content
Enter Navigate to selected TOC heading

Features

  • Full GFM support — tables, task lists, strikethrough, footnotes, autolinks
  • Syntax highlighting — code blocks with language detection (via syntect)
  • Mermaid diagrams — flowcharts, sequence diagrams, pie charts, and more (via mermaid-rs-renderer)
  • Table of Contents — auto-generated sidebar from headings with click-to-navigate
  • Live reload — file watching with 300ms debounce, updates on save
  • Dark/Light theme — follows OS theme (webview backend)

Mermaid Support

Mermaid code fences are rendered as SVG diagrams:

```mermaid
graph TD
    A[Input] --> B[Process]
    B --> C[Output]
```

Supported diagram types: flowchart, sequence, pie, class, state, ER, gantt.

Note: Diamond/decision nodes ({text}) are not yet supported by the underlying renderer. Use square brackets as a workaround.

Architecture

src/
├── main.rs              # CLI (clap), backend dispatch
├── core/
│   ├── markdown.rs      # GFM parsing (comrak) + CSS
│   ├── mermaid.rs       # Mermaid → SVG rendering
│   ├── toc.rs           # Heading extraction for TOC
│   └── watcher.rs       # File watching (notify, 300ms debounce)
└── backend/
    ├── egui.rs          # egui/eframe backend
    ├── tui.rs           # ratatui/crossterm TUI backend
    └── webview.rs       # wry/tao WebView backend

Building

Requires Rust 1.75+.

# All backends (default)
cargo build --release

# Run tests
cargo test

# Run clippy
cargo clippy

Linux dependencies

sudo apt-get install libgtk-3-dev libwebkit2gtk-4.1-dev libxdo-dev libgl1-mesa-dev

Releases

Pre-built binaries are available on the Releases page for: - macOS (Apple Silicon + Intel) - Linux (x86_64) - Windows (x86_64)

To create a release, push a version tag:

git tag v0.1.0
git push origin v0.1.0

License

MIT

Contributing

Issues and PRs welcome at github.com/CleverCloud/mdr.

Core symbols most depended-on inside this repo

extract_toc
called by 15
src/core/toc.rs
split_by_headings
called by 12
src/backend/egui.rs
parse_markdown
called by 11
src/core/markdown.rs
render_mermaid_to_svg
called by 6
src/core/mermaid.rs
process_mermaid_blocks
called by 5
src/core/mermaid.rs
preprocess_mermaid_for_egui
called by 5
src/core/mermaid.rs
add_heading_ids
called by 5
src/core/markdown.rs
run
called by 3
src/backend/tui.rs

Shape

Function 95
Class 4
Enum 2
Method 2

Languages

Rust100%

Modules by API surface

src/core/mermaid.rs23 symbols
src/core/toc.rs21 symbols
src/core/markdown.rs18 symbols
src/backend/tui.rs17 symbols
src/backend/egui.rs15 symbols
src/main.rs4 symbols
src/backend/webview.rs4 symbols
src/core/watcher.rs1 symbols

For agents

$ claude mcp add mdr \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact