markdown-to-pdf

markdown-to-pdf is a skill for Claude Code, Codex from cosmicstack-labs/mercury-agent-skills. It costs 25 tokens per session (7,731 once invoked), scanned A, original, MIT.

A document-conversion toolkit that turns Markdown files into PDFs using tools such as Pandoc, WeasyPrint, ReportLab, and browser-based converters. It also covers print styling, templates, and batch conversion.

In plain words
What is it for?
Use it for reports, papers, books, branded documents, and repeated Markdown-to-PDF conversions.
Why use it?
It helps you produce consistent PDFs without manually recreating Markdown documents in a page-layout tool.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for reports, papers, books, branded documents, and repeated Markdown-to-PDF conversions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cosmicstack-labs/mercury-agent-skills/markdown-to-pdf
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cosmicstack-labs/mercury-agent-skills --skill markdown-to-pdf
Clone the repo
git clone --depth 1 https://github.com/cosmicstack-labs/mercury-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for markdown-to-pdf

README.md
[![agentmods](https://agentmods.dev/badge/skills/cosmicstack-labs/mercury-agent-skills/markdown-to-pdf/github.svg)](https://agentmods.dev/skills/cosmicstack-labs/mercury-agent-skills/markdown-to-pdf)
Your own site
<a href="https://agentmods.dev/skills/cosmicstack-labs/mercury-agent-skills/markdown-to-pdf"><img src="https://agentmods.dev/badge/skills/cosmicstack-labs/mercury-agent-skills/markdown-to-pdf/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for markdown-to-pdf

Your own site · 80×15
<a href="https://agentmods.dev/skills/cosmicstack-labs/mercury-agent-skills/markdown-to-pdf"><img src="https://agentmods.dev/badge/skills/cosmicstack-labs/mercury-agent-skills/markdown-to-pdf.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,731 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00025 $0.07731
Opus 5 $0.00013 $0.03866
Sonnet 5 $0.00005 $0.01546
Haiku 4.5 $0.00003 $0.00773

Measured 6d ago against content hash db838600d0b5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

markdown-to-pdf scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

categories/pdf-generation/markdown-to-pdf/SKILL.md · 1,096 lines

How it starts

The opening of the file, as written. The whole thing — 1,096 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Markdown to PDF Conversion

Convert Markdown documents into polished, production-ready PDFs. This skill covers the major toolchains — Pandoc, WeasyPrint, ReportLab — plus CSS print styling, template systems, and batch conversion workflows.


Toolchain Overview

Tool Approach Best For Output Quality
Pandoc Markdown → PDF via LaTeX/Context/Wkhtmltopdf Books, papers, reports High
WeasyPrint Markdown → HTML → PDF via CSS print Web-like documents, branded PDFs High
ReportLab Programmatic PDF generation via Python Dynamic, data-driven PDFs Very High
md-to-pdf Node.js CLI for quick markdown → PDF Simple documents, quick output Medium
Puppeteer/Playwright Markdown → HTML → Headless browser → PDF Pixel-perfect web-to-PDF Very High

1. Pandoc Workflows

Pandoc is the Swiss Army knife of document conversion. It reads Markdown and outputs PDF via an intermediate engine (default: LaTeX).

Basic Conversion

# Simple markdown to PDF (uses pdflatex)
pandoc input.md -o output.pdf

# With metadata file
pandoc input.md --metadata-file=metadata.yaml -o output.pdf

# Specify output engine
pandoc input.md --pdf-engine=xelatex -o output.pdf

# Using wkhtmltopdf instead of LaTeX
pandoc input.md --pdf-engine=wkhtmltopdf -o output.pdf

Advanced Pandoc with Templates

# Custom LaTeX template
pandoc input.md \
  --template=custom-template.tex \
  --pdf-engine=xelatex \
  --toc \
  --number-sections \
  -o output.pdf

# With bibliography
pandoc input.md \
  --bibliography=references.bib \
  --csl=ieee.csl \
  --citeproc \
  -o output.pdf

# Custom font and margins
pandoc input.md \
  -V geometry:"top=2cm, bottom=2cm, left=2.5cm, right=2.5cm" \
  -V mainfont="Times New Roman" \
  -V fontsize=12pt \
  -o output.pdf

Metadata YAML for Pandoc

# metadata.yaml
---
title: "Technical Report on Distributed Systems"
author:
  - "Jane Doe"
  - "John Smith"
date: "2025-01-15"
subtitle: "Performance Analysis of Event-Driven Architectures"
abstract: |
  This report analyzes the performance characteristics of event-driven
  architectures in distributed systems, comparing Apache Kafka, RabbitMQ,
  and AWS SQS across latency, throughput, and fault tolerance metrics.
keywords: [distributed-systems, event-driven, kafka, rabbitmq, performance]
lang: en-US
geometry:
  - top=25mm
  - bottom=25mm
  - left=30mm
  - right=25mm
fontsize: 11pt
mainfont: "DejaVu Serif"
monofont: "DejaVu Sans Mono"
toc: true
toc-depth: 3
numbersections: true
linestretch: 1.5
---

Read the full file on GitHub · 1,096 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 1,096 lines · 25 tokens per session scan A db838600d0b5

Subscribe to this mod's changes

markdown-to-pdf is a skill published in the GitHub repository cosmicstack-labs/mercury-agent-skills (470 stars, last pushed 16d ago), licensed MIT. It adds 25 tokens to every session and 7,731 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

pdf

A set of instructions for working with PDF files, which are documents designed to preserve their layout across devices.

agentscope-ai/QwenPaw · 95 tokens

graphic-ebook

Creates professionally designed B2B SaaS e-books in HTML + CSS, exported as print-ready PDF. 3–10 pages, 9 style presets, 11 page layout types. Trigger when user says "create an ebook", "design a lead magnet", "make a PDF guide", "build a gated content piece", "write a B2B ebook", "design a white paper", "create a…

Varnan-Tech/opendirectory · 97 tokens

arxiv-preflight

Pre-submission validation audit for arXiv papers across TeX source, PDF, figures, metadata, bibliography, file organization, and common-error scans. Produces pass/fail report with specific fixes per arXiv requirement. Triggers on: "check my arXiv submission", "validate for arXiv", "arXiv preflight", "ready for arXiv"…

Mathews-Tom/armory · 120 tokens

md-to-pdf

Convert Markdown to styled PDFs with Mermaid diagrams, LaTeX/KaTeX math, tables, and code highlighting. Triggers on: "convert markdown to pdf", "make a pdf from this md", "export markdown as pdf", "pdf from markdown with equations".

Mathews-Tom/armory · 60 tokens

marp-slides

Author MARP markdown slide decks exportable to PDF, PPTX, and HTML via marp-cli. Covers Marpit directives, custom CSS themes, SVG chart recipes, and dashboard components. Triggers on: "marp", "marp deck", "markdown slides", "slides from markdown", "marp-cli", "pdf from markdown", "pptx from markdown".

Mathews-Tom/armory · 81 tokens

iflytek-ocr-invoice

An image-reading tool that extracts structured information from Chinese invoices, receipts, bills, and tickets. OCR means turning text in a photo or scan into computer-readable data.

iflytek/iFly-Skills · 77 tokens