markdown-to-pdf
Convert a Markdown file into a PDF for easier viewing and sharing. Use when Codex needs to render `.md` content into a presentable PDF, preserve headings and code blocks, choose an output filename, or
SKILL.mdskills/markdown-to-pdf/SKILL.md
GitHubMarkdown To PDF
Overview
Use this skill to turn Markdown documents into PDF files with a dependable local workflow. Prefer deterministic local renderers over ad hoc copy-paste or manual export.
When possible, use the bundled script to detect an available renderer and perform the conversion. Keep the workflow simple: source Markdown in, PDF out.
Workflow
1. Confirm the input and output
Identify:
- the source Markdown file
- the desired output PDF path
- whether default styling is acceptable or whether the user wants a cleaner presentation
If the user does not specify an output path, default to the same basename as the Markdown file with a .pdf extension.
2. Use the bundled renderer script
Run:
scripts/render_markdown_pdf.sh <input.md> [output.pdf]
The script tries these renderers in order:
pandocweasyprintwkhtmltopdf- Google Chrome headless
If no renderer is available, report that clearly and suggest installing one of the supported tools.
3. Verify the result
After rendering:
- confirm the PDF file was created
- report which renderer was used
- mention if the conversion used a fallback path
If the output looks likely to have formatting limits, say so briefly.
Output Rules
- Prefer the bundled script instead of re-deriving renderer logic each time.
- Default to preserving headings, paragraphs, lists, and fenced code blocks.
- Do not invent rich visual styling unless the user asks for it.
- If the renderer is missing, explain the missing dependency plainly instead of pretending the conversion succeeded.
Notes
pandocis usually the best general-purpose option when installed.weasyprintandwkhtmltopdfwork through an intermediate HTML render.- Headless Chrome is a useful fallback when a browser is available locally.
Example Requests
- Convert this
threat_model.mdfile to PDF. - Turn this Markdown report into a shareable PDF.
- Render this
.mdfile as a PDF with the default output name.