markdown-to-pdf

$npx mdskill add staskh/trading_skills/markdown-to-pdf

Convert markdown files to professionally formatted PDFs using pure Python.

  • Users need to convert .md files to PDF without external system tools.
  • Uses mistune for markdown parsing and reportlab for PDF generation.
  • Accepts input file path and optional output path; defaults to input basename.
  • Returns JSON with success status, file paths, and timestamp; tells user the output path.

SKILL.md

.github/skills/markdown-to-pdfView on GitHub ↗
---
name: 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.
user_invocable: true
arguments:
  - name: file
    description: Path to the input markdown file
    required: true
  - name: output
    description: Output PDF path. Defaults to same directory and basename as the input file.
    required: false
dependencies: ["trading-skills"]
---

# 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

More from staskh/trading_skills

SkillDescription
earnings-calendarGet upcoming earnings dates with timing (before/after market) and EPS estimates. Use when user asks about earnings dates, earnings calendar, when a company reports, or upcoming earnings.
fundamentalsGet fundamental financial data including financials, earnings, and key metrics. Use when user asks about financials, earnings, revenue, profit, balance sheet, income statement, or company fundamentals.
greeksCalculate option Greeks (delta, gamma, theta, vega) and implied volatility for specific options. Use when user asks about Greeks, delta, gamma, theta, vega, IV, or option sensitivity analysis.
ib-accountGet account summary from Interactive Brokers including cash balance, buying power, and account value. Use when user asks about their account, balance, buying power, or available cash. Requires TWS or IB Gateway running locally.
ib-collarGenerate tactical collar strategy reports for protecting PMCC positions through earnings or high-risk events. Requires TWS or IB Gateway running locally.
ib-create-consolidated-reportConsolidate IBRK trade CSV files from a directory into a summary report. Groups trades by symbol, underlying, date, strike, buy/sell, and open/close. Outputs both markdown and CSV.
ib-find-short-rollFind roll options for existing short positions OR find best covered call/put to open against long stock. Use when user asks about rolling shorts, finding roll candidates, writing covered calls, or managing option positions. Requires TWS or IB Gateway running locally.
ib-option-chainGet option chain data from Interactive Brokers for equities, ETFs, and futures (FOP), including calls and puts with strikes, bids, asks, volume, implied volatility, and model Greeks. Use when user asks about options using IBKR data, futures options (NQ/ES/CL/GC...), or needs real-time option quotes from their broker. Requires TWS or IB Gateway running locally.
ib-pmcc-advisorAnalyze PMCC (Poor Man's Covered Call / diagonal spread) positions from IB portfolio. For each diagonal spread, reports short leg risk (delta, IV, assignment probability), daily P&L projections, top-3 roll candidates, and a side-by-side comparison table. Requires TWS or IB Gateway running locally.
ib-portfolioGet portfolio positions from Interactive Brokers. Use when user asks about their portfolio, positions, holdings, or what stocks they own. Requires TWS or IB Gateway running locally.