mdview is a terminal markdown viewer with live reload, YAML config support, theme presets, and a plain-text fallback for non-TTY output.
- Renders GitHub-Flavored Markdown in an Ink-based TUI
- Auto-detects input from:
- a local file path
- piped stdin
- a URL beginning with
http://orhttps:// -as stdin shorthand
- Reloads local files automatically
- Supports YAML config files at
~/.config/mdview/config.ymlor~/.config/mdview/config.yaml - Prints a readable plain-text view when stdout is not a TTY
- Sanitizes untrusted content before rendering so terminal control sequences do not leak through
- macOS: use Homebrew when available.
- Linux: use the prebuilt release binary, or build from source if you prefer.
- Developers or contributors: install from source with
npm install.
If you use the Homebrew tap, install it with:
brew install cbuchler/tap/mdviewThis is the intended macOS install path once the tap is published.
Download the release artifact for your platform from GitHub Releases, then place the mdview binary somewhere on your PATH.
If you want to build or run from the repository:
npm install
npm run build
npm run dev -- README.mdThis repository can produce a standalone binary with Bun:
npm run package:binariesTo copy that binary into ~/.local/bin by default:
npm run install:binarySet MDVIEW_INSTALL_DIR if you want it installed somewhere else.
mdview README.md
mdview README.md --theme dracula --refresh 150ms
mdview https://example.com/readme.md
cat README.md | mdview
printf '# Hello from stdin\n' | mdview
mdview -Use mdview --help for a compact summary. The current flags are:
--theme <name>--syntax-theme <name>--refresh <ms|1s|1m>--timeout <ms|1s|1m>--max-bytes <bytes|1mb|2mb>--padding <number>--wrap/--no-wrap--watch/--no-watch--config <path>--print-config--init-config-h,--help--version
Examples:
mdview README.md --theme tempus-rift
mdview README.md --syntax-theme dracula
mdview README.md --no-wrap
mdview README.md --watch
mdview README.md --no-watch
mdview README.md --max-bytes 1mbmdview chooses the source automatically:
- If stdin is piped, it reads stdin.
- If the argument starts with
http://orhttps://, it fetches that URL. - Otherwise, it treats the argument as a file path.
- If you pass
-, it is treated as stdin.
If you launch mdview with no input and no piped data, it prints help and exits.
Built-in themes:
githubdraculasolarizedtempus-riftmidnightpaper
tempus rift and tempusrift are accepted as aliases for tempus-rift.
The default config file is:
~/.config/mdview/config.yml
mdview also accepts ~/.config/mdview/config.yaml.
Configuration is applied in this order:
- CLI flags
- YAML config file
- built-in defaults
The built-in defaults are tuned for terminal use: theme: tempus-rift and syntaxTheme: dracula.
The config file supports these keys:
themesyntaxThemewrappaddingrefreshIntervalMstimeoutMsmaxInputByteswatch
# mdview configuration
# Default config path: ~/.config/mdview/config.yml
# Visual theme for the viewer and status bars.
theme: tempus-rift
# Theme used for code blocks and other syntax-adjacent surfaces.
syntaxTheme: dracula
# Whether lines wrap in the viewport.
wrap: true
# Horizontal padding around rendered content.
padding: 1
# File watch debounce in milliseconds.
refreshIntervalMs: 150
# Network timeout in milliseconds for URL input.
timeoutMs: 8000
# Maximum bytes to load before truncating.
maxInputBytes: 2097152
# Enable live reload for local files.
watch: true
# Supported themes: github, dracula, solarized, tempus-rift, midnight, paperPrint a commented template:
mdview --print-configWrite the template to the default config path only if it does not already exist:
mdview --init-configWrite a config template to a specific path:
mdview --print-config > /tmp/mdview.ymlInitialize a specific path only if it does not already exist:
mdview --init-config --config /tmp/mdview.ymlCompletion scripts are included in the repository and published package.
source /path/to/mdview/completions/bash/mdviewFor a permanent install, copy the file into your shell completion directory or source it from your shell profile.
fpath+=(/path/to/mdview/completions/zsh)
autoload -Uz compinit
compinitFor a permanent install, place _mdview in a directory that is already on fpath.
mkdir -p ~/.config/fish/completions
cp /path/to/mdview/completions/fish/mdview.fish ~/.config/fish/completions/Fish picks up the completion automatically after the file is installed.
The completions/ directory is included in the published package.
- Local files reload automatically with debounce.
- URLs are fetched with a timeout and a size guardrail.
- Long lines wrap by default.
--no-wrapkeeps lines unwrapped.- Non-TTY output uses the same renderer but prints plain text instead of opening the TUI.
- Invalid flags, invalid values, unknown themes, malformed YAML, and unknown YAML keys are reported as concise CLI errors.
npm install
npm run dev -- README.md
npm test
npm run buildGNU GPLv3 or later. See LICENSE.
- Markdown rendering is tuned for terminal display, so some complex browser-only Markdown features are intentionally out of scope.
- Terminal width, Unicode width, and emoji handling can still vary a bit by terminal emulator and font.
- If you see odd wrapping in a specific terminal, try
--no-wrapto narrow down whether it is a width-calculation issue.