mdcat
Display Markdown files with rendered formatting
SYNOPSIS
mdcat [OPTIONS] [FILE...]
PARAMETERS
FILE...
One or more Markdown files to render. If no files are specified, mdcat reads from standard input (stdin).
-h, --help
Displays a comprehensive help message and exits.
-V, --version
Prints the version information of mdcat and exits.
-t
Sets the maximum width for text wrapping. Content will be wrapped to fit within this column limit.
-p, --pager
Forces mdcat to pipe its output through a pager program, typically less -R, allowing for scrolling and searching.
-P, --no-pager
Prevents mdcat from automatically piping its output to a pager, even if it would normally do so.
-s, --sixel
Forces rendering of images using the Sixel graphics protocol. This requires a Sixel-compatible terminal emulator.
-i, --iterm2
Forces rendering of images using the iTerm2 inline image protocol. This requires iTerm2 or a compatible terminal.
-c, --colored
Forces mdcat to produce colored output, even if it detects that the terminal might not support it.
-C, --no-colored
Disables all colored output, rendering the Markdown as plain text with basic formatting.
-l, --line-numbers
Displays line numbers alongside the rendered Markdown content.
--theme
Specifies the syntax highlighting theme to use for code blocks within the Markdown file. Common themes include 'Solarized (light/dark)', 'Monokai', etc.
--detect-pager
Automatically detects if the output should be piped to a pager. This is the default behavior.
--detect-sixel
Automatically detects if the current terminal supports Sixel graphics. This is the default behavior for Sixel image rendering.
--detect-iterm2
Automatically detects if the current terminal supports iTerm2 inline images. This is the default behavior for iTerm2 image rendering.
DESCRIPTION
mdcat is a command-line utility designed to render Markdown files directly in your terminal emulator. Unlike traditional text viewers like cat or less, mdcat interprets the Markdown syntax and applies rich formatting using ANSI escape codes. This includes bold and italic text, headers, lists, code blocks with syntax highlighting, and even images (if your terminal supports protocols like Sixel or iTerm2 inline images). It aims to provide a pleasant and highly readable experience for viewing documentation, READMEs, or notes written in Markdown without ever leaving the command line. Its intelligent handling of text wrapping, colors, and optional image rendering makes it an indispensable tool for developers and users who frequently interact with Markdown content in their terminal environment.
CAVEATS
- Image rendering capabilities (Sixel, iTerm2) are highly dependent on the features supported by your specific terminal emulator. Without proper support, images will either not appear or be rendered as plain text.
- mdcat's visual output can be affected by your terminal's color scheme, font configuration, and overall ANSI escape code compatibility.
- While mdcat supports a wide range of Markdown features, some highly specific or custom Markdown extensions might not be rendered perfectly.
IMAGE RENDERING CAPABILITIES
A standout feature of mdcat is its ability to render images directly within the terminal, provided the terminal supports advanced graphics protocols like Sixel or iTerm2 inline images. This transforms the terminal viewing experience from plain text to a rich, multimedia display for Markdown documents containing visuals.
SYNTAX HIGHLIGHTING FOR CODE BLOCKS
mdcat automatically applies syntax highlighting to code blocks found within Markdown files. This dramatically improves the readability of code snippets, making it easier to review scripts, configuration files, or programming examples directly in the terminal without needing an external editor.
CONFIGURATION FILES
Users can customize mdcat's behavior and appearance through configuration files, typically located at ~/.config/mdcat/mdcat.toml. This allows for setting default themes, image rendering preferences, text width, and other options to tailor the viewing experience to individual needs.
HISTORY
mdcat is a relatively modern command-line utility, implemented in Rust, a language known for its performance and safety. It emerged to fill a niche for a dedicated, high-quality Markdown viewer for terminals, offering a more visually appealing and feature-rich experience than merely piping Markdown through generic text viewers or complex converters. Its development focuses on accurate rendering, good performance, and robust handling of various terminal features, making it a popular choice in the Rust CLI ecosystem.