Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Converts Markdown files with Mermaid diagrams to PDF using local tools (mmdc, md-to-pdf, Puppeteer) with CSS styling and page numbers. Use when the user asks to export markdown to PDF, render Mermaid charts to PDF, or convert a .md file with diagrams to a printable document, or convert multiple Markdown files (one PDF per file, processed sequentially).
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 318% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 1% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 1044% | 0% |
| case-10 | ✓→✗ | ▼ Worse | 44% | 0% |
Converts one or more Markdown files with Mermaid diagrams into PDF(s) using local mmdc and md-to-pdf. Each source file gets its own PDF (<basename>-export.pdf beside the source). All intermediate artifacts live in local-md-mermaid-pdf-sandbox; only the final PDF(s) are written outside the sandbox. The sandbox is removed after each successful run.
Multiple files: process sequentially (one complete run at a time). Produce one PDF per source file. Do not merge PDFs unless the user explicitly asks.
mermaid blocks)style.css from this skill folder (unless the user requests custom styling)mmdc and md-to-pdf, or npx --yes fallbackexecutablePath when available)<source-dir>/<original-basename>-export.pdf — only deliverable outside the sandbox-export.pdf rule beside each source). List every absolute PDF path in the final replylocal-md-mermaid-pdf-sandbox removed after each successful run (all intermediate artifacts deleted with it)input.md, input.tmp.md, input.for-pdf.md, puppeteer-config.json, Puppeteer cache, Mermaid render outputs) must live inside local-md-mermaid-pdf-sandbox. Only the final PDF is written outside the sandbox (via dest beside the source file)style.css from this skill folder unless the user asks for custom styling (read-only reference; do not copy into the project unless the user requests custom styling)md-to-pdf front matter: Page <span class="pageNumber"></span> of <span class="totalPages"></span>PUPPETEER_CACHE_DIR inside the sandbox); never depend on ~/.cache/puppeteernpx --yes only when a binary is missingexecutablePath to Puppeteermmdc / md-to-pdf / Puppeteer runs<basename>-export.pdf. Do not concatenate Markdown sources, merge PDFs, or produce one combined output unless the user explicitly askslocal-md-mermaid-pdf-sandbox next to the source filelocal-md-mermaid-pdf-sandbox/input.mdPUPPETEER_CACHE_DIR to a path inside the sandbox (e.g. local-md-mermaid-pdf-sandbox/.puppeteer-cache)mmdc, if Google Chrome or Chromium is available, write local-md-mermaid-pdf-sandbox/puppeteer-config.json with system executablePath and args: ["--no-sandbox"]. This is required when PUPPETEER_CACHE_DIR points to the empty sandbox cache — without it, mmdc cannot find Chrome and diagrams will not rendermmdc -p puppeteer-config.json -i input.md -o input.tmp.md when the config exists; otherwise mmdc -i input.md -o input.tmp.mdmmdc emits images or other sidecar files, they must remain inside the sandboxmmdc still fails on Puppeteer/cache, retry only with a corrected executablePath in puppeteer-config.json — do not skip to PDF conversioninput.tmp.md exists and no longer contains raw mermaid blocks (expect !diagram image references and sidecar SVG/PNG files)Write local-md-mermaid-pdf-sandbox/input.for-pdf.md with YAML front matter:
dest: <source-dir>/<original-basename>-export.pdf — the only output path outside the sandboxstylesheet: absolute path to this skill’s style.csspdf_options.displayHeaderFooter: truepdf_options.headerTemplate: '<div></div>'pdf_options.footerTemplate: centered page numbers onlyinput.tmp.md--launch-options JSON (executablePath when Chrome/Chromium is available; args: ["--no-sandbox"])md-to-pdf --basedir local-md-mermaid-pdf-sandbox --launch-options '<json>' input.for-pdf.md from inside the sandbox (or npx --yes md-to-pdf@5.2.5 ...)local-md-mermaid-pdf-sandboxWhen the user provides more than one Markdown file:
<source-dir>/<basename>-export.pdf beside its source| Rationalization | Reality | | --- | --- | | Skip Mermaid render for MD without diagrams | mmdc is still required when diagrams exist; inspect the file first | | Run mmdc without puppeteer-config.json when sandbox cache is empty | mmdc will fail to find Chrome; write config with system executablePath before the first run | | Skip to PDF when mmdc fails | Never convert without input.tmp.md; raw mermaid blocks do not render in PDF | | Reuse ~/.cache/puppeteer | Breaks isolation and causes cross-project cache conflicts | | Invent Puppeteer flags on failure | Only the documented Chromium executablePath retry is allowed | | Keep sandbox for debugging | Sandbox must be removed after success; use --keep in scripts/e2e.sh for local dev only | | Overwrite the source PDF name | Use the stable -export.pdf suffix to avoid clobbering prior runs | | Write intermediates beside the source file | Only the final PDF leaves the sandbox; everything else stays in local-md-mermaid-pdf-sandbox | | Run multiple conversions in parallel to save time | Sequential queue only — parallel runs conflict on Puppeteer, cache, and sandbox paths | | Merge multiple files into one PDF by default | One PDF per source; merge only when the user explicitly asks | | Reuse one sandbox for several source files at once | Fresh sandbox per file; complete and delete before the next file |
input.md, input.tmp.md, input.for-pdf.md, puppeteer-config.json, cache) exist outside local-md-mermaid-pdf-sandboxinput.tmp.md was not produced by mmdcinput.tmp.md still contains mermaid blocks (diagrams were not rendered)stylesheet points outside this skill folder without user requestnpx used when global mmdc / md-to-pdf binaries are already availablelocal-md-mermaid-pdf-sandbox (no stray files beside the source)local-md-mermaid-pdf-sandbox/input.tmp.md exists after mmdc and has no raw mermaid blockslocal-md-mermaid-pdf-sandbox/input.for-pdf.md has dest, stylesheet, and footer page-number template<original-basename>-export.pdf exists beside the source filelocal-md-mermaid-pdf-sandbox was deleted-export.pdf; conversions ran sequentially (not in parallel)Other measured skills in the registry, with their headline benchmark lift.