Generate a visually polished, content-rich PDF document on any topic, or convert an existing Markdown file to a professionally styled PDF. Produces publication-quality A4 PDFs with professional typography, clear hierarchy, content cards, and consistent styling. Use when the user asks to create, write, or generate a PDF about a subject, or when they ask to convert a Markdown file to PDF (e.g. "/pdf" after creating a .md file).
cd scripts && bash install.sh && npx puppeteer browsers install chrome
$ARGUMENTS is a .md file path, or context has a recent .md file → use Markdown workflow$ARGUMENTS is a topic/subject → use Topic workflownode scripts/md-to-html.mjs <input.md> [output.html]node scripts/html-to-pdf.mjs <output.html> [output.pdf]node scripts/pdf-preview.mjs <output.html> — inspect PNGs in . Fix only if content is broken (overflow, missing text). Otherwise deliver./tmp/pdf-preview/Read the template: cat scripts/template.html
Create a single self-contained HTML file at ~/Desktop/<topic-slug>.html following the template structure and all design rules below. Develop 4–8 main sections with 2–4 subsections each.
node scripts/html-to-pdf.mjs ~/Desktop/<topic-slug>.html
Tell the user the output path. Do not preview — the design system and template guarantee correct layout. Done.
The template file (scripts/template.html) is the canonical reference for CSS. Copy its <style> block exactly. These rules supplement it:
margin in @page.<title> tag must match document title (used for PDF metadata).margin-bottom: 10pt. No walls of text.<hr> between H2 sections (not after title block).KEY INSIGHT, DEFINITION, SUMMARY, IMPORTANT, EXAMPLE.| Role | Color |
|---|---|
| Primary text | #1D1D1F |
| Title | #000000 |
| Subsection heading | #3A3A3C |
| Meta/secondary | #6E6E73 |
| Accent | #0071E3 |
| Card/header bg | #F5F5F7 |
No gradients, no decorative elements.
break-inside: avoid on cards, tables, code blocksbreak-after: avoid on headingsposition: fixed/absolute. No content wider than text column.$ARGUMENTS