Introduction
What is leaf?
leaf is a terminal-based Markdown previewer that brings a GUI-like experience to your command line. It renders Markdown files with rich formatting, syntax highlighting, LaTeX math, Mermaid diagrams, and more, all without leaving your terminal.
Key Features
- Rich Markdown rendering : headers, lists, blockquotes, tables with Unicode borders, syntax highlighting for 40+ languages, GitHub alert callouts, task list checkboxes, text highlighting, and Markdown footnotes.
- LaTeX & Mermaid : math formulas rendered as Unicode, diagrams as ASCII art.
- Interactive navigation : vim-like keybindings, mouse support, scrollbar, and full-text search.
- Table of Contents : sidebar TOC with active section tracking, mouse navigation, and auto-follow while scrolling.
- File picker : fuzzy finder (Ctrl+P) and directory browser (Shift+P) with configurable width.
- Watch mode : auto-reload on file changes, preserving scroll position.
- Editor integration : open files in your preferred editor with Ctrl+E, at the currently visible line via
{$line}. - Code block interactions : copy content with
y/cthenCtrl+Y/Enter, toggle line numbers in code blocks. - Mouse capture : toggle mouse capture with
Shift+Mto let the terminal handle text selection. - Inline rendering : render Markdown to stdout with
--inlinefor scripts and previews. - Shell completions : Tab completion for Bash, Zsh, Fish, and PowerShell.
- Custom themes : 4 built-in themes + create your own with TOML files.
- Extra file types : open any file; code files get syntax highlighting.
- Clickable links : Ctrl+Click to open, hover effects in supported terminals.
- Stdin support : pipe from any CLI tool (
claude "..." | leaf). - Cross-platform : macOS, Linux, Windows, Android/Termux.
Quick Start
# Install
curl -fsSL https://leaf.rivolink.mg/install.sh | sh
# Preview a file
leaf README.md
# Watch mode
leaf --watch README.md
# Open file picker
leaf
Next Steps
- Installation: detailed installation guide for all platforms.
- Usage: learn the basics of using leaf.
- Features: explore all features in depth.