Convert Markdown to PDF
markdown_to_pdfConvert Markdown files to PDF documents with customizable page size, table of contents, and CJK font support using Pandoc.
Instructions
Convert a Markdown file to PDF format using Pandoc. Arguments:
inputPath (string, required): Path to the input Markdown file (relative to workspace)
outputPath (string, optional): Path for the output PDF. Defaults to same name with .pdf extension
title (string, optional): Document title for the PDF metadata
toc (boolean, optional): Include a table of contents
pageSize (enum, optional): Page size — 'A4' or 'Letter'. Defaults to 'A4'
theme (enum, optional): Theme — 'default', 'github', or 'academic'. Currently informational
pdfEngine (enum, optional): PDF engine — 'pdflatex', 'xelatex', 'lualatex', 'wkhtmltopdf', 'weasyprint', or 'typst'. Leave unset to let Pandoc choose
cjkMainFont (string, optional): CJK main font used by xelatex for Chinese/Japanese/Korean PDF output. Example: 'Microsoft YaHei', 'SimSun', 'Noto Sans CJK SC'
preserveSource (boolean, optional): When true, save the original Markdown as a sidecar file (e.g. sample.pdf.source.md) for accurate PDF-to-Markdown recovery. Defaults to false
strictMarkdown (boolean, optional): If true, reject files with structural issues (unclosed code blocks). Defaults to false
overwrite (boolean, optional): Allow overwriting existing output. Defaults to false
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inputPath | Yes | Path to the input Markdown file (relative to workspace) | |
| outputPath | No | Path for the output PDF file (relative to workspace). Auto-derived if omitted. | |
| title | No | Document title for PDF metadata | |
| toc | No | Include a table of contents | |
| pageSize | No | Page size for the PDF | |
| theme | No | Visual theme (via CSS) | |
| pdfEngine | No | PDF rendering engine to use. Leave unset to let Pandoc choose automatically. | |
| cjkMainFont | No | CJK main font for Chinese/Japanese/Korean PDF output (used by xelatex). Example: 'Microsoft YaHei', 'SimSun', 'Noto Sans CJK SC'. | |
| preserveSource | No | When true, save the original Markdown as a sidecar file (e.g. sample.pdf.source.md) for accurate PDF-to-Markdown recovery. Defaults to false. | |
| strictMarkdown | No | If true, reject input if Markdown has structural issues like unclosed code blocks. | |
| overwrite | No | Allow overwriting existing output file. Defaults to false. |