Goal and scope
This guide helps you pick and use one of five commonly referenced Markdown→PDF Skills: huashu-md-to-pdf, md-to-pdf-academic, md2pdf-converter, md2pdf-weasyprint, and md2pdf-xelatex. It separates three typical needs: regular multilingual technical docs (including Chinese), academic work with LaTeX math and bibliographies, and whitepapers that require a cover and table of contents. The emphasis is on reproducible export and careful acceptance checks — a successful command does not guarantee correct layout or rendering.
How to choose a rendering path
- If your Markdown contains LaTeX math or you must preserve bibliography/cross-references, prefer a Pandoc + LaTeX path (md-to-pdf-academic or md2pdf-xelatex).
- For plain multilingual text, code blocks and styled output without complex math, WeasyPrint-based paths (md2pdf-weasyprint or md2pdf-converter) are often simpler.
- For whitepaper-style output with a cover and automated contents page, evaluate huashu-md-to-pdf for its cover/TOC features, but verify them in a sample export.
Do not rely solely on descriptive labels — verify that the renderer and installed packages actually meet your source’s needs.
Worked example: short report with Chinese text, one formula, and a bibliography
Context: You have sample.md containing: title, author, a short Chinese paragraph, an inline formula $e^{i\pi}+1=0$, a displayed equation, an image referenced as assets/figure1.png, and a bibliography file sample.bib. Step 1 — pick the path: because the source has math and references, choose md-to-pdf-academic or md2pdf-xelatex. Step 2 — list required resources to prepare locally: Pandoc, a LaTeX distribution with CJK support, required LaTeX packages used by your template, pandoc-crossref (if you use it), CSL or bibliography style files, and a readable CJK font file. Step 3 — create a minimal YAML header in sample.md specifying document class, geometry (paper size and margins), and bibliography/csl fields. Step 4 — export a minimal sample (first page only) and inspect: check that the inline and displayed formulas render, that the bibliography appears and references resolve, and that the image loads. Step 5 — adjust template options for fonts, margins, line spacing or package dependencies based on the sample’s issues, then export the full document.
Preflight checklist before full export
- Source integrity: all image paths resolve and local resources exist.
- Font coverage: the renderer can access a font that covers your Chinese characters; no tofu (blank boxes) appear.
- Math rendering: inline and display equations render without missing packages or compile errors.
- Bibliography and citations: citation keys match the .bib and the chosen citation style is applied.
- Tables and code blocks: tables do not overflow page width; large code blocks wrap or are moved to landscape pages if necessary.
- TOC and pagination: table of contents entries and page numbers match the body.
- Header/footer consistency: page numbers, author, or organization in headers/footers display as required across pages.
Common limitations and practical risks
- WeasyPrint normally does not render LaTeX math natively; math may need to be pre-rendered to images or exported via a LaTeX path.
- Some Skills expect first-run downloads (e.g., emoji caches or font fetches). Offline-export claims only hold after required resources are available locally.
- Descriptions sometimes list features such as headers/footers or cover pages; verify in a real export because templates and configuration files determine the actual output.
- When automating conversions via an agent or CI, restrict remote asset access and shell execution permissions; do not process sensitive material until you confirm the tool’s behavior.
Practical recommendations
1) Start with a representative sample that contains the hardest elements of your source (long table, math, references, images). 2) Prepare fonts, templates, bibliography and any LaTeX packages before attempting a headless or offline run. 3) Use the sample export to iterate on template and YAML settings until the output matches your acceptance criteria. 4) Keep source, templates and a record of package versions for reproducibility.
This guide offers a decision framework and actionable steps to reliably convert Markdown to print-ready PDF using the referenced Skills. Always validate final output in the intended PDF reader and keep the source and configuration so you can reproduce or update the delivered PDF.