Markdown to PDF from the command line
deft md to-pdf typesets a Markdown file as a PDF: headings, lists, tables, code blocks and images.
deft md to-pdf README.md -o README.pdf
Options
--page-size a4|letter|legal|a3|a5- Paper size, A4 by default.
--margin 25mm- Page margin.
--font-size 11- Body text size in points.
--font NAME- A font family installed on the machine.
-o FILE|DIR- Where to write. Without it,
notes.mdbecomesnotes.pdf.
All options: deft md to-pdf --help. Add --json for a structured result.
A real run
The released deft on a real file. This is exactly what it printed:
$ deft md to-pdf README.md -o README.pdf
ok md.to-pdf README.md -> README.pdf 8 pages 1.02s
README.md: The ripgrep README: badges, a remote screenshot, code blocks, a short hand-made link list. The file, Unlicense OR MIT (ripgrep).
Limits
- Images with relative paths are found next to the Markdown file. A picture that is missing is left out and named in a warning; web pictures are downloaded.
- Raw HTML inside the Markdown is skipped, with a warning.
- Latin text uses fonts built into deft; Chinese, Japanese and other scripts use the system's fonts.
- No LaTeX, pandoc or browser is needed.
What it saves an AI agent
Every task in the deft benchmark that uses this command, run by Claude Code (Opus 5.5, medium effort) once without deft and once with deft and its skill installed. The prompt never mentions deft. Each cell reads without → with deft; click a task for the agent's full trace.
| Task | Solved | Time | New tokens | Failed commands |
|---|---|---|---|---|
| Web page to a PDF with contentsSave the CDC flu page flu.html as a PDF to read offline, flu.pdf, with a table of contents of its sections before the main text. | yes → yes | 173 s → 34 s | 49.4k → 17.5k | 7 → 0 |
| Chinese Markdown to PDF把 books.md 转成 PDF,保存为 books.pdf,中文必须正常显示。 | yes → yes | 85 s → 23 s | 26.1k → 13.6k | 4 → 0 |
| README to PDFRender rust-readme.md as a nicely formatted PDF called readme.pdf. | yes → yes | 70 s → 23 s | 23.1k → 17.6k | 5 → 0 |
| Report with an image and tableRender report.md as report.pdf. The charts it shows from doc/images must appear in the PDF. | yes → yes | 133 s → 23 s | 44.1k → 18.8k | 8 → 0 |
| Turn a workbook into a reportSend the numbers in temperature.xlsx to a client as a PDF with a proper table, temperature.pdf, and give me a Word copy, temperature.docx, that I can edit. | yes → yes | 70 s → 30 s | 21.1k → 14.5k | 3 → 0 |
| Summary table as a one-page PDFFrom tips.csv make a one-page PDF, tips.pdf, for the staff meeting: a table with one row per day and one column each for Lunch and Dinner, holding the total tips. | yes → yes | 45 s → 27 s | 18.5k → 13.2k | 4 → 0 |
| Slide count and a printed outline handoutI'm running the workshop in workshop.pptx. Write the number of slides to count.txt, and make handout.pdf: a printable outline of the deck with every slide's title and text. | yes → yes | 105 s → 28 s | 31.3k → 18.7k | 4 → 0 |
| All 7 tasks | 7 → 7 | 681 s → 189 s | 213.6k → 114.1k | 35 → 0 |
One run per task and arm, on 2026-11-15. Deft was improved against these same tasks, so this is a development benchmark, not a held-out test. New tokens are input not served from the prompt cache, plus output. Failed commands are the agent's tool calls that returned an error: shell commands, and file reads and writes. All tasks: the benchmark.
Install
curl -fsSL https://deftcli.com/install.sh | sh
Or brew install firstprayer/tap/deft. One binary for macOS and Linux;
the script also sets up the skill for Claude Code and Codex. Install guide.