md2p
Markdown to Print (md2p)
md2p is a small command-line utility for rendering Markdown files to the terminal, using ANSI (or nroff) escape sequences for styling. It is intended as a lightweight helper to preview Markdown content without leaving the terminal.
Version
Current version: 1.0.2
Features
- Renders to stdout with ANSI colour/style escapes, or nroff overstrike sequences via --nroff
- Simple CLI usage with a Markdown file path, or via stdin
- Supported Markdown elements:
- ATX headers #–###### (each level styled distinctly) and setext headers (===/---)
- Horizontal rules, blockquotes, fenced code blocks ( /~~~)
- Ordered and unordered lists, including nested indentation
- Tables, rendered as bordered ASCII grids
- Inline formatting: bold, italic, bold+italic, inline code, links, images
- Non-printable bytes and hidden Unicode variation selectors (a common vector for invisible watermarks/payloads) are never passed through silently — each is replaced with a visible hex marker (see example below)
- Input is capped at 50 MB and raw ANSI escapes in the source file are stripped before rendering, so a malicious Markdown file can't inject terminal escape sequences
Installation
- Ensure you have Python 3.8+ installed.
- (Optional) Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activateThere are no external dependencies required by default.
From PyPI
pip install md2p
# or, without installing into an environment:
uvx md2p README.mdLinux (user install)
To install md2p for your user on Linux, use the included install.sh to copy the script to ~/.local/bin (or your XDGBINHOME):
chmod +x install.sh
./install.sh
# or specify destination explicitly
./install.sh --dest "$HOME/.local/bin"Uninstall with: