- Home
- Skills
- Writing & Content
- Markdown-to-pdf
More screenshots
Works with the AI Agents you already use
Markdown-to-pdf
Chinese or English Markdown with math, tables and code, typeset to A4 by one Python file and one static binary. No Office, no browser, no TeX.
$5
Markdown-to-pdf
Example session with this skill installed
Use my Agensi skill "md-to-pdf" to turn this into a print-ready PDF.
File: report.md — a physics lab write-up with formulas, a 10-row measurement
table and one python block.
Title: Newton's Rings
Subtitle: Physics Lab 4.18
A4, with page numbers, please. If it needs anything installed, check first and
tell me before downloading.
- Read your context and instructions
- Compiled the markdown-to-pdf
- Generated the document
The result (what your agent delivers)
## Summary
Converted `report.md` into a 2-page A4 PDF — formulas typeset as vector math,
the measurement table intact, page numbers stamped. One command, no browser,
no Office, nothing downloaded.
## What ran
```bash
python md2pdf.py report.md out.pdf "Newton's Rings" "Physics Lab 4.18"
# PDF -> /work/out.pdf (lang: en, bytes: 121451)
What came out
| Element | Result |
|---|---|
| Page geometry | A4, 595 × 842 pt, margins 2.4/2.2/2.5/2.6 cm |
| Typography | 12 pt, 1.72 line height, justified, Times-class serif, hyphenation on |
| Math | 2 display + 8 inline equations, native Typst math (vector, selectable, not images) |
| Table | 10 rows × 5 columns, bold header, alignment preserved |
| Code | python fence, syntax-highlighted, kept whole (not split across a page) |
| Page numbers | 9 pt, centred: "1", "2" |
| Fonts | TimesNewRomanPSMT, Arial-BoldMT headings, NewCMMath for the maths — all embedded |
Verified, not assumed
pages: 2 geometry: 595.3 x 841.9 pt bytes: 121451 exit code: 0
All ten table rows read back out of the PDF, all five section headings found,
the python block's text extractable, and each page's last line is its own page
number. That is the check I run before handing a PDF over — a PDF that merely
"was written" is not a finished job.
Next steps
out.pdfis ready to submit; the sourcereport.mdis untouched.- Same command, Chinese document: the language is detected from the text, so a
lab report in Chinese gets 宋体, a 2em first-line indent and CJK punctuation
rules with no extra flags (--langoverrides if the mix confuses it). - If
typstis missing on your machine, the script exits 3 and names the
download — it never produces a half-broken PDF, and never fetches anything
without asking. --doctorlists typst, Latin serif, CJK serif and monospace availability in
one table before you start.
## Notes for whoever fills the form
- Both fields render Markdown, so the tables and the bash fence will look like
the listing page preview. Keep the backticks exactly as they are.
- If the editor accepts images, upload `docs/img/en-note-page1.png` right after
the "What came out" table — it is the same document.
- The result is ~1,900 characters, comfortably over the 700-character minimum,
and it is real output: re-run `agensi/md2pdf.py` on `examples/en-note.md` and
you get the same 121,451 bytes.
out.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Requires: python3 (3.9+, verified on 3.14) and typst (0.13+, one static
binary, ~30 MB). Chinese documents also need a CJK font — built into Windows,
apt install fonts-noto-cjk on Linux. If typst is missing the script says so
and exits 3 instead of producing a broken PDF; --doctor reports what is present
in one table.
What it does
- Fixed A4 geometry — 2.4/2.2/2.5/2.6 cm margins, 12 pt, 1.72 line height, justified text, 9 pt centred page numbers.
- Bilingual by detection — Chinese gets a 2em first-line indent and a CJK
serif; English gets no indent, hyphenation and a Times-class serif. One
command, no flags;
--langoverrides. - Math —
\( … \)inline,\[ … \]block, typeset by Typst's native math engine. Unsupported TeX commands are printed verbatim and listed on stderr, so a wrong symbol is visible rather than silent. - Code and tables — fenced blocks are syntax-highlighted and never split across a page; pipe tables keep their alignment.
- Deterministic — the same
.mdproduces the same PDF on every run.
How it runs
python md2pdf.py --doctor— checkstypst, a Latin serif, a CJK serif and a monospace face.python md2pdf.py report.md report.pdf "Title" "Subtitle"— detects the language, converts, compiles. A two-page report takes about half a second.- Exit codes mean something: 3 = typst missing, 4 = typst rejected the document,
5 = nothing was written.
--keep-typkeeps the generated Typst source for debugging.
Why not just ask an agent to do it?
You get a different pipeline every time — Pandoc here, WeasyPrint there, a
--pdf-engine flag that does not exist, formulas that silently become $x$, CJK
that renders as boxes. This is one deterministic mapping: Markdown → Typst → PDF,
with typographic values that were measured rather than guessed, and two rendered
examples in the box to prove it.
Good for
- Reports and handouts produced on a headless server or in CI.
- Technical notes with formulas and code that must look the same in 2027.
- Bilingual documents where Chinese paragraphs need real indentation.
Limits (please read)
Nested lists, footnotes, HTML blocks and images are not supported. Images are not
dropped silently — they become a visible [image: alt] marker plus a warning.
Math covers a mapped subset; anything else is passed through verbatim.
No support for nested lists, footnotes, HTML, or images. Requires the typst binary. Math requires specific delimiters. CJK rendering depends on system font availability.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 11 days ago
Requires