Aliou Diallo

preview-markdown

Terminal markdown pager with syntax highlighting using Pi's TUI package.

preview-markdown

A terminal markdown pager with syntax highlighting, search, and vim-style navigation.

This project is an experiment in building a complete tool using AI coding agents with minimal manual code intervention.

Features

Installation

Homebrew

brew tap aliou/toolbox
brew install aliou/toolbox/pmd

Manual

Download the binary for your platform from the releases page:

Then install it somewhere in your $PATH:

# Example for macOS
curl -L https://github.com/aliou/preview-markdown/releases/latest/download/pmd-darwin-arm64 -o pmd
chmod +x pmd
sudo mv pmd /usr/local/bin/

Nix

Add to your flake inputs:

{
  inputs.pmd.url = "github:aliou/preview-markdown";
}

Then either run directly:

nix run github:aliou/preview-markdown -- README.md

Or add to your system/home-manager packages:

# In your configuration
{ inputs, ... }:
{
  environment.systemPackages = [ inputs.pmd.packages.${system}.default ];
}

A home-manager module is also available:

{ inputs, ... }:
{
  imports = [ inputs.pmd.homeManagerModules.default ];
  programs.pmd.enable = true;
}

Usage

pmd                     # Browse markdown files in current directory
pmd docs/               # Browse markdown files in docs/
pmd docs/ --depth 3     # Browse recursively up to 3 levels deep
pmd README.md           # Open a file directly in the pager
cat FILE.md | pmd       # Read from stdin

Options

-d, --depth N      Directory browser recursion depth (default: 1, includes direct subdirectories)
-l, --line-numbers Show line numbers (pager only)
-w, --width N      Word-wrap at width (0 to disable)
    --light        Force light mode
    --dark         Force dark mode

Browser navigation

Browsing supports .md, .markdown, and .mdx files.

KeyAction
j / DownMove down
k / UpMove up
f / PgDnPage down
b / PgUpPage up
g / HomeGo to top
G / EndGo to bottom
/Filter files by name
EscClear filter
s / SCycle sort mode
r / RReverse sort order
EnterOpen selected file
?Show help
q / EscQuit

Pager navigation

KeyAction
j / DownScroll down
k / UpScroll up
dHalf page down
uHalf page up
f / Space / PgDnPage down
b / PgUpPage up
g / HomeGo to top
G / EndGo to bottom
/Search
n / NNext/previous match
eEdit in $EDITOR
r / RReload file
Ctrl+ZSuspend pmd
?Show help
q / EscQuit (returns to browser if opened from one)

Shell Completions

pmd --completion bash > /etc/bash_completion.d/pmd
pmd --completion zsh > ~/.zsh/completions/_pmd
pmd --completion fish > ~/.config/fish/completions/pmd.fish

Configuration

Create a config file with pmd --init-config or pmd --config, or manually at ~/.config/pmd/config.json.

Local config is also supported via .pmd.json in the current directory and takes precedence over global config. See .pmd.json in this repo for an example.

License

MIT