---
name: staskh-markdown-to-pdf
description: "Convert a markdown file to PDF using mistune + reportlab. Use when the user wants to convert a .md file to PDF, or when another skill needs to produce a PDF from markdown output."
license: "MIT"
metadata:
  decimalai-skill-id: "122982c6-638c-4dd4-bc5e-44c824ea6fca"
  decimalai-version-id: "9ed895ac-9f7e-4ff1-9e02-3c8f01bec041"
  decimalai-version: "1"
  decimalai-body-sha256: "84f5a61c6052a5d2029e168179ab8f97638de23f1a3efd8a2521e2f4dfe29a53"
  decimalai-name: "staskh/markdown-to-pdf"
  decimalai-format: "1"
  decimalai-invocation: "model"
  decimalai-category: "documentation"
  decimalai-source: "https://app.decimal.ai/s/staskh-markdown-to-pdf@1/SKILL.md"
---
# Markdown to PDF Converter

Converts a markdown file to a professionally formatted PDF. Pure Python — no system tools required.

## Dependencies

Requires two Python packages (already in `pyproject.toml`):

```
mistune>=3.2
reportlab>=4.0
```

Install with: `uv sync` (or `pip install mistune reportlab`)

## Instructions

```bash
uv run python .claude/skills/markdown-to-pdf/scripts/markdown_to_pdf.py <input.md> [output.pdf]
```

- `input.md` — path to the markdown file (required)
- `output.pdf` — output path (optional; defaults to same directory and basename as input)

## Output

The script returns JSON with:
- `success` — `true` or `false`
- `input` — resolved absolute path of the input file
- `output` — resolved absolute path of the generated PDF
- `error` — error message if `success` is `false`
- `generated_at` — NY timezone timestamp
- `data_delay` — always `"real-time"`

After conversion, tell the user the output PDF path.

## Examples

```bash
# Convert sandbox/report.md → sandbox/report.pdf (default output)
uv run python .claude/skills/markdown-to-pdf/scripts/markdown_to_pdf.py sandbox/report.md

# Explicit output path
uv run python .claude/skills/markdown-to-pdf/scripts/markdown_to_pdf.py sandbox/report.md sandbox/AAPL_Report_2026-05-20_1430.pdf
```

## Supported Markdown

- Headings (H1–H3)
- Paragraphs, bold, italic
- Tables (pipe syntax)
- Fenced code blocks
- Unordered and ordered lists
