[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71GRA27DQ1JPNKH5MG2VCF7":3,"skill-same:01M71GRA27DQ1JPNKH5MG2VCF7":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":58,"repositoryHtmlUrl":59,"repositoryHomepageUrl":6,"ownerHtmlUrl":60,"ownerBlogUrl":61,"ownerDescription":62,"updatedAt":63,"install":64,"resources":77},"01M71GRA27DQ1JPNKH5MG2VCF7","make-pdf",null,"Generate a polished PDF from markdown, HTML or code in the repo, with cover page, table of contents and margins.","timurgaleev\u002Fvibestack","timurgaleev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F32696429?v=4","01M71GMS53Z9B4JQTCQEFXAE9E","Timur Galeev","01M71GMS5S1Q7BEYB3Z7GY3E85",8,"MIT","https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Fskills\u002Fmake-pdf\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"make pdf","make","PDF","grep","with","repo","page","table","html","cover","export","write","read","markdown","generate","create","code","preview","Bash","generate pdf","2026-11-10 10:12:30",false,"---\nname: make-pdf\ndescription: |\n  Generate a polished PDF from markdown, HTML or code in the repo, with cover page, table of contents and margins.\ntriggers:\n  - make pdf\n  - generate pdf\n  - create pdf\n  - export pdf\n  - pdf preview\nallowed-tools:\n  - Bash\n  - Read\n  - Write\n  - Glob\n  - Grep\n  - AskUserQuestion\n---\n\nIf this session was compacted, the copy of this skill in context may be cut off.\nRead `${CLAUDE_SKILL_DIR}\u002FSKILL.md` from disk and resume at the step you are on.\n\n## When to invoke\n\nUse when asked to \"make pdf\", \"generate pdf\", \"export to pdf\", \"create pdf report\", or \"pdf preview\".\n\n## Preamble\n\n```bash\neval \"$(\"${VIBESTACK_HOME:-$HOME\u002F.vibestack}\u002Fbin\u002Fvibe-slug\" 2>\u002Fdev\u002Fnull)\" 2>\u002Fdev\u002Fnull || SLUG=\"unknown\"\n_LEARN_FILE=\"${VIBESTACK_HOME:-$HOME\u002F.vibestack}\u002Fprojects\u002F${SLUG:-unknown}\u002Flearnings.jsonl\"\nif [ -f \"$_LEARN_FILE\" ]; then\n  _LEARN_COUNT=$(wc -l \u003C \"$_LEARN_FILE\" 2>\u002Fdev\u002Fnull | tr -d ' ')\n  echo \"LEARNINGS: $_LEARN_COUNT entries loaded\"\n  if [ \"$_LEARN_COUNT\" -gt 5 ] 2>\u002Fdev\u002Fnull; then\n    \"${VIBESTACK_HOME:-$HOME\u002F.vibestack}\u002Fbin\u002Fvibe-learnings-search\" --limit 5 2>\u002Fdev\u002Fnull || true\n  fi\nelse\n  echo \"LEARNINGS: none yet\"\nfi\n```\n\n{{include lib\u002Fsnippets\u002Fsession-host.md}}\n\n{{include lib\u002Fsnippets\u002Fdecision-brief.md}}\n\n{{include lib\u002Fsnippets\u002Fworking-protocols.md}}\n\n{{include lib\u002Fsnippets\u002Fstate-protocols.md}}\n\n## Step 0: Find the make-pdf renderer\n\n```bash\n# Env override first, then the launcher installed with this skill (resolves\n# the repo's compiled binary or runs the CLI on bun).\nP=\"${MAKE_PDF_BIN:-${CLAUDE_SKILL_DIR:-$HOME\u002F.claude\u002Fskills\u002Fmake-pdf}\u002Fbin\u002Fvibe-make-pdf}\"\n[ -x \"$P\" ] && \"$P\" version >\u002Fdev\u002Fnull 2>&1 && echo \"PDF_BIN: $P\" || echo \"NOT_FOUND\"\n```\n\nEach Bash call starts a fresh shell, so every later block that runs `\"$P\"` opens with\n`P='\u003CPDF_BIN>'`: replace the placeholder with the path this block printed.\n\nIf `NOT_FOUND`, stop and tell the user:\n\n> make-pdf renderer not found. It ships with the vibestack repo.\n> Run: `cd ~\u002Fdata\u002Fvibestack && bun install && bun run build:make-pdf && .\u002Finstall`\n> (Bun 1.3.3 or newer — `bun --version`. Older Bun ignores the build's\n> `--no-compile-autoload-dotenv` flag, so the binary could read a project's `.env`;\n> run `bun upgrade` first.)\n> Or set `$MAKE_PDF_BIN` to the path of an existing `make-pdf` binary.\n>\n> After building, re-run `\u002Fmake-pdf`.\n\n---\n\n## Step 1: Detect intent\n\nParse the user's input to determine what to do:\n\n1. `\u002Fmake-pdf` with no args — **Auto-detect**: look for markdown files or ask what to convert\n2. `\u002Fmake-pdf preview \u003Cfile>` — **Preview mode**: render the print-styled HTML and open it in a browser\n3. `\u002Fmake-pdf setup` — **Setup mode**: run `$P setup` to configure defaults\n4. `\u002Fmake-pdf \u003Cfile or description>` — **Generate mode**: produce a PDF from the specified input\n\n---\n\n## Step 2A: Generate mode\n\n1. Identify the source file(s). If the user provided a path, use it. If not, ask:\n   ```\n   What should I turn into a PDF?\n   A) A specific file (provide path)\n   B) All markdown files in this directory\n   C) A generated report (I'll describe what to include)\n   D) Something else\n   ```\n\n2. Determine output filename. Default: `\u003Csource-basename>.pdf` in the same directory.\n\n3. Run the generator. The output path is the second positional argument — there is no\n   `--output` flag, and any flag the CLI does not know fails the run with exit 1:\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate \"\u003Csource>\" \"\u003Coutput.pdf>\" [flags]\n```\n\nCommon flags:\n- `--cover` — add a cover page (uses repo name + date)\n- `--toc` — add a table of contents with page numbers\n- `--watermark \"\u003Ctext>\"` — overlay watermark text (e.g., \"DRAFT\", \"CONFIDENTIAL\")\n- `--margins \u003Cdim>` — one dimension for all four margins (default: `1in`; also `72pt`, `2.54cm`, `25mm`)\n- `--page-size \u003Csize>` — `letter` (default), `a4`, `legal`\n- `--title \"\u003Ctitle>\"` — override document title\n- `--author \"\u003Cname>\"` — set author metadata\n- `--to pdf|html|docx` — output format (default: `pdf`)\n- `--no-confidential` — suppress the CONFIDENTIAL footer stamped by default\n- `--strict` — missing or remote images fail the run instead of warning\n\n4. Report the result:\n\n```\nPDF GENERATED\n═══════════════════════════════════════════\nOutput:  \u003Coutput.pdf>\nSize:    \u003Cfile size>\nPages:   \u003Cpage count>\n═══════════════════════════════════════════\n```\n\n---\n\n## Step 2B: Preview mode\n\nRender the print-styled HTML and open it:\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" preview \"\u003Csource>\" [flags]\n```\n\nThis writes an HTML file with the print CSS and opens it in the browser; no PDF is produced. Preview skips the diagram and image pre-pass, so diagram fences show as code. Report the path, and run generate mode when the user wants the PDF.\n\n---\n\n## Step 2C: Setup mode\n\nVerify the render toolchain — browse binary, Chromium launch, `pdftotext` (optional) — then\ngenerate and open a smoke-test PDF:\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" setup\n```\n\nIt writes no config file. Report which checks passed and, if Chromium or the browse binary\nfailed, relay the fix it printed before attempting any other mode.\n\n---\n\n## Core patterns\n\n### 80% case — memo\u002Fletter\n\nOne command, no flags. Gets a clean PDF with running header, page numbers, and a\nCONFIDENTIAL right-footer. Always pass the output path: without one the CLI writes\nto the OS temp directory, whose location varies by platform.\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate letter.md letter.pdf\n```\n\n### Brand-free — no CONFIDENTIAL footer\n\nThe footer is on by default, so anything meant to leave the building needs it turned off:\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate --no-confidential memo.md memo.pdf\n```\n\n### Publication mode — cover + TOC + chapter breaks\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate --cover --toc --title \"On Horizons\" essay.md essay.pdf\n```\n\nEach top-level H1 starts a new page. Disable with `--no-chapter-breaks` for memos that happen to have multiple H1s.\n\n### Draft-stage watermark\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate --watermark DRAFT memo.md draft.pdf\n```\n\nDiagonal DRAFT across every page. Drop the flag when final.\n\n### Diagrams — mermaid and excalidraw fences render as pictures\n\nA column-0 ```` ```mermaid ```` or ```` ```excalidraw ```` fence renders as a vector diagram,\noffline. Indented fences are left alone, so a fence quoted inside a list stays a code block.\n\nInfo-string options on the opening fence:\n\n- `title=\"Auth flow\"` — accessible label for the rendered figure\n- `render=false` — leave this fence as a plain code block (the escape hatch when the source\n  is what the reader needs to see)\n- `page=landscape` \u002F `page=portrait` — force or veto a landscape page for this diagram\n\nA fence whose source fails to parse becomes a visible red diagnostic block carrying the error\nand an excerpt — never a silently missing figure. When that shows up, fix the diagram source\nrather than dropping the fence.\n\n### Images — scaled right, never truncated\n\nA directive suffix on a markdown image tunes its placement:\n\n```markdown\n![chart](data.png){width=full}\n![chart](data.png){width=50%}\n![diagram](wide.svg){page=landscape}\n![diagram](wide.svg){page=portrait}\n```\n\n`width` takes `full`, a percentage, or an absolute dimension (`in`, `cm`, `mm`, `pt`, `px`).\nBy default an image renders at its intrinsic size, capped at the content box and never\nupscaled.\n\nWide, small-text images auto-promote to their own landscape page. The heuristic is deliberately\nconservative — aspect ratio at least 1.8, intrinsic width over roughly 2.5x the content box,\n*and* either diagram provenance or a diagram-ish word in the alt text — so it misses more often\nthan it fires. `{page=landscape}` forces promotion; `{page=portrait}` vetoes it.\n\nLocal images are inlined as data URIs and rasters wider than print resolution are downscaled.\nAn image that is missing, not a regular file, or over 64MB degrades to a visible placeholder\nwith a warning; one resolving outside the markdown's own directory is inlined but warned about,\nbecause an agent rendering untrusted markdown should not quietly embed a file from elsewhere on\nthe machine into a shareable document.\n\n### Other formats — single-file HTML and Word\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate readme.md out.html --to html     # one self-contained file, no network refs\n\"$P\" generate readme.md out.docx --to docx     # content fidelity; diagrams become PNG\n```\n\n`--to` is the output format. `--format` is something else entirely — an alias for\n`--page-size` — so `--format html` asks for a page size named \"html\", not HTML output.\n\n### CI mode — fail loud on missing assets\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate docs.md --strict\n```\n\nMissing, unreadable, oversized, out-of-tree, and remote images become hard failures instead of\nwarnings, so a broken asset path fails the build rather than shipping a placeholder.\n\n### Fast iteration via preview\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" preview essay.md\n```\n\nRenders with print CSS and opens in browser. Skip the PDF round trip until you're ready.\n\n---\n\n## Common flags\n\n```\nOutput format:\n  --to pdf|html|docx         What to produce (default: pdf)\n\nPage layout:\n  --margins \u003Cdim>            1in (default) | 72pt | 2.54cm | 25mm\n  --page-size letter|a4|legal   (alias --format — page SIZE, not --to)\n\nStructure:\n  --cover                    Cover page (title, author, date)\n  --toc                      Clickable TOC with page numbers\n  --no-chapter-breaks        Don't start a new page at every H1\n\nBranding:\n  --watermark \u003Ctext>         Diagonal watermark (\"DRAFT\", \"CONFIDENTIAL\")\n  --header-template \u003Chtml>   Custom running header\n  --footer-template \u003Chtml>   Custom footer (mutex with --page-numbers)\n  --no-confidential          Suppress the CONFIDENTIAL right-footer (on by default)\n\nOutput:\n  --page-numbers             \"N of M\" footer (default on)\n  --tagged                   Accessible PDF (default on)\n  --outline                  PDF bookmarks from headings (default on)\n  --quiet                    Suppress progress on stderr\n  --verbose                  Per-stage timings\n\nImages:\n  --strict                   Missing\u002Fremote images fail the run (CI mode)\n\nNetwork:\n  --allow-network            Fetch external images. Off by default\n                             (blocks tracking pixels).\n\nMetadata:\n  --title \"...\"              Document title (defaults to first H1)\n  --author \"...\"             Author for cover + PDF metadata\n  --date \"...\"               Date for cover (defaults to today)\n```\n\n---\n\n## When to run it\n\nWatch for markdown-to-PDF intent. Any of these → run `\"$P\" generate`:\n\n- \"Can you make this markdown a PDF\"\n- \"Export it as a PDF\"\n- \"Turn this into a PDF\"\n- \"I need a PDF of this\"\n- \"Print this as a PDF for me\"\n\nIf the user has a `.md` file open and says \"make it look nice\", propose `\"$P\" generate --cover --toc` and ask before running.\n\n---\n\n## Output contract\n\n```\nstdout: \u002Fpath\u002Fto\u002Fletter.pdf      ← just the path, one line\nstderr: Rendering HTML...        ← progress (unless --quiet)\n        Generating PDF...\n        Done in 1.5s. 43 words · 22KB · \u002Fpath\u002Fto\u002Fletter.pdf\n\nexit code: 0 success \u002F 1 bad args or unknown flag \u002F 2 render error \u002F 3 TOC page numbers failed \u002F 4 binary unavailable\n```\n\nCapture the path: `PDF=$(\"$P\" generate letter.md letter.pdf)` — then use `$PDF`.\n\n---\n\n## Debugging\n\n- **Blank output** → check binary is executable: `ls -la \"$P\"`\n- **Fragmented text on copy-paste** → remove fenced code blocks and regenerate\n- **Exit 3 with `--toc`** → the TOC page numbers could not be filled (they kept moving after\n  three prints, or the PDF had no destination for a heading); shorten the longest TOC entries or\n  drop `--toc`\n- **External image missing** → the binary fetches external images only when `--allow-network` is set\n- **Wrong text metrics or ▯ boxes where emoji should be (Linux, containers)** → the print CSS\n  falls back to Liberation Sans and a system color-emoji font; install `fonts-liberation` and a\n  Noto color-emoji package, neither of which the vibestack installer provides\n\n---\n\n## Capture Learnings\n\nIf you discovered a non-obvious make-pdf behavior, flag pattern, or conversion quirk\nduring this session, log it for future sessions:\n\n```bash\n\"${VIBESTACK_HOME:-$HOME\u002F.vibestack}\u002Fbin\u002Fvibe-learnings-log\" '{\"skill\":\"make-pdf\",\"type\":\"TYPE\",\"key\":\"SHORT_KEY\",\"insight\":\"DESCRIPTION\",\"confidence\":N,\"source\":\"SOURCE\",\"files\":[\"path\u002Fto\u002Frelevant\u002Ffile\"]}'\n```\n\n**Types:** `pattern` (reusable approach), `pitfall` (what NOT to do), `tool`\n(binary behavior), `operational` (env\u002Fpath\u002Fdependency quirk).\n\n**Only log genuine discoveries.** A good test: would this save time in a future session?\n","If this session was compacted, the copy of this skill in context may be cut off.\nRead `${CLAUDE_SKILL_DIR}\u002FSKILL.md` from disk and resume at the step you are on.\n\n## When to invoke\n\nUse when asked to \"make pdf\", \"generate pdf\", \"export to pdf\", \"create pdf report\", or \"pdf preview\".\n\n## Preamble\n\n```bash\neval \"$(\"${VIBESTACK_HOME:-$HOME\u002F.vibestack}\u002Fbin\u002Fvibe-slug\" 2>\u002Fdev\u002Fnull)\" 2>\u002Fdev\u002Fnull || SLUG=\"unknown\"\n_LEARN_FILE=\"${VIBESTACK_HOME:-$HOME\u002F.vibestack}\u002Fprojects\u002F${SLUG:-unknown}\u002Flearnings.jsonl\"\nif [ -f \"$_LEARN_FILE\" ]; then\n  _LEARN_COUNT=$(wc -l \u003C \"$_LEARN_FILE\" 2>\u002Fdev\u002Fnull | tr -d ' ')\n  echo \"LEARNINGS: $_LEARN_COUNT entries loaded\"\n  if [ \"$_LEARN_COUNT\" -gt 5 ] 2>\u002Fdev\u002Fnull; then\n    \"${VIBESTACK_HOME:-$HOME\u002F.vibestack}\u002Fbin\u002Fvibe-learnings-search\" --limit 5 2>\u002Fdev\u002Fnull || true\n  fi\nelse\n  echo \"LEARNINGS: none yet\"\nfi\n```\n\n{{include lib\u002Fsnippets\u002Fsession-host.md}}\n\n{{include lib\u002Fsnippets\u002Fdecision-brief.md}}\n\n{{include lib\u002Fsnippets\u002Fworking-protocols.md}}\n\n{{include lib\u002Fsnippets\u002Fstate-protocols.md}}\n\n## Step 0: Find the make-pdf renderer\n\n```bash\n# Env override first, then the launcher installed with this skill (resolves\n# the repo's compiled binary or runs the CLI on bun).\nP=\"${MAKE_PDF_BIN:-${CLAUDE_SKILL_DIR:-$HOME\u002F.claude\u002Fskills\u002Fmake-pdf}\u002Fbin\u002Fvibe-make-pdf}\"\n[ -x \"$P\" ] && \"$P\" version >\u002Fdev\u002Fnull 2>&1 && echo \"PDF_BIN: $P\" || echo \"NOT_FOUND\"\n```\n\nEach Bash call starts a fresh shell, so every later block that runs `\"$P\"` opens with\n`P='\u003CPDF_BIN>'`: replace the placeholder with the path this block printed.\n\nIf `NOT_FOUND`, stop and tell the user:\n\n> make-pdf renderer not found. It ships with the vibestack repo.\n> Run: `cd ~\u002Fdata\u002Fvibestack && bun install && bun run build:make-pdf && .\u002Finstall`\n> (Bun 1.3.3 or newer — `bun --version`. Older Bun ignores the build's\n> `--no-compile-autoload-dotenv` flag, so the binary could read a project's `.env`;\n> run `bun upgrade` first.)\n> Or set `$MAKE_PDF_BIN` to the path of an existing `make-pdf` binary.\n>\n> After building, re-run `\u002Fmake-pdf`.\n\n---\n\n## Step 1: Detect intent\n\nParse the user's input to determine what to do:\n\n1. `\u002Fmake-pdf` with no args — **Auto-detect**: look for markdown files or ask what to convert\n2. `\u002Fmake-pdf preview \u003Cfile>` — **Preview mode**: render the print-styled HTML and open it in a browser\n3. `\u002Fmake-pdf setup` — **Setup mode**: run `$P setup` to configure defaults\n4. `\u002Fmake-pdf \u003Cfile or description>` — **Generate mode**: produce a PDF from the specified input\n\n---\n\n## Step 2A: Generate mode\n\n1. Identify the source file(s). If the user provided a path, use it. If not, ask:\n   ```\n   What should I turn into a PDF?\n   A) A specific file (provide path)\n   B) All markdown files in this directory\n   C) A generated report (I'll describe what to include)\n   D) Something else\n   ```\n\n2. Determine output filename. Default: `\u003Csource-basename>.pdf` in the same directory.\n\n3. Run the generator. The output path is the second positional argument — there is no\n   `--output` flag, and any flag the CLI does not know fails the run with exit 1:\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate \"\u003Csource>\" \"\u003Coutput.pdf>\" [flags]\n```\n\nCommon flags:\n- `--cover` — add a cover page (uses repo name + date)\n- `--toc` — add a table of contents with page numbers\n- `--watermark \"\u003Ctext>\"` — overlay watermark text (e.g., \"DRAFT\", \"CONFIDENTIAL\")\n- `--margins \u003Cdim>` — one dimension for all four margins (default: `1in`; also `72pt`, `2.54cm`, `25mm`)\n- `--page-size \u003Csize>` — `letter` (default), `a4`, `legal`\n- `--title \"\u003Ctitle>\"` — override document title\n- `--author \"\u003Cname>\"` — set author metadata\n- `--to pdf|html|docx` — output format (default: `pdf`)\n- `--no-confidential` — suppress the CONFIDENTIAL footer stamped by default\n- `--strict` — missing or remote images fail the run instead of warning\n\n4. Report the result:\n\n```\nPDF GENERATED\n═══════════════════════════════════════════\nOutput:  \u003Coutput.pdf>\nSize:    \u003Cfile size>\nPages:   \u003Cpage count>\n═══════════════════════════════════════════\n```\n\n---\n\n## Step 2B: Preview mode\n\nRender the print-styled HTML and open it:\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" preview \"\u003Csource>\" [flags]\n```\n\nThis writes an HTML file with the print CSS and opens it in the browser; no PDF is produced. Preview skips the diagram and image pre-pass, so diagram fences show as code. Report the path, and run generate mode when the user wants the PDF.\n\n---\n\n## Step 2C: Setup mode\n\nVerify the render toolchain — browse binary, Chromium launch, `pdftotext` (optional) — then\ngenerate and open a smoke-test PDF:\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" setup\n```\n\nIt writes no config file. Report which checks passed and, if Chromium or the browse binary\nfailed, relay the fix it printed before attempting any other mode.\n\n---\n\n## Core patterns\n\n### 80% case — memo\u002Fletter\n\nOne command, no flags. Gets a clean PDF with running header, page numbers, and a\nCONFIDENTIAL right-footer. Always pass the output path: without one the CLI writes\nto the OS temp directory, whose location varies by platform.\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate letter.md letter.pdf\n```\n\n### Brand-free — no CONFIDENTIAL footer\n\nThe footer is on by default, so anything meant to leave the building needs it turned off:\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate --no-confidential memo.md memo.pdf\n```\n\n### Publication mode — cover + TOC + chapter breaks\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate --cover --toc --title \"On Horizons\" essay.md essay.pdf\n```\n\nEach top-level H1 starts a new page. Disable with `--no-chapter-breaks` for memos that happen to have multiple H1s.\n\n### Draft-stage watermark\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate --watermark DRAFT memo.md draft.pdf\n```\n\nDiagonal DRAFT across every page. Drop the flag when final.\n\n### Diagrams — mermaid and excalidraw fences render as pictures\n\nA column-0 ```` ```mermaid ```` or ```` ```excalidraw ```` fence renders as a vector diagram,\noffline. Indented fences are left alone, so a fence quoted inside a list stays a code block.\n\nInfo-string options on the opening fence:\n\n- `title=\"Auth flow\"` — accessible label for the rendered figure\n- `render=false` — leave this fence as a plain code block (the escape hatch when the source\n  is what the reader needs to see)\n- `page=landscape` \u002F `page=portrait` — force or veto a landscape page for this diagram\n\nA fence whose source fails to parse becomes a visible red diagnostic block carrying the error\nand an excerpt — never a silently missing figure. When that shows up, fix the diagram source\nrather than dropping the fence.\n\n### Images — scaled right, never truncated\n\nA directive suffix on a markdown image tunes its placement:\n\n```markdown\n![chart](data.png){width=full}\n![chart](data.png){width=50%}\n![diagram](wide.svg){page=landscape}\n![diagram](wide.svg){page=portrait}\n```\n\n`width` takes `full`, a percentage, or an absolute dimension (`in`, `cm`, `mm`, `pt`, `px`).\nBy default an image renders at its intrinsic size, capped at the content box and never\nupscaled.\n\nWide, small-text images auto-promote to their own landscape page. The heuristic is deliberately\nconservative — aspect ratio at least 1.8, intrinsic width over roughly 2.5x the content box,\n*and* either diagram provenance or a diagram-ish word in the alt text — so it misses more often\nthan it fires. `{page=landscape}` forces promotion; `{page=portrait}` vetoes it.\n\nLocal images are inlined as data URIs and rasters wider than print resolution are downscaled.\nAn image that is missing, not a regular file, or over 64MB degrades to a visible placeholder\nwith a warning; one resolving outside the markdown's own directory is inlined but warned about,\nbecause an agent rendering untrusted markdown should not quietly embed a file from elsewhere on\nthe machine into a shareable document.\n\n### Other formats — single-file HTML and Word\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate readme.md out.html --to html     # one self-contained file, no network refs\n\"$P\" generate readme.md out.docx --to docx     # content fidelity; diagrams become PNG\n```\n\n`--to` is the output format. `--format` is something else entirely — an alias for\n`--page-size` — so `--format html` asks for a page size named \"html\", not HTML output.\n\n### CI mode — fail loud on missing assets\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" generate docs.md --strict\n```\n\nMissing, unreadable, oversized, out-of-tree, and remote images become hard failures instead of\nwarnings, so a broken asset path fails the build rather than shipping a placeholder.\n\n### Fast iteration via preview\n\n```bash\nP='\u003CPDF_BIN>'\n\"$P\" preview essay.md\n```\n\nRenders with print CSS and opens in browser. Skip the PDF round trip until you're ready.\n\n---\n\n## Common flags\n\n```\nOutput format:\n  --to pdf|html|docx         What to produce (default: pdf)\n\nPage layout:\n  --margins \u003Cdim>            1in (default) | 72pt | 2.54cm | 25mm\n  --page-size letter|a4|legal   (alias --format — page SIZE, not --to)\n\nStructure:\n  --cover                    Cover page (title, author, date)\n  --toc                      Clickable TOC with page numbers\n  --no-chapter-breaks        Don't start a new page at every H1\n\nBranding:\n  --watermark \u003Ctext>         Diagonal watermark (\"DRAFT\", \"CONFIDENTIAL\")\n  --header-template \u003Chtml>   Custom running header\n  --footer-template \u003Chtml>   Custom footer (mutex with --page-numbers)\n  --no-confidential          Suppress the CONFIDENTIAL right-footer (on by default)\n\nOutput:\n  --page-numbers             \"N of M\" footer (default on)\n  --tagged                   Accessible PDF (default on)\n  --outline                  PDF bookmarks from headings (default on)\n  --quiet                    Suppress progress on stderr\n  --verbose                  Per-stage timings\n\nImages:\n  --strict                   Missing\u002Fremote images fail the run (CI mode)\n\nNetwork:\n  --allow-network            Fetch external images. Off by default\n                             (blocks tracking pixels).\n\nMetadata:\n  --title \"...\"              Document title (defaults to first H1)\n  --author \"...\"             Author for cover + PDF metadata\n  --date \"...\"               Date for cover (defaults to today)\n```\n\n---\n\n## When to run it\n\nWatch for markdown-to-PDF intent. Any of these → run `\"$P\" generate`:\n\n- \"Can you make this markdown a PDF\"\n- \"Export it as a PDF\"\n- \"Turn this into a PDF\"\n- \"I need a PDF of this\"\n- \"Print this as a PDF for me\"\n\nIf the user has a `.md` file open and says \"make it look nice\", propose `\"$P\" generate --cover --toc` and ask before running.\n\n---\n\n## Output contract\n\n```\nstdout: \u002Fpath\u002Fto\u002Fletter.pdf      ← just the path, one line\nstderr: Rendering HTML...        ← progress (unless --quiet)\n        Generating PDF...\n        Done in 1.5s. 43 words · 22KB · \u002Fpath\u002Fto\u002Fletter.pdf\n\nexit code: 0 success \u002F 1 bad args or unknown flag \u002F 2 render error \u002F 3 TOC page numbers failed \u002F 4 binary unavailable\n```\n\nCapture the path: `PDF=$(\"$P\" generate letter.md letter.pdf)` — then use `$PDF`.\n\n---\n\n## Debugging\n\n- **Blank output** → check binary is executable: `ls -la \"$P\"`\n- **Fragmented text on copy-paste** → remove fenced code blocks and regenerate\n- **Exit 3 with `--toc`** → the TOC page numbers could not be filled (they kept moving after\n  three prints, or the PDF had no destination for a heading); shorten the longest TOC entries or\n  drop `--toc`\n- **External image missing** → the binary fetches external images only when `--allow-network` is set\n- **Wrong text metrics or ▯ boxes where emoji should be (Linux, containers)** → the print CSS\n  falls back to Liberation Sans and a system color-emoji font; install `fonts-liberation` and a\n  Noto color-emoji package, neither of which the vibestack installer provides\n\n---\n\n## Capture Learnings\n\nIf you discovered a non-obvious make-pdf behavior, flag pattern, or conversion quirk\nduring this session, log it for future sessions:\n\n```bash\n\"${VIBESTACK_HOME:-$HOME\u002F.vibestack}\u002Fbin\u002Fvibe-learnings-log\" '{\"skill\":\"make-pdf\",\"type\":\"TYPE\",\"key\":\"SHORT_KEY\",\"insight\":\"DESCRIPTION\",\"confidence\":N,\"source\":\"SOURCE\",\"files\":[\"path\u002Fto\u002Frelevant\u002Ffile\"]}'\n```\n\n**Types:** `pattern` (reusable approach), `pitfall` (what NOT to do), `tool`\n(binary behavior), `operational` (env\u002Fpath\u002Fdependency quirk).\n\n**Only log genuine discoveries.** A good test: would this save time in a future session?\n",{"name":5,"triggers":44,"description":48,"allowed-tools":49},[19,38,45,46,47],"create pdf","export pdf","pdf preview","Generate a polished PDF from markdown, HTML or code in the repo, with cover page, table of contents and margins.\n",[37,50,51,52,53,54],"Read","Write","Glob","Grep","AskUserQuestion","main","777ec643a83c17a0955856b2eb7f596601709fda","skills\u002Fmake-pdf",0,"https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack","https:\u002F\u002Fgithub.com\u002Ftimurgaleev","https:\u002F\u002Ftgaleev.com\u002F","Forward Deployed Engineer \u002F\r\nAWS Community Builder \u002F Cloud Architect ","2026-11-11 15:42:25",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add timurgaleev\u002Fvibestack --skill make-pdf",{"tool":70,"command":71},"bunx","bunx skills add timurgaleev\u002Fvibestack --skill make-pdf",{"tool":73,"command":74},"pnpm","pnpm dlx skills add timurgaleev\u002Fvibestack --skill make-pdf","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Fskills\u002Fmake-pdf\u002FSKILL.md",true,[78],{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"bin\u002Fvibe-make-pdf","OTHER","其他",1852,"https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Fskills\u002Fmake-pdf\u002Fbin\u002Fvibe-make-pdf",[85,91,97,103,109,115],{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":39},"01M71GVHCCSQCCPVM8XPSPTA73","docs","https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Frender\u002F15-backtick-info-string\u002Fskills\u002Fdocs\u002FSKILL.md",[],[87],{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":39},"01M71GVFT1S5MRNM0AYRT2E6VQ","fences","https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Frender\u002F14-indented-tilde-fence\u002Fskills\u002Ffences\u002FSKILL.md",[],[93],{"skillNo":98,"name":99,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":39},"01M71GVEYB54K1S83FGRNKN8CF","dirty","https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Frender\u002F10-check-with-drift\u002Fskills\u002Fdirty\u002FSKILL.md",[],[99],{"skillNo":104,"name":105,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":39},"01M71GVDX9PMND1337C4388DK4","clean","https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Frender\u002F09-check-no-drift\u002Fskills\u002Fclean\u002FSKILL.md",[],[105],{"skillNo":110,"name":111,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":39},"01M71GVC3VM66F1ZQT2G8JXDR0","bare","https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Frender\u002F08-no-frontmatter\u002Fskills\u002Fbare\u002FSKILL.md",[],[111],{"skillNo":116,"name":117,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":39},"01M71GV9T8DAYZT0PX52QX0TE1","idem","https:\u002F\u002Fgithub.com\u002Ftimurgaleev\u002Fvibestack\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Frender\u002F07-idempotent-rerender\u002Fskills\u002Fidem\u002FSKILL.md",[],[117]]