A native macOS command-line tool that renders Markdown files in a beautiful window with support for Mermaid diagrams and Graphviz graphs.
- Native macOS window - Lightweight AppKit window with WebKit rendering
- Mermaid diagrams - Flowcharts, sequence diagrams, state diagrams, and more
- Graphviz/DOT support - Full DOT language support including colors, shapes, clusters, and styling
- Syntax highlighting - Code blocks with language-aware highlighting
- Dark/light mode - Follows system appearance or manual override
- Live reload - Watch mode for automatic refresh on file changes
- PDF export - Export rendered documents to PDF (Cmd+E)
- Keyboard shortcuts - Cmd+R (reload), Cmd+W (close), Cmd+±0 (zoom)
Requires Xcode command-line tools and Swift 5.9+.
# Clone and build
git clone <repo-url>
cd MarkdownRender
swift build -c release
# Copy to your bin directory
cp .build/release/MarkdownRender ~/bin/# Basic usage
MarkdownRender path/to/file.md
# Watch for changes (live reload)
MarkdownRender --watch path/to/file.md
# Force dark or light theme
MarkdownRender --theme dark path/to/file.md
MarkdownRender --theme light path/to/file.md
# Show help
MarkdownRender --helpStandard CommonMark syntax is supported, plus:
```mermaid
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[OK]
B -->|No| D[Cancel]
``````dot
digraph G {
rankdir=LR;
node [shape=box, style="rounded,filled", fillcolor="#e8f4f8"];
A -> B -> C;
}
```Or use graphviz as the language identifier:
```graphviz
digraph G {
A -> B;
}
```- All node shapes (box, circle, diamond, cylinder, etc.)
- Cluster subgraphs with custom styling
- Edge styles (solid, dashed, dotted, bold)
- Colors (fill, border, font)
- HTML-like labels with tables
- Multiple layout engines
MarkdownRender/
├── Package.swift # Swift Package Manager manifest
├── Sources/MarkdownRender/
│ ├── main.swift # CLI entry point
│ ├── App/
│ │ └── AppDelegate.swift # Window and app lifecycle
│ └── Rendering/
│ ├── MarkdownParser.swift # Markdown to HTML conversion
│ └── HTMLGenerator.swift # HTML template and CSS
└── sample.md # Example markdown file
- swift-markdown - Apple's CommonMark parser
- swift-argument-parser - CLI argument parsing
- Mermaid.js - Diagram rendering (CDN)
- Viz.js - Graphviz rendering (CDN)
- Highlight.js - Syntax highlighting (CDN)
- macOS 13.0 (Ventura) or later
- Internet connection (for CDN-hosted JavaScript libraries)
MIT