A fast CLI tool that previews Markdown files in your browser with GitHub-styled rendering.
| Feature | Description |
|---|---|
| GitHub Flavored Markdown | Tables, task lists, strikethrough, and autolinks |
| Syntax Highlighting | 200+ languages via Chroma with GitHub-styled colors |
| Copy to Clipboard | Hover over code blocks to copy with one click |
| Dark Mode | Automatically follows system preference |
| Multi-file Support | Preview multiple files with sidebar navigation |
| Directory Support | Preview all .md files in a directory |
| Live Reload Server | Watch files and auto-refresh on changes |
Respects .gitignore |
Automatically skips ignored files |
| Mobile Responsive | Hamburger menu on smaller screens |
| Fuzzy Search | Quick file search with Cmd/Ctrl+K |
brew install sadiksaifi/tap/mdpcurl -fsSL https://raw.githubusercontent.com/sadiksaifi/mdp/main/scripts/install.sh | shThis installs mdp to ~/.local/bin and automatically configures your PATH.
git clone https://github.com/sadiksaifi/mdp.git
cd mdp
make installmake build
./mdp README.mdbrew upgrade sadiksaifi/tap/mdpmdp upgrademdp automatically checks for updates and notifies you when a new version is available.
mdp <file.md> # Preview single file
mdp <file1.md> <file2.md> # Preview multiple files with sidebar
mdp <directory> # Preview all .md files in directory
mdp -O output.html <file.md> # Export to HTML file
mdp --serve <file.md> # Start live reload server
mdp --serve --port 3000 <dir> # Live reload on custom port| Option | Description |
|---|---|
-O, --output <file> |
Write HTML to file instead of opening browser |
--serve |
Start live reload server instead of opening browser |
--port <port> |
Port for live reload server (default: 8080) |
-h, --help |
Show help message |
-v, --version |
Show version |
| Command | Description |
|---|---|
upgrade |
Upgrade mdp to the latest version |
upgrade --force |
Force upgrade even if already up to date |
mdp README.mdmdp README.md CHANGELOG.md docs/guide.mdmdp ./docs/mdp -O docs.html README.md # Export single file to HTML
mdp --output site.html ./docs/ # Export directory to single HTML fileTip
Use --output to generate standalone HTML files for sharing or hosting documentation.
mdp --serve README.md # Start server on port 8080
mdp --serve --port 3000 ./docs/ # Start server on port 3000Tip
Use --serve when writing documentation to see changes in real-time without manually refreshing the browser.
| Mode | Output |
|---|---|
| Single file | Opens /tmp/mdpreview-{filename}.html in your default browser |
| Multiple files/directory | Opens /tmp/mdpreview-multi.html with sidebar navigation |
Export mode (-O) |
Writes HTML to specified file path |
| Live reload mode | Starts HTTP server at http://localhost:<port> with WebSocket auto-refresh |
Note
These shortcuts work in multi-file mode.
| Shortcut | Action |
|---|---|
| Cmd/Ctrl + K | Open fuzzy search palette |
| Cmd + B (Mac) | Toggle sidebar |
| Ctrl + B (Win/Linux) | Toggle sidebar |
| Escape | Close sidebar/search palette |
| Shortcut | Action |
|---|---|
| ↑ / ↓ | Navigate results |
| Ctrl + P / N | Navigate results (alternative) |
| Enter | Open selected file |
| Escape | Close palette |
cmd/mdp/ # CLI entry point
internal/
converter/ # Markdown to HTML conversion
template/ # HTML document generation (single & multi-file)
filetree/ # File tree data structure for sidebar
browser/ # Platform-specific browser opening
server/ # Live reload HTTP server with WebSocket
assets/ # CSS assets
| Command | Description |
|---|---|
make build |
Build the binary |
make test |
Run all tests |
make coverage |
Run tests with coverage |
make install |
Install to /usr/local/bin |
make release |
Build for all platforms |
make clean |
Remove build artifacts |
Releases are managed by Tagsmith using the repo's .tagsmith.jsonc config.
npx tagsmith@latest targets
npx tagsmith@latest tag --channel stable --bump patch --dry-run --json
npx tagsmith@latest tag --channel stable --bump patch --pushTagsmith-created annotated v* tags are validated in CI before release artifacts and the Homebrew tap update are published.
make testImportant
Always run tests before submitting a pull request.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT