publishing-mdbook-pdf

publishing-mdbook-pdf is a skill for Claude Code from supachai-j/open-knowledge-format-starter. It costs 231 tokens per session (2,918 once invoked), scanned D, original, MIT.

A publishing workflow that turns Markdown into an mdBook website on GitHub Pages and a print-quality PDF, with features such as page numbers, diagrams, and multilingual fonts.

In plain words
What is it for?
Use it to publish books, handbooks, and manuals online and as PDFs, including table-of-contents page numbers, Mermaid diagrams, non-Latin text, bilingual versions, and optional offline HTML.
Why use it?
Producing a polished web book and accurate printable PDF requires several build and layout steps that are easy to get wrong manually.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

Good fit Use it to publish books, handbooks, and manuals online and as PDFs, including table-of-contents page numbers, Mermaid diagrams, non-Latin text, bilingual versions, and optional offline HTML.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/supachai-j/open-knowledge-format-starter/publishing-mdbook-pdf
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add supachai-j/open-knowledge-format-starter --skill publishing-mdbook-pdf
Clone the repo
git clone --depth 1 https://github.com/supachai-j/open-knowledge-format-starter

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for publishing-mdbook-pdf

README.md
[![agentmods](https://agentmods.dev/badge/skills/supachai-j/open-knowledge-format-starter/publishing-mdbook-pdf/github.svg)](https://agentmods.dev/skills/supachai-j/open-knowledge-format-starter/publishing-mdbook-pdf)
Your own site
<a href="https://agentmods.dev/skills/supachai-j/open-knowledge-format-starter/publishing-mdbook-pdf"><img src="https://agentmods.dev/badge/skills/supachai-j/open-knowledge-format-starter/publishing-mdbook-pdf/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for publishing-mdbook-pdf

Your own site · 80×15
<a href="https://agentmods.dev/skills/supachai-j/open-knowledge-format-starter/publishing-mdbook-pdf"><img src="https://agentmods.dev/badge/skills/supachai-j/open-knowledge-format-starter/publishing-mdbook-pdf.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 231 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,918 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 3 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00231 $0.02918
Opus 5 $0.00115 $0.01459
Sonnet 5 $0.00046 $0.00584
Haiku 4.5 $0.00023 $0.00292

Measured 10d ago against content hash 8353b6b7409f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade D, and why

publishing-mdbook-pdf scanned grade D with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/pdf-toc-pages.py, scripts/print-pdf.js), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

- Install system fonts on the runner: `sudo apt-get install -y fonts-thai-tlwg fonts-noto-core fonts-noto-color-emoji` then `sudo fc-cache -f`.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

pdfunite "$d/cover.pdf" $(ls "$d"/p-*.pdf|sort) "$out"; rm -rf "$d"; }

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- run: curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C /usr/local/bin
.claude/skills/publishing-mdbook-pdf/SKILL.md · 161 lines

How it starts

The opening of the file, as written. The whole thing — 161 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Publishing an mdBook → GitHub Pages + a print-quality PDF

A battle-tested pipeline for turning a Markdown book into (1) an mdBook website on GitHub Pages and (2) a polished PDF. The hard part is the PDF: headless Chrome has many traps. Every gotcha below cost real debugging — read them before reinventing.

Bundled reusable scripts live in scripts/ next to this file:

  • scripts/print-pdf.js — Puppeteer renderer (cover / body / measure modes; header/footer; outline)
  • scripts/pdf-toc-pages.py — reads a measured PDF's outline and injects real page numbers into the TOC

Architecture

markdown (src/) ──mdbook build──▶ static site (book/)  ──▶ GitHub Pages
                                        │
                          print.html ───┴── Puppeteer (CDP) ──▶ PDF
  • Site: mdbook build → upload with actions/upload-pages-artifact + deploy-pages.
  • PDF: mdBook auto-generates book/print.html (whole book on one page). Render THAT with Puppeteer (NOT mdbook-native, NOT --print-to-pdf CLI). See gotchas.
  • Bilingual: keep two books (book/ default, book-en/), build both, copy the 2nd under /en/, add a language-switch button via additional-js.

The gotchas (and the fixes)

1. chrome --headless --print-to-pdf CANNOT add headers/footers or page numbers

The CLI flag has no header/footer support. Use Puppeteer (puppeteer-core driving system Chrome) page.pdf({displayHeaderFooter, headerTemplate, footerTemplate}). Header/footer templates use the special spans class="pageNumber" / class="totalPages" / title / date. Set an explicit font-size (default is ~0) and a font-family in the template.

2. Non-Latin fonts (Thai/CJK) render BROKEN in CI PDFs

Two failures combine: the runner has no Thai font, and the Google-Fonts webfont hasn't loaded when print snapshots. Fix both:

  • Install system fonts on the runner: sudo apt-get install -y fonts-thai-tlwg fonts-noto-core fonts-noto-color-emoji then sudo fc-cache -f.
  • Wait for fonts before page.pdf: await page.evaluate(() => document.fonts.ready) (and waitUntil:'networkidle0').
  • Put a Thai-capable family in the header/footer template too (e.g. 'Noto Sans Thai','Loma').

Read the full file on GitHub · 161 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 161 lines · 231 tokens per session scan D 8353b6b7409f

Subscribe to this mod's changes

publishing-mdbook-pdf is a skill published in the GitHub repository supachai-j/open-knowledge-format-starter (5 stars, last pushed 2mo ago), licensed MIT. It adds 231 tokens to every session and 2,918 once invoked, about $0.0012 per session on Opus 5. A static security scan graded it D with 3 findings (asks for root, recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

design-drawing-svg-md

Use when converting vector PDF engineering drawings (steel-structure shop drawings, A0 drawings, linework-only PDFs without a text layer) into LLM-consumable dual-carrier records — semantic Markdown reading thread plus layered SVG geometry archive linked by shared IDs and crosswalk.

znlgis/opengis-skills · 61 tokens

second-reader

Build and run a source-verified Markdown knowledge vault (opens as an Obsidian vault). Ingests books, PDFs, transcripts, and articles into atomic, cross-linked, cited notes, then gates every note and every answer behind an independent verification pass that re-reads the source cold and loops until a round finds…

mplind/second-reader · 191 tokens

second-brain-ingest

Process raw source documents into wiki pages. Use when the user adds files to raw/ and wants them ingested, says "process this source", "ingest this article", "I added something to raw/", or wants to incorporate new material into their knowledge base.

NicholasSpisak/second-brain · 59 tokens

pdftomarkdown

Converts PDF documents, Word files (.docx), CSV spreadsheets, and YouTube video URLs into clean, token-efficient Markdown with smart table and heading structure detection.

HEMANT16/pdftomarkdown · 39 tokens

pdf

PDF files: create, read, merge, fill, OCR, edit text.

NousResearch/hermes-agent · 18 tokens

pdf-toolkit

Structured .pdf operations: extract text/tables, merge pages from multiple PDFs, split a PDF by page ranges, fill PDF form fields, and generate fresh PDFs from JSON. Trigger when the user wants programmatic PDF work without natural-language rewriting — examples: pull tables from a report, combine three PDFs, extract…

opensquilla/opensquilla · 127 tokens