md-to-pdf

Converts markdown files into professionally styled PDF documents. Use this skill whenever the user asks to generate a PDF, export markdown as PDF, convert .md to .pdf, or create a printable version of a document. Also triggers when the user wants status-colored tables, styled documentation export, or says things like "make this a PDF", "I need a PDF version", "export this doc". Supports auto orientation, optional keyword-based cell coloring, and graceful engine fallback.

7 stars

Best use case

md-to-pdf is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Converts markdown files into professionally styled PDF documents. Use this skill whenever the user asks to generate a PDF, export markdown as PDF, convert .md to .pdf, or create a printable version of a document. Also triggers when the user wants status-colored tables, styled documentation export, or says things like "make this a PDF", "I need a PDF version", "export this doc". Supports auto orientation, optional keyword-based cell coloring, and graceful engine fallback.

Teams using md-to-pdf should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/md-to-pdf/SKILL.md --create-dirs "https://raw.githubusercontent.com/madebyecho/agent-skills/main/.agents/skills/md-to-pdf/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/md-to-pdf/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How md-to-pdf Compares

Feature / Agentmd-to-pdfStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Converts markdown files into professionally styled PDF documents. Use this skill whenever the user asks to generate a PDF, export markdown as PDF, convert .md to .pdf, or create a printable version of a document. Also triggers when the user wants status-colored tables, styled documentation export, or says things like "make this a PDF", "I need a PDF version", "export this doc". Supports auto orientation, optional keyword-based cell coloring, and graceful engine fallback.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Markdown to PDF

Convert any markdown file into a clean, professionally styled PDF. Handles tables, code blocks, blockquotes, and deep heading hierarchies out of the box. Optionally color-codes table cells based on status keywords.

## When to Apply

Reference these guidelines when:
- The user asks to convert a markdown file to PDF
- The user wants a printable or shareable version of a document
- The user asks to "export", "generate PDF", or "make a PDF"
- The user wants styled tables with color-coded status cells
- The user needs landscape orientation for wide tables

## How It Works

This skill bundles a Python script (`scripts/md_to_pdf.py`) that handles the full conversion pipeline:

```
Markdown → HTML (via markdown2) → Styled HTML → PDF (via weasyprint or xhtml2pdf)
```

**Always run the bundled script** rather than writing conversion code inline. This ensures consistent styling and avoids reinventing the wheel each time.

## Quick Start

Basic conversion — the script auto-detects the best orientation:

```bash
python3 <skill-path>/scripts/md_to_pdf.py input.md output.pdf
```

With status cell coloring (colors the table cells, not the text):

```bash
python3 <skill-path>/scripts/md_to_pdf.py input.md output.pdf --status-colors
```

Force landscape or portrait:

```bash
python3 <skill-path>/scripts/md_to_pdf.py input.md output.pdf --landscape
python3 <skill-path>/scripts/md_to_pdf.py input.md output.pdf --portrait
```

Custom status keywords and colors:

```bash
python3 <skill-path>/scripts/md_to_pdf.py input.md output.pdf --status-colors \
  --custom-colors '{"APPROVED": "#d4edda:#155724", "REJECTED": "#f8d7da:#721c24"}'
```

## Features

### Auto Orientation

The script scans for tables in the markdown. If any table has 4 or more columns, it defaults to landscape. Otherwise, portrait. The user can always override with `--landscape` or `--portrait`.

### Status Cell Coloring

When `--status-colors` is passed, the script identifies table cells in the **Status column** that contain bold keywords and applies background colors to the entire cell. This is column-aware — it only targets cells in columns named "Status", not every bold word in the document.

Built-in keyword → color mappings:

| Keyword | Background | Text Color | Use Case |
|---|---|---|---|
| EXISTS | `#d4edda` (green) | `#155724` | Available, implemented |
| MISSING | `#f8d7da` (red) | `#721c24` | Not available, needed |
| PARTIAL | `#fff3cd` (yellow) | `#856404` | Partially available |
| TODO | `#fff3cd` (yellow) | `#856404` | Pending work |
| DONE | `#d4edda` (green) | `#155724` | Completed |
| CLIENT-SIDE | `#d1ecf1` (blue) | `#0c5460` | Handled by client |
| NEEDS CLARIFICATION | `#e8daef` (purple) | `#512e5f` | Requires discussion |
| WARNING | `#fff3cd` (yellow) | `#856404` | Caution |
| ERROR | `#f8d7da` (red) | `#721c24` | Failure |
| N/A | `#e2e3e5` (gray) | `#495057` | Not applicable |

Users can add or override mappings with `--custom-colors`.

### Engine Fallback

The script tries `weasyprint` first (better CSS support, proper page breaks, modern rendering). If weasyprint is not installed, it falls back to `xhtml2pdf` (pure Python, always installable). If neither is available, the script prints install instructions and exits — it does not auto-install packages.

**Before first use, install dependencies explicitly:**

```bash
pip install markdown2==2.5.3
pip install weasyprint          # recommended
# OR
pip install xhtml2pdf==0.2.16   # pure Python fallback
```

### Page Breaks

Each `## ` (h2) heading starts on a new page for long documents. This keeps sections cleanly separated in the PDF output.

## Default Styling

The generated PDF includes sensible defaults:
- **Font**: Helvetica / Arial sans-serif, 9px body
- **Headings**: Scaled sizes (h1: 20px → h4: 10px), h1/h2 with bottom borders
- **Tables**: Collapsed borders, dark header row (`#2c3e50` background, white text), alternating row colors
- **Code blocks**: Light gray background, monospace font
- **Blockquotes**: Left blue border, light background
- **Page margins**: 1.5cm on all sides

## Arguments Reference

| Argument | Required | Default | Description |
|---|---|---|---|
| `input` | Yes | — | Path to the markdown file |
| `output` | No | `<input>.pdf` | Output PDF path. Defaults to same name with .pdf extension |
| `--landscape` | No | Auto | Force landscape orientation |
| `--portrait` | No | Auto | Force portrait orientation |
| `--status-colors` | No | Off | Enable status keyword cell coloring |
| `--custom-colors` | No | — | JSON string of custom keyword → color mappings. Format: `'{"KEYWORD": "#bg:#text"}'` |

## Troubleshooting

**Tables look clipped or overflow**: Try `--landscape` to give tables more horizontal space.

**Status colors not appearing**: Make sure you passed `--status-colors`. The feature is off by default. Also verify that the status keywords are wrapped in `**bold**` in the markdown source.

**weasyprint won't install**: It requires system libraries (cairo, pango). On macOS: `brew install cairo pango`. On Ubuntu: `apt install libcairo2-dev libpango1.0-dev`. If you can't install them, the script falls back to xhtml2pdf automatically.

**Fonts look different**: weasyprint uses system fonts, xhtml2pdf uses built-in PDF fonts. Results may vary slightly between engines.

Related Skills

swift-accessibility

7
from madebyecho/agent-skills

Automatically applies accessibility best practices to Swift projects (SwiftUI and UIKit). Use when working on iOS/macOS projects that need VoiceOver support, Dynamic Type, WCAG compliance, or accessibility audits. Triggers on Swift accessibility tasks, a11y improvements, or when the user mentions accessibility, VoiceOver, or Dynamic Type.

react-native-skia-shaders

7
from madebyecho/agent-skills

Comprehensive SKSL (Skia Shading Language) shader techniques for react-native-skia — ray marching, SDF modeling, procedural noise, lighting, post-processing, image filters, BackdropFilter, child shaders, gesture- and Reanimated-driven uniforms. Triggers on tasks involving Shader, RuntimeEffect, SKSL, custom visual effects, animated backgrounds, image distortion, blur, glow, glass / liquid effects, or any request to "write a shader" in a React Native or Expo app using @shopify/react-native-skia.

react-native-animations

7
from madebyecho/agent-skills

Encodes motion design and animation engineering philosophy for React Native apps using Reanimated, Gesture Handler, and Skia. Use when building or reviewing mobile animations, gestures, transitions, or interactive UI polish. Triggers on animation tasks, micro-interactions, gesture handling, or when the user mentions Reanimated, worklets, shared values, Skia, or mobile motion.

react-native-accessibility

7
from madebyecho/agent-skills

Automatically applies accessibility best practices to React Native and Expo projects. Use when working on mobile apps that need VoiceOver (iOS) or TalkBack (Android) support, WCAG compliance, or accessibility audits. Triggers on React Native accessibility tasks, a11y improvements, or when the user mentions accessibility, VoiceOver, TalkBack, or screen reader support.

skill-creator

7
from madebyecho/agent-skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, update or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

workspace-surface-audit

144923
from affaan-m/everything-claude-code

Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup, then recommend the highest-value ECC-native skills, hooks, agents, and operator workflows. Use when the user wants help setting up Claude Code or understanding what capabilities are actually available in their environment.

DevelopmentClaude

ui-demo

144923
from affaan-m/everything-claude-code

Record polished UI demo videos using Playwright. Use when the user asks to create a demo, walkthrough, screen recording, or tutorial video of a web application. Produces WebM videos with visible cursor, natural pacing, and professional feel.

Developer ToolsClaude

token-budget-advisor

144923
from affaan-m/everything-claude-code

Offers the user an informed choice about how much response depth to consume before answering. Use this skill when the user explicitly wants to control response length, depth, or token budget. TRIGGER when: "token budget", "token count", "token usage", "token limit", "response length", "answer depth", "short version", "brief answer", "detailed answer", "exhaustive answer", "respuesta corta vs larga", "cuántos tokens", "ahorrar tokens", "responde al 50%", "dame la versión corta", "quiero controlar cuánto usas", or clear variants where the user is explicitly asking to control answer size or depth. DO NOT TRIGGER when: user has already specified a level in the current session (maintain it), the request is clearly a one-word answer, or "token" refers to auth/session/payment tokens rather than response size.

Productivity & Content CreationClaude

skill-comply

144923
from affaan-m/everything-claude-code

Visualize whether skills, rules, and agent definitions are actually followed — auto-generates scenarios at 3 prompt strictness levels, runs agents, classifies behavioral sequences, and reports compliance rates with full tool call timelines

DevelopmentClaude

santa-method

144923
from affaan-m/everything-claude-code

Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.

Quality AssuranceClaude

safety-guard

144923
from affaan-m/everything-claude-code

Use this skill to prevent destructive operations when working on production systems or running agents autonomously.

DevelopmentClaude

repo-scan

144923
from affaan-m/everything-claude-code

Cross-stack source code asset audit — classifies every file, detects embedded third-party libraries, and delivers actionable four-level verdicts per module with interactive HTML reports.

DevelopmentClaude