pdf2-md

pdf2-md is a skill for Claude Code, Codex from yuhaoliu7456/pdf2md-skill. It costs 63 tokens per session (2,964 once invoked), scanned A, original, MIT.

A tool for converting academic research papers from PDF into structured Markdown, including text, tables, figures, and equations.

In plain words
What is it for?
Use it to render PDF pages as images, inspect them, and produce a complete Markdown document with headings, reading order, figures, tables, and LaTeX.
Why use it?
It avoids relying on plain text extraction when a paper's layout, diagrams, tables, or mathematical notation must be preserved.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to render PDF pages as images, inspect them, and produce a complete Markdown document with headings, reading order, figures, tables, and LaTeX.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yuhaoliu7456/pdf2md-skill/pdf2md-skill
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 yuhaoliu7456/pdf2md-skill --skill pdf2md-skill
Clone the repo
git clone --depth 1 https://github.com/yuhaoliu7456/pdf2md-skill

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 pdf2-md

README.md
[![agentmods](https://agentmods.dev/badge/skills/yuhaoliu7456/pdf2md-skill/pdf2md-skill/github.svg)](https://agentmods.dev/skills/yuhaoliu7456/pdf2md-skill/pdf2md-skill)
Your own site
<a href="https://agentmods.dev/skills/yuhaoliu7456/pdf2md-skill/pdf2md-skill"><img src="https://agentmods.dev/badge/skills/yuhaoliu7456/pdf2md-skill/pdf2md-skill/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 pdf2-md

Your own site · 80×15
<a href="https://agentmods.dev/skills/yuhaoliu7456/pdf2md-skill/pdf2md-skill"><img src="https://agentmods.dev/badge/skills/yuhaoliu7456/pdf2md-skill/pdf2md-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,964 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.
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.00063 $0.02964
Opus 5 $0.00032 $0.01482
Sonnet 5 $0.00013 $0.00593
Haiku 4.5 $0.00006 $0.00296

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

Security

Grade A, and why

pdf2-md 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 9d 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.

SKILL.md · 327 lines

How it starts

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

PDF-to-Markdown: Academic Paper Conversion

Convert a PDF paper into a single Markdown file by sending pages as images to the LLM and reconstructing the full document.

Strategy Overview

  1. Render each PDF page to a high-quality image (PNG, 200 DPI)
  2. Send images to the LLM (yourself) page by page or in batches
  3. Reconstruct the complete Markdown with correct reading order, headings, figures, tables, and LaTeX equations

Step 0 — Confirm Input

  • Ask the user for the PDF path if not already provided.
  • Determine output location: default to <pdf_stem>/content.md next to the PDF.

Step 1 — Render PDF Pages to Images

Use pdftoppm (Poppler) to render each page to PNG:

mkdir -p /tmp/pdf2md_pages
pdftoppm -png -r 200 "<pdf_path>" /tmp/pdf2md_pages/page

If pdftoppm is unavailable, use PyMuPDF as fallback:

import fitz
doc = fitz.open(pdf_path)
for i, page in enumerate(doc):
    pix = page.get_pixmap(dpi=200)
    pix.save(f"/tmp/pdf2md_pages/page-{i+1:03d}.png")
doc.close()

Verify image count matches expected page count.

Step 2 — Page-by-Page LLM Extraction

Read each rendered page image and extract its content. For each page, apply these rules:

2.1 Reading Order

  • For two-column layouts: left column first, then right column, top to bottom.
  • Full-width elements (title, abstract, full-width figures) at their natural vertical position.

2.2 Heading Hierarchy

CRITICAL: Do NOT assign heading levels by font size alone. Font size only provides initial hints. You MUST determine the final hierarchy by semantic context — the parent-child nesting of sections.

Two-pass approach:

  1. First pass (per-page): Tag each heading candidate with its visual weight (font size, bold, numbering pattern) and approximate level.
  2. Second pass (whole-document): After all pages are processed, review the full heading list and correct levels based on these rules:

Rules for heading level assignment:

  • # — Paper title only (exactly one).
  • ## — Top-level sections. Identify these by: (a) they appear in the paper's logical flow as major divisions (Abstract, Introduction, Related Work, Method, Experiments, Conclusion, Acknowledgments, References); (b) they typically share the same font size/weight; (c) numbered sections at the same depth (1, 2, 3…) are all ##.
  • ### — Subsections that live inside a ## section. Identified by sub-numbering (3.1, 3.2) or smaller/different font weight under a parent.
  • #### — Sub-subsections (3.1.1) or paragraph-level bold headings.

Read the full file on GitHub · 327 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. 9d ago First seen · 327 lines · 63 tokens per session scan A 4ac6859dc6e0

Subscribe to this mod's changes

pdf2-md is a skill published in the GitHub repository yuhaoliu7456/pdf2md-skill (5 stars, last pushed 5mo ago), licensed MIT. It adds 63 tokens to every session and 2,964 once invoked, about $0.0003 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-08-31.

Related

Other skills, from other repositories