added readme

This commit is contained in:
Ian Griffin 2025-11-12 20:38:45 +08:00
parent 4543cecb6c
commit 8cdcfabd8e
1 changed files with 60 additions and 0 deletions

60
README.md Normal file
View File

@ -0,0 +1,60 @@
# 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
```bash
pip install . # Installs the package and the console script
```
---
## Usage
### As a commandline tool
```bash
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
```python
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`.