yf-markdown-pdf

Render a Markdown file to PDF via the pandoc + xelatex pipeline — xelatex engine, a broad-coverage Unicode font (so →, ≤

Render a Markdown file to PDF via the pandoc + xelatex pipeline — xelatex engine, a broad-coverage Unicode font (so →, ≤, ≈ and similar glyphs render), 1in margins, blue links, and relative image paths (`![](diagrams/x.png)`) resolved against the source file's directory.

At a glance

  • Category: markdown
  • Invocation: auto (fires from its description conditions when relevant work appears)
  • Requires tools: uv, pandoc, xelatex
  • Source: SKILL.md · README.md

When it fires

/yf-markdown-pdf invoked; the user wants a PDF created/generated from a `.md` file; "export this report to PDF", "make a PDF of this note".

When to skip it

slide decks; HTML or non-PDF output; linting markdown (use `yf-markdown-lint`).


Prerequisites

Tool Version Purpose Install
uv any Runs the wrapper script (PEP 723) https://docs.astral.sh/uv/
pandoc any Markdown → PDF converter https://pandoc.org/installing.html
xelatex any PDF engine (from a LaTeX distribution) TeX Live / MacTeX

Mirrors SKILL.md frontmatter depends-on-tool: [uv, pandoc, xelatex]. The script checks for pandoc and xelatex and exits with a clear message if either is missing. No init step, no config, no companion rule.

Usage

User-invocable. Render one or more Markdown files to PDF:

uv run .claude/skills/markdown-pdf/scripts/md2pdf.py <input.md> [-o OUT.pdf]
# batch; override font; rotate wide tables to landscape
uv run .claude/skills/markdown-pdf/scripts/md2pdf.py a.md b.md
uv run .claude/skills/markdown-pdf/scripts/md2pdf.py r.md --mainfont "STIX Two Text" --table-font normalsize --landscape-cols 8
# keep ```d2```/```csv``` fences verbatim instead of rendering them
uv run .claude/skills/markdown-pdf/scripts/md2pdf.py r.md --no-render-fences

Output defaults to <input>.pdf beside the source. Pipeline defaults, font notes, and the PDF table levers (--table-font, dash-width tuning, --landscape-cols, --columns) are documented in SKILL.md.

Renderable fences. By default md2pdf renders a ```d2 fence to an embedded vector diagram and a ```csv fence to a native table (so the source travels inline in the Markdown), degrading to a verbatim listing if d2 is absent or a block fails. Glyph fallback: on macOS a glyph-fallback.tex header remaps ✅ onto a monochrome ✔ (macOS best-effort; off macOS it degrades to a warning, never a hard fail). The renderable-fence set is the shared _shared/renderable_fences.py registry. See SKILL.md.

Phase model

None. This is a tool/reference skill with no phases or state transitions.