lightweight and simple CLI and library for colorful Markdown in the terminal
Go to file
Ian Griffin 8cdcfabd8e added readme 2025-11-12 20:38:45 +08:00
.gitignore changed name to print_md 2025-11-12 20:25:57 +08:00
COPYING.md initial commit 2025-11-12 19:19:45 +08:00
README.md added readme 2025-11-12 20:38:45 +08:00
print_md.py simplified project structure 2025-11-12 20:27:45 +08:00
pyproject.toml changed name to print_md 2025-11-12 20:25:57 +08:00

README.md

print_md

A lightweight and simple CLI and library for colorful Markdown in the terminal

print_md is a tiny tool that takes regular Markdown and renders it to the terminal using ANSI escape codes. The output is styled with colours and typographic attributes (bold, underline, etc.) so that a Markdown file looks more pleasant when viewed directly from the console.

The project ships two entry points:

  • Commandline a small script that reads files passed on the command line and prints them to stdout.
  • Python API the render() function can be imported from the print_md package and used in any Python program.

Both approaches use the same rendering logic and share the same colour configuration, so the output is identical no matter how you invoke it.


Installation

pip install .   # Installs the package and the console script

Usage

As a commandline tool

print_md intro.md how-to.md README.md

If you pass multiple files, each will be rendered sequentially:

The script accepts a single positional argument the path to a Markdown file or a glob pattern. No additional flags are required.

Using the Python API

from print_md import render

sample = """
# Title

Hello, **world**!  This is a _test_.

> A quote

```python
print('Hello')

"""

print(render(sample))


The `render` function returns a string that contains the ANSIstyled
representation of the Markdown content.  You can pipe that string to any
function that expects terminal output, such as `print()` or `sys.stdout.write`.