📖 Usage

contextpack-md can be used both as a CLI tool and a Python library.

CLI Usage

Basic Extraction (assuming you downloaded the cli)

Extract content from a URL directly to your terminal.

contextpack-md web https://docs.python.org/3/

Save to Cache

Store the output in ~/.contextpack-md/ with a timestamped name.

contextpack-md web https://docs.python.org/3/ --write

PDF to Markdown

Download and convert a PDF. This requires marker-pdf (automatically installed if using the pdf extra).

contextpack-md pdf https://arxiv.org/pdf/1706.03762.pdf

Clearing the Cache

Remove all stored content in ~/.contextpack-md/.

contextpack-md clear

Python API Usage

If you're building your own tool, you can use contextpack-md programmatically.

from contextpack-md import get_url_context

# Fetch and scrape a URL
content = get_url_context("https://python.org")

if content:
    print(content)