Skip to content

Add cheatsheet-pdf plugin#4

Open
wesnick wants to merge 1 commit into
mainfrom
add-cheatsheet-pdf-plugin
Open

Add cheatsheet-pdf plugin#4
wesnick wants to merge 1 commit into
mainfrom
add-cheatsheet-pdf-plugin

Conversation

@wesnick

@wesnick wesnick commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What

Adds a new cheatsheet-pdf plugin: renders a Markdown document into a compact, print-ready PDF cheatsheet — a dense single-page (or single-sheet, two-sided) reference — via pandoc → HTML → headless Chromium.

It grew out of a real task (turning a tool cheatsheet into a one-page printable PDF), generalized into a reusable, evals-backed skill.

Why it's more than a wrapper

The headline feature is auto-fit: instead of hand-tuning font sizes until content fits, build_cheatsheet.py binary-searches the largest uniform zoom whose render still respects --max-pages (default 1). The result fills the sheet as much as possible without spilling — the same outcome as manual tuning, found in ~7 renders.

The SKILL.md teaches the two non-obvious layout traps as durable knowledge (per the "explain WHY" bar in AGENTS.md):

  • table-layout: fixed — without it a wide table sizes past its column and paints over the neighbouring column (text-on-text overlap).
  • Title outside the column flow — a column-spanning title element corrupts downstream layout positions; rendering it as a full-width banner above .cols avoids that.

Contents

plugins/cheatsheet-pdf/
├── .claude-plugin/plugin.json
├── package.json
├── README.md
└── skills/cheatsheet-pdf/
    ├── SKILL.md
    ├── assets/cheatsheet.css        # the print stylesheet (the look)
    └── scripts/build_cheatsheet.py  # stdlib-only, uv run

Plus standard registration: .codex/skills/cheatsheet-pdf sidecar symlink, marketplace.json entry, root README catalog row (new Documents category), CODEOWNERS, and a 4-case eval suite in evals/cases/cheatsheet-pdf/ (positive / two-sided / negative-longform / edge-overlap).

Requirements

External tools on PATH (not packages): pandoc and a Chromium browser (google-chrome, chromium, …). The script is stdlib-only and names no harness-specific tools — runs the same under Claude Code, Codex, and pi.

Verification

  • just validate — plugin metadata, frontmatter, codex sidecar: all in sync
  • just lintruff check + ruff format --check: clean
  • just stats — 6/6 skills have eval coverage; cheatsheet-pdf: 4 cases
  • End-to-end run against a real cheatsheet: 1 page at zoom 1.004 ✓

PR checklist

  • Valid frontmatter; kebab-case name matches directory
  • ## When to Use / ## When NOT to Use present
  • Anti-patterns documented with reasoning
  • positive + negative + edge eval cases
  • README harness-support section
  • Registered in marketplace.json, README, CODEOWNERS
  • Codex sidecar symlink
  • No hardcoded absolute paths

🤖 Generated with Claude Code

Renders a Markdown document into a compact, print-ready PDF cheatsheet
(dense single-page, or single-sheet two-sided) via pandoc → HTML →
headless Chromium.

The bundled build_cheatsheet.py automates the density tuning: it binary-
searches the largest uniform zoom whose render still fits --max-pages, so
the sheet fills the page without spilling. Stdlib-only; shells out to
pandoc and a Chromium browser, naming no harness-specific tools.

The SKILL.md captures the two non-obvious layout traps as durable
knowledge: table-layout:fixed (wide tables otherwise overflow and paint
over the neighbouring column) and rendering the title outside the column
flow (a column-spanning title corrupts downstream positions).

Includes the standard registration: codex sidecar symlink, marketplace
and README catalog entries, CODEOWNERS, and a 4-case eval suite
(positive / two-sided / negative-longform / edge-overlap). Passes
validate, lint, and stats.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant