AI Agent Hub
Back to skills
📁

Markdown to PDF

Office Efficiency Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_48539314/md2pdf-chrome.

About this skill

Problem

Converting a technical Markdown document into a deliverable PDF often stalls on cover pages, table of contents, page numbers, sidebar bookmarks, math, and code highlighting. Hand-writing HTML/CSS works, but is costly to maintain; asking an AI to invent layout can introduce non-reproducible semantic choices. md2pdf treats conversion as a fixed script pipeline from MD to PDF.

Core Workflow

It relies on pandoc to parse Markdown and Playwright to render pages through Chromium. The skill can detect missing components, ask for preferences, and persist them to output/user-config.json. During conversion, it can generate a cover from YAML front-matter or fall back to the file name when absent. Table of contents, page numbers, and PDF outline bookmarks are produced by scripts. Code highlighting, KaTeX math, and Mermaid diagrams can be enabled as needed, while Chinese layout enhancement adjusts line spacing, indentation, and line-break rules.

Boundaries

It fits single-file Markdown to PDF conversion for technical docs, design notes, paper drafts, and internal manuals. It is not intended for merging multiple MD files into one PDF, creating PDFs from scratch, complex LaTeX environments, deep layout control, multi-column typesetting, or dynamic interactive charts. Watermarks, headers, and open passwords require extra dependencies and can be overridden with --header, --watermark, and --password.

Use Cases

  • Export an architecture Markdown doc to an internal review PDF with cover, TOC, and sidebar bookmarks.
  • Convert an algorithm note with KaTeX and Mermaid to A4 PDF with Chinese line spacing and indentation.
  • Render a code review document to a default-theme PDF keeping syntax highlighting, page numbers, and clickable TOC.
  • Produce an academic-style PDF draft from a Markdown paper using front-matter title and environment validation.

Best For

  • Technical writers who need to turn a single Markdown spec into a printable, searchable PDF.
  • Documentation engineers who need cover, TOC, page numbers, and bookmarks for an internal manual.
  • Research engineers who need KaTeX, Mermaid, and syntax-highlighted code in a PDF draft.
  • Engineers delivering client materials who need stable A4 output with theme, header, or watermark overrides.