mdcat
A cat command for Markdown — renders Markdown with formatting, syntax-highlighted code blocks, and inline images directly in your terminal.
mdcat is a cat-like tool for Markdown files. Instead of dumping raw Markdown
syntax to the terminal, it renders headings, bold, italic, lists, blockquotes,
and code blocks with proper formatting and syntax highlighting — and even
displays inline images in terminals that support it.
It's the natural companion for reading README.md, changelogs, and
documentation files without leaving the terminal.
Features
- Full Markdown rendering — headings, emphasis, lists, blockquotes, horizontal rules, and tables all render cleanly
- Syntax highlighting — fenced code blocks are highlighted using the same
syntect engine as
bat - Inline images — displays images directly in the terminal via the Kitty graphics protocol, iTerm2 inline images, or Sixel (depending on terminal support)
- Clickable links — renders hyperlinks using OSC 8 terminal hyperlinks in supported terminals; displays the URL as a footnote in others
- Paging — pipes output through a pager (
less) when the content is longer than the terminal - CommonMark compliant — parses Markdown according to the CommonMark spec
Installation
cargo install mdcat
Or via your system package manager:
# Debian / Ubuntu
apt install mdcat
# Fedora
dnf install mdcat
# macOS
brew install mdcat
# Arch Linux
pacman -S mdcat
# Nix
nix-env -iA nixpkgs.mdcatUsage
# Render a Markdown file
mdcat README.md
# Render from stdin
curl -sL https://raw.githubusercontent.com/BurntSushi/ripgrep/master/README.md | mdcat
# Disable paging (always print to stdout directly)
mdcat --no-pager README.md
# Print without any formatting (plain text)
mdcat --plain README.md
# Render multiple files in sequence
mdcat CHANGELOG.md README.mdTerminal compatibility
| Feature | Kitty | iTerm2 | WezTerm | VTE (GNOME Terminal, etc.) | xterm |
|---|---|---|---|---|---|
| Inline images | ✅ | ✅ | ✅ | ❌ | ❌ |
| Clickable links | ✅ | ✅ | ✅ | ✅ | ❌ |
| Syntax highlighting | ✅ | ✅ | ✅ | ✅ | ✅ |
In terminals without image support, image alt text is shown instead.
Tips
- Alias
catfor.mdfiles — add a shell function so opening a Markdown file automatically usesmdcat:
# bash / zsh
function cat() {
if [[ "$1" == *.md ]]; then
mdcat "$@"
else
command cat "$@"
fi
}
- Pair with
bat— usebatfor source code files andmdcatfor documentation; together they make browsing any project directory in the terminal much more pleasant. - Read man page alternatives — many projects ship
docs/directories full of Markdown.mdcatmakes reading them as comfortable as a web browser.