From document
Create dense, printable A4 landscape cheatsheets from Markdown using a custom syntax with multi-column layout. Use when the user asks to create a cheatsheet, revision sheet, crib sheet, or condensed reference document for exams, courses, or technical topics. Supports math formulas, tables, highlights, notes, and multi-page output. Converts Markdown to styled HTML and exports to PDF for printing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/document:cheatsheetThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create dense, printable A4 landscape cheatsheets (297mm x 210mm, 5 columns, 6pt font) from a custom Markdown dialect.
Create dense, printable A4 landscape cheatsheets (297mm x 210mm, 5 columns, 6pt font) from a custom Markdown dialect.
Content → Write .md (custom syntax) → Run md2html.py → .html → Export PDF → Print
.md file with front matter and content (see Syntax below)python3 scripts/md2html.py input.md -o output.htmlFor complete syntax details, see references/cheatsheet_spec.md.
| Syntax | Result |
|---|---|
# Title | Blue section header banner |
## Title | Red inline subsection header (first paragraph joins inline) |
---PAGE--- | Page break (new A4 page) |
> text | Green note box |
| a | b | | Table (with |---| separator = blue header) |
| Blank line | Paragraph separator |
| Syntax | Result |
|---|---|
**bold** | Bold |
$formula$ | Blue italic math |
$=key formula=$ | Yellow-highlighted math |
==key text== | Yellow highlight |
@@inline title@@ | Red inline header (no break-avoid) |
^{text} | Superscript |
_{text} | Subscript |
~{text}~ | Grey small text |
---
title: My Cheat Sheet
subtitle:
---
# Section Title
## Subsection
First paragraph joins inline with title. $formula$ and **bold**.
Second paragraph is separate. ==highlight==.
## Another Subsection
| Col1 | Col2 |
|------|------|
| data | data |
> Important note
---PAGE---
# Page 2 Section
...
auto — left-to-right, top-to-bottomhidden — content beyond page boundary is silently lost## block stays intact (won't split across columns), causing small gaps at column bottomswc -l to track line count during editing→ ≈ ∈ ⊙ Σ Π ∂ ≤ ≥ ² ³## blocks small (1-3 paragraphs) to minimize column-bottom gaps## sections@@sub-title@@ for sub-headers within a ## block (avoids creating new break-avoid)Work one page at a time. Do NOT write all pages at once.
---PAGE--- yet)md2html.py → open HTML → verify all 5 columns are filled---PAGE--- and start Page 2 contentWhy page-by-page? Writing everything at once makes it hard to judge density. Tables and
##break-avoid blocks consume unpredictable vertical space. Filling one page at a time ensures every page uses all 5 columns with no overflow.
The converter script (scripts/md2html.py) is zero-dependency Python:
python3 scripts/md2html.py input.md -o output.html
Open output.html in a browser to preview. The CSS renders the exact print layout on screen.
Open HTML in Chrome/Safari → Ctrl+P (Cmd+P on Mac):
When browser print is unavailable, use Playwright to capture high-resolution screenshots and convert to PDF with Pillow. This bypasses CSS print pagination issues.
# 1. Start HTTP server in the directory with the HTML file
# python3 -m http.server 8765
# 2. Playwright: capture each .page element at 4x scale
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
ctx = browser.new_context(
viewport={"width": 1122, "height": 794},
device_scale_factor=4
)
page = ctx.new_page()
page.goto("http://localhost:8765/output.html")
page.wait_for_load_state("networkidle")
pages_el = page.locator(".page")
for i in range(pages_el.count()):
pages_el.nth(i).screenshot(path=f"page{i+1}.png")
browser.close()
# 3. Convert to PDF with Pillow
from PIL import Image
A4_W, A4_H = 3508, 2480 # 300 DPI A4 landscape
images = []
for i in range(num_pages):
img = Image.open(f"page{i+1}.png")
img = img.resize((A4_W, A4_H), Image.LANCZOS).convert("RGB")
images.append(img)
images[0].save(
"output.pdf", "PDF", resolution=300.0,
save_all=True, append_images=images[1:]
)
Do NOT use Chrome headless --print-to-pdf or Playwright page.pdf() — these fail to render multi-page .page divs correctly (second page renders blank).
| Issue | Solution |
|---|---|
| Content invisible / cut off | overflow: hidden — reduce content or add ---PAGE--- |
| Large column-bottom gaps | Break ## blocks into smaller ones (1-3 paragraphs) |
| Table overflows column | Shorten cell text, remove backtick formatting, abbreviate |
| in formulas parsed as table | Use ‖ or · instead of | inside table cells |
| Second PDF page blank | Use screenshot-to-PDF method, NOT Chrome print-to-pdf |
| Content not enough / right columns empty | Add more content to fill ~380 lines per page |
After generating HTML, verify:
scrollHeight ≈ clientHeight for each .page div (check via browser DevTools)== and $= =$ backgrounds visibleGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub davie521/claude-skills --plugin document