Terminal Markdown previewer — GUI-like experience.
Install the latest published binary.
macOS / Linux / Android / Termux:
curl -fsSL https://raw.githubusercontent.com/RivoLink/leaf/main/scripts/install.sh | shWindows:
irm https://raw.githubusercontent.com/RivoLink/leaf/main/scripts/install.ps1 | iexVerify the installation:
leaf --versionUpdate an existing installation to the latest published release:
leaf --updateleaf --update downloads the matching published asset, verifies it against the published checksums.txt SHA256, and then installs it.
On Windows, if replacing the running .exe is blocked by the OS, rerun the PowerShell installer from the install section.
Clone the repository:
git clone https://github.com/RivoLink/leaf.git
cd leafBuild the release binary locally:
cargo build --releaseCreate a local bin directory if needed and symlink leaf into it:
mkdir -p ~/.local/bin
ln -sf "$(pwd)/target/release/leaf" ~/.local/bin/leafIf ~/.local/bin is not already on your PATH, add it to ~/.bashrc or ~/.zshrc:
export PATH="$HOME/.local/bin:$PATH"# Open a Markdown file
leaf TESTING.md
# Watch mode — reloads automatically on save
leaf --watch TESTING.md
leaf -w TESTING.md
# Open the fuzzy Markdown picker
leaf
# Open the classic directory browser picker
leaf --picker
# Open the fuzzy Markdown picker, then watch the selected file
leaf -w
# Open the classic directory browser picker, then watch the selected file
leaf -w --picker
# Open a dash-prefixed filename
leaf -- -notes.md
# Stream Markdown from another CLI tool
claude "explain Rust lifetimes" | leaf
# Preview a local file through stdin
cat TESTING.md | leaf
| Key | Action |
|---|---|
j / ↓ |
Scroll down |
k / ↑ |
Scroll up |
d / PgDn |
Page down (20 lines) |
u / PgUp |
Page up (20 lines) |
g / Home |
Top |
G / End |
Bottom |
t |
Toggle TOC sidebar |
T |
Open theme picker |
? |
Show help popup |
1–9 |
Jump to TOC section N |
/ / Ctrl+F |
Search |
n / N |
Next / prev match |
r |
Force reload (watch mode) |
q |
Quit |
- ✅ Watch mode
--watch/-w— reloads every 250ms, with⟳ reloadedflash feedback - ✅
leaf --watchcan start from the picker and begin watching after file selection - ✅ Syntax highlighting with common language aliases like
py,cpp,json,toml,ps1, anddockerfile - ✅ Unicode box-drawing tables with left / center / right alignment
- ✅ TOC sidebar with active section tracking and two-level navigation
- ✅ Search with match highlighting,
/,Ctrl+F, andn/N - ✅ Code blocks
┌─ lang ───┐ - ✅ Bold, italic, strikethrough, blockquotes, lists, and horizontal rules
- ✅ YAML frontmatter is ignored in both preview and TOC
- ✅ Native stdin input with bounded size
- ✅
leaf --updateto fetch, verify via published SHA256, and install the latest release on supported platforms - ✅ Fuzzy Markdown picker when launched without a file
- ✅ Classic directory browser picker with
leaf --picker - ✅ Theme picker with runtime preview
- ✅ Help modal with in-app shortcuts
# Terminal 1: generate the file
aichat "..." > notes.md
# Terminal 2: live watch
leaf --watch notes.md- Themes (light / custom)
- Copy code block
y - Code block horizontal scroll
- Improve search performance on large files
If leaf.exe does not start on Windows and reports a missing MSVC runtime, install the latest supported Microsoft Visual C++ Redistributable from Microsoft Learn:
Direct download for the latest supported X64 Microsoft Visual C++ Redistributable:
For leaf-windows-x86_64.exe, the relevant package is the latest supported X64 Visual C++ v14 Redistributable.
If leaf --update fails on Windows with an error about replacing, renaming, or writing leaf.exe, the running executable was likely locked by the OS.
Close any terminal session still running leaf, then rerun the PowerShell installer from the install section:
irm https://raw.githubusercontent.com/RivoLink/leaf/main/scripts/install.ps1 | iexmacOS / Linux / Android / Termux:
rm -f ~/.local/bin/leafWindows:
Remove-Item "$env:LOCALAPPDATA\Programs\leaf\leaf.exe" -Force