How to convert Markdown to PDF (and keep tables, code and Chinese)
Markdown is great for writing, but at some point you need to hand someone a PDF. A README, a set of meeting notes, a spec, a quote — the other person doesn't want a .md file, they want something they can open and print. This guide walks through the options, and pays attention to the three things that usually come out wrong: tables, code blocks, and non-Latin text like Chinese.
The quickest way: convert it in the browser
If you just need a clean PDF now, the simplest path is a browser-based converter. You paste your Markdown (or drop in a .md file), it renders the document, and you save it as a PDF using the browser's own print engine. Nothing gets uploaded to a server, which matters if the document is internal or confidential.
That's the approach this tool uses. The steps are:
- Paste your Markdown or open a
.mdfile. - Pick a page size (A4 or Letter) and a style.
- Click Download PDF, then choose “Save as PDF” in the print dialog.
Because it prints from real HTML, the text in the PDF stays selectable and searchable — it isn't a screenshot.
If you'd rather use the command line
Developers often reach for Pandoc. It's powerful, but turning Markdown into a nice PDF usually means installing a LaTeX engine as well:
pandoc notes.md -o notes.pdf
# needs a LaTeX install (e.g. TinyTeX or MacTeX) for the PDF step
Pandoc is the right tool if you're scripting a build or want full control over templates. For a one-off document, a browser converter is faster and needs nothing installed.
The three things that usually break
1. Tables
Plain Markdown doesn't define tables — they come from GitHub-Flavored Markdown (GFM). A converter that doesn't understand GFM will print your table as a row of pipes and dashes. Make sure whatever you use supports GFM tables. A correct table looks like this in the source:
| Item | Qty | Price |
|---------|----:|------:|
| Cable | 10 | $2.50 |
| Adapter | 4 | $7.00 |
The colons set the column alignment (---: is right-aligned), which is handy for numbers.
2. Code blocks
Fenced code blocks (three backticks) should keep their spacing and, ideally, get syntax highlighting. If your code comes out as one grey lump with no colour, the converter isn't running a highlighter. It still works, but it's harder to read.
3. Chinese, Japanese and Korean
This is the one that catches people out. Many PDF converters ship with a font that has no CJK glyphs, so Chinese characters turn into boxes (□□□) or just vanish. The fix is to use a converter that falls back to a system CJK font. Browser-based tools have an advantage here, because they can use the fonts already on your computer. There's a separate guide on CJK if that's your main concern.
A few tips for a better-looking PDF
- Start the document with a single
#heading — it becomes the title and, in some tools, the suggested filename. - Use
##and###for structure. Walls of text without headings are hard to scan on paper. - Keep tables to a sensible number of columns. Anything past 6–7 columns gets cramped on A4.
- Check the page size matches your audience: A4 for most of the world, Letter for the US and Canada.
Which should you use?
If you want it done in the next thirty seconds and the file is private, use a browser converter. If you're building a repeatable pipeline or need custom templating, use Pandoc. Both produce real, selectable-text PDFs — the difference is setup time and control.