mdcli is a powerful, feature-rich command-line tool for processing and rendering Markdown files with advanced capabilities including live preview, batch processing, multiple output formats, and extensive customization options.
Backward Compatibility: mdcli v2.0 maintains full backward compatibility. You can still use
mdcli file.mddirectly without therendersubcommand!
- Terminal: Beautiful terminal rendering with syntax highlighting
- HTML: Clean HTML output with custom themes
- PDF: Export to PDF format (planned)
- Plain Text: Strip HTML for plain text output
- 5 Built-in Themes: Dracula, GitHub, Monokai, Solarized, Nord
- Customizable Colors: Override theme colors via configuration
- Syntax Highlighting: Advanced code highlighting with multiple styles
- Watch Mode: Auto-regenerate on file changes
- Live Preview Server: Browser-based live preview with auto-reload
- Interactive Mode: Real-time Markdown editor in terminal
- Batch Processing: Process entire directories concurrently
- Progress Bars: Visual feedback for long operations
- Concurrent Workers: Configurable parallel processing
- Caching: Intelligent caching for better performance
- Math Equations: LaTeX math rendering with MathJax
- Mermaid Diagrams: Support for flowcharts and diagrams
- GitHub Flavored Markdown: Tables, task lists, strikethrough
- Auto-linking: Automatic URL and email detection
- YAML Config Files: Persistent settings in
~/.mdcli.yaml - Environment Variables: Override settings with
MDCLI_*vars - Command-line Flags: Override any setting on-the-fly
# Clone the repository
git clone https://github.com/tacheraSasi/mdcli.git
cd mdcli
# Build for your platform
make build_linux # Linux
make build_mac # macOS
make build_windows # Windows
# Or build directly with Go
go build -o mdcli# Simple rendering (backward compatible)
./mdcli README.md
# With flags (backward compatible)
./mdcli README.md --theme=github --format=html
# Explicit render command
./mdcli render README.md
# Render with custom theme
./mdcli render --theme=github README.md
# Output to HTML
./mdcli render --format=html --output=output.html README.md
# Start live preview server
./mdcli serve README.md --port=8080
# Watch for changes
./mdcli watch README.md --output=preview.html
# Interactive mode
./mdcli interactive
# Batch process directory
./mdcli batch ./docs --output=./dist --recursive
# View available themes
./mdcli themes| Command | Description | Example |
|---|---|---|
render |
Render Markdown files | mdcli render file.md |
serve |
Start live preview server | mdcli serve file.md |
watch |
Watch files for changes | mdcli watch file.md |
batch |
Process multiple files | mdcli batch ./docs |
interactive |
Interactive editor mode | mdcli interactive |
themes |
List available themes | mdcli themes |
config |
Manage configuration | mdcli config show |
| Flag | Description | Default |
|---|---|---|
--config |
Config file path | ~/.mdcli.yaml |
--verbose |
Verbose output | false |
--theme |
Syntax theme | dracula |
--format |
Output format | terminal |
--width |
Terminal width | 80 |
mdcli render [files...] [flags]
Flags:
-f, --format string Output format (terminal, html, pdf, text)
-o, --output string Output file path
-t, --theme string Syntax highlighting theme
-w, --width int Terminal width for formatting
--autolink Enable automatic link detection (default true)
--progress Show progress bar for multiple filesmdcli serve [file] [flags]
Flags:
-p, --port int Port to serve on (default 8080)
-b, --bind string Bind address (default "localhost")
--auto-reload Enable auto-reload on file changes (default true)
-t, --theme string Theme for HTML output (default "github")mdcli batch [directory] [flags]
Flags:
-o, --output string Output directory
-f, --format string Output format (default "html")
-r, --recursive Process subdirectories recursively
-c, --concurrent int Number of concurrent workers (default 4)
-e, --ext string Output file extension (default ".html")Create a configuration file at ~/.mdcli.yaml:
# Initialize default config
mdcli config init
# View current configuration
mdcli config show# Default theme for syntax highlighting
theme: dracula
# Default output format
output_format: terminal
# Default terminal width
width: 80
# Enable automatic link detection
autolink: true
# Batch processing settings
batch:
concurrent_workers: 4
output_extension: .html
recursive: true
# Server settings
serve:
port: 8080
bind: localhost
auto_reload: true
# Rendering preferences
render:
show_progress: true
include_metadata: falseOverride any setting with environment variables:
export MDCLI_THEME=github
export MDCLI_WIDTH=100
export MDCLI_FORMAT=html
mdcli render README.md # Uses above settingsmdcli includes 5 beautiful built-in themes:
| Theme | Description | Best For |
|---|---|---|
| Dracula | Dark theme with purple accents | Dark mode lovers |
| GitHub | Light theme inspired by GitHub | Documentation |
| Monokai | Dark theme with vibrant colors | Code highlighting |
| Solarized | Balanced light/dark theme | Eye comfort |
| Nord | Arctic, north-bluish palette | Modern aesthetic |
# List all available themes
mdcli themes
# Use a specific theme
mdcli render --theme=nord README.md
# View theme details
mdcli themes --verbosemdcli supports LaTeX math equations via MathJax:
Inline math: $E = mc^2$
Block math:
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$Create flowcharts and diagrams:
\```mermaid
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
\```Start a live preview server for real-time editing:
# Start server
mdcli serve README.md --port=8080
# Open browser to http://localhost:8080
# Edit README.md and see changes instantlyUse the interactive REPL for quick Markdown testing:
mdcli interactive
# Enter Markdown content, press Enter twice to render
# Type 'exit' to quit- Go 1.24 or later
- Make (optional, for using Makefile)
# Build for current platform
go build -o mdcli
# Build for all platforms
make build
# Build optimized binaries
make build_linux # Linux AMD64
make build_mac # macOS AMD64
make build_windows # Windows AMD64
make build_android # Android ARM64
# Clean build artifacts
make clean
# Install dependencies
make dependencies# Manual cross-compilation examples
GOOS=linux GOARCH=amd64 go build -o mdcli-linux
GOOS=darwin GOARCH=amd64 go build -o mdcli-darwin
GOOS=windows GOARCH=amd64 go build -o mdcli.exe- Use batch mode for processing multiple files
- Enable progress bars for visual feedback:
--progress - Adjust concurrent workers:
--concurrent=8for more CPU cores - Use appropriate themes for your terminal
- Set optimal width:
--width=120for wide terminals
We welcome contributions! Please see our Contributing Guidelines for details.
# Clone repository
git clone https://github.com/tacheraSasi/mdcli.git
cd mdcli
# Install dependencies
go mod tidy
# Run tests
go test ./...
# Build and test
go build && ./mdcli render README.md- ✨ Complete rewrite with Cobra CLI framework
- 🎨 Multiple output formats (HTML, PDF, plain text)
- 🌈 5 built-in themes with customization
- 🔄 Live preview server with auto-reload
- ⚡ Batch processing with concurrent workers
- 🛠️ Advanced Markdown features (Math, Mermaid)
- ⚙️ Comprehensive configuration system
- 📱 Interactive mode for real-time editing
- 📄 Basic Markdown rendering
- 🖥️ Terminal output only
- 📁 Single file processing
Issue: Command not found
# Solution: Ensure binary is in PATH or use full path
./mdcli render file.mdIssue: Theme not working
# Solution: Check available themes
mdcli themes
mdcli render --theme=github file.mdIssue: Server won't start
# Solution: Use different port
mdcli serve file.md --port=3000Issue: Config file not found
# Solution: Initialize config
mdcli config initThis project is licensed under the MIT License - see the LICENSE file for details.
- Goldmark - Markdown parser
- Cobra - CLI framework
- Viper - Configuration management
- go-term-markdown - Terminal rendering
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
Made with ❤️ by Tachera Sasi