Keep Markdown as the master and render it with a GitHub-flavored parser. For a 5–30 page document, a local browser export is fast, private and good enough, provided you accept image-only pages with no selectable text. For a real text layer, controlled page breaks or an embedded house font, spend an hour on Pandoc. Cloud converters are the convenient middle: no install, but the file is uploaded and you get the least typographic control.
How we tested this
- Browsers: Chrome 141, Edge 142, Safari 18.2 and Firefox 143 on Windows 11, macOS 15.3 and Ubuntu 24.04.
- Documents: a 22-page deployment runbook with 61 code fences and 9 tables, a two-page resume, a 14-page API spec, and a bilingual document with Chinese headings.
- Measured: page count, table overflow, wrapping at 80/100/120 characters, CJK glyphs, export time and file size.
- Checked every output in Adobe Reader and macOS Preview, including text selection. These are desk tests, not benchmarks.
The document that made me stop improvising was a 22-page deployment runbook. It had 61 fenced code blocks, nine tables, four architecture diagrams and one six-column compatibility matrix, and it had to go to a client auditor with no repository access. My first export was a brick: commands ran past the right margin, the matrix was sliced in half, and page breaks landed in the middle of a rollback sequence. The list below is what I check before any .md file leaves my machine.
What a real technical Markdown file contains
Before comparing converters, define "beautiful" in measurable terms. For that runbook it meant four things: one consistent heading scale, nothing spilling past the right margin, code blocks that keep their indentation, and no page break splitting a command from its output. At 760 pixels wide, with 16-pixel text and 1.6 line height, prose ran about one page per 480 words; each diagram added a page, each long table half a page. That arithmetic is useful: a 4,000-word spec with a dozen code samples is a 12–16 page PDF.
Heading discipline matters as much. Skipped levels are invisible on GitHub because the theme compensates, but in a PDF they look like a document assembled from three files. One #, ## for sections, ### for subsections, and no decorative headings.
CommonMark, GFM and MDX: what survives export
Markdown is not one language. CommonMark defines the core syntax; GitHub Flavored Markdown adds tables, task lists, strikethrough, autolinks and footnotes; MDX adds JavaScript expressions and components on top. A CommonMark-only converter shows your pipe table as a paragraph of vertical bars, and a raw MDX file can lose chunks that were never Markdown. The parser behind our browser tool is marked, which implements CommonMark plus the GFM extensions, so tables and fenced code work; it does not execute JSX.
| Feature | CommonMark | GFM (marked, GitHub) | MDX |
|---|---|---|---|
| Pipe tables | No | Yes | Yes |
| Task lists | No | Yes | Yes |
| Strikethrough | No | Yes | Yes |
| Footnotes | No | Yes | Yes |
| JSX components | No | No | Yes |
| Raw HTML blocks | Yes | Yes | Restricted |
Three non-standard dialects bite developers most often. Obsidian wiki links such as [[onboarding]] render as literal brackets, callouts become ordinary blockquotes, and Pandoc fenced divs appear as raw colons. Strip those extensions before converting. For MDX, replace {expression} and <Component /> with prose first; the braces may be treated as text or silently dropped.
Tables, code fences and the parts that break
A minimal, export-safe document looks like this. The language tag after the backticks triggers highlight.js; without it the block still renders, monochrome.
# Deploy runbook
## Rollback
| Step | Command |
|------|---------|
| 1 | `kubectl rollout undo deploy/api` |
```bash
kubectl -n prod rollout undo deploy/api
kubectl -n prod rollout status deploy/api
```
Tables are the first thing to break. The delimiter row is mandatory, alignment comes from colons, and a literal pipe inside a cell must be escaped as \\|. Six columns of prose in a 760-pixel column is unreadable even when the parser handles it, so I split wide matrices or move them to an appendix. Unbroken identifiers force the table wider than the page, cutting off the right edge.
Code is the second. Fenced blocks keep indentation only if every line is indented consistently, and lines longer than about 88 characters are clipped rather than wrapped, because the exported page has no scrollbar. I hard-wrap shell pipelines at 80 characters. Task lists are subtle: some parsers show literal - [ ] text, so for a PDF I rewrite them as "Done:" and "Pending:" labels. Images and links need care: a relative path such as ./img/arch.png shows as a broken icon, and an internal link such as ../docs/api.md becomes dead. Use absolute HTTPS image URLs that allow cross-origin reads, or embed diagrams as data URIs; for a folder of screenshots, the images to PDF converter is the better starting point.
Pandoc, cloud services and the browser route
There are three real paths. Pandoc is the reference implementation: it converts Markdown to LaTeX and then PDF, so you get a genuine text layer, section numbering, cross-references and precise page breaks. The cost is a TeX install of roughly 1.2 GB and a template you will debug. Cloud converters ask for nothing but an upload, then return a file whose typography you cannot inspect until it is too late; fine for public notes, wrong under NDA. The browser route renders Markdown to styled HTML and prints it locally.
| Route | Setup | Text layer | Page-break control | Fonts and CJK | Privacy | Time to first PDF |
|---|---|---|---|---|---|---|
| Pandoc + LaTeX | Heavy install, template work | Yes, selectable | Explicit | Full, embeddable | Local | 1–3 hours including setup |
| Cloud converter | None | Varies by service | Minimal | Usually fixed | File uploaded | 20–40 seconds plus upload |
| Browser renderer | None | No, raster pages | Automatic only | System fonts | Local | 8–14 seconds |
Those timings come from one laptop on a 20 Mbps connection, three exports of the same file. This is not a quality ranking: the browser route wins on setup and privacy, loses on typography.
The export workflow I use, step by step
- Normalise the headings. One H1, no skipped levels, no decorative headings. This fixes most "the PDF looks wrong" complaints.
- Pick the flavor and strip the rest. Confirm it is Markdown, not MDX. Remove wiki links, callouts and fenced divs, or accept the punctuation.
- Fix every image reference. Replace relative paths with absolute HTTPS URLs you have opened in a private window, and resize anything wider than 1,200 pixels.
- Wrap long lines. Keep code and table cells under roughly 88 characters. Confirm the indentation survived your editor.
- Rewrite internal links. A PDF cannot follow
../docs/api.md. Turn it into an absolute URL or a plain reference such as "see the API spec, section 4". - Paste and preview at 100%. Scroll the whole preview; tables that overflow usually do so at the bottom.
- Export and inspect three pages. Open page one, a middle page and the last page at 200%, and confirm no command is split and no table is clipped.
- Keep the master. Name the PDF with a date and a version, and keep the
.mdbeside it.
Troubleshooting: blank pages, overflow, tofu
The symptom usually points to one cause, often one of the ten conversion mistakes.
| Symptom | Likely cause | Fix |
|---|---|---|
| Blank or partly blank pages | Canvas too tall for the GPU, or a cross-origin image tainted the render | Split the document into 15-page chunks; host images with CORS headers |
| Table cut off on the right | Too many columns or unbroken long strings | Split the table, shorten headers, allow wrapping in cells |
| Code lines clipped | No wrapping in print | Hard-wrap at 80 characters |
| Chinese or Japanese shows as boxes | No CJK font installed in the browser | Install Noto Sans SC/TC, or use Pandoc with xeCJK |
| Broken image icons | Relative path or blocked cross-origin request | Absolute HTTPS URL or data URI |
| PDF is 30 MB for 20 pages | Pages rasterised at high scale | Split the file, or switch to Pandoc |
Blank pages are almost always a rendering limit. A long document becomes one very tall image before it is sliced into pages, and past the browser's canvas cap it fails silently, leaving white sheets. Export in sections. Code clipping is the opposite: the exporter honours visible overflow but not scrollbars, so long lines leave the page. Wrap them.
The Chinese test taught me about fonts. A Windows machine without the optional Chinese pack rendered headings as tofu boxes. Installing Noto Sans SC fixed it and proved the limitation: the PDF inherits the author's machine. For identical output everywhere, embed the font through Pandoc.
What the browser tool does not do
Being precise about the trade-off matters more than praising the tool. The local converter parses GFM, highlights fenced code, offers three themes, autosaves the draft in your browser, and exports A4 pages with 10 mm margins — entirely on your machine.
- No text layer. Pages are images, so text cannot be selected, searched or copied; links are not clickable and screen readers see nothing.
- No explicit page breaks. The exporter slices the rendered column, which can split a code block.
- No custom page size, headers, footers or page numbers. A4 only, fixed margins.
- No bookmarks, PDF/A output or accessibility tags. Fine for a runbook, not for a filing requirement.
- System fonts only. No font embedding, which is why CJK and brand fonts are risky.
When Pandoc or LaTeX is the better tool
Switch when the document exceeds 40 pages; needs a table of contents with page numbers, cross-references or a bibliography; must be searched or copied; needs an embedded house font; or must be tagged for accessibility. A resume is the borderline case: applicant tracking systems extract text, and a rasterised resume can score zero even when it looks perfect. Export resumes from Word, Google Docs or Pandoc. The browser tool is right for internal runbooks, where speed and privacy matter more than a selectable text layer.
Write or paste your Markdown, preview it live with GitHub styling, and download a clean A4 PDF — parsed locally, never uploaded.
Open the Markdown to PDF toolFrequently asked questions
Does the exported PDF keep a selectable text layer?
Not with a browser renderer that prints the page as an image: the text is visible but cannot be selected or searched. That is acceptable for a runbook read on screen and unacceptable for a resume or contract that a tracking system must parse. For a real text layer, use Pandoc, Word, or the browser's Print to PDF on the rendered HTML; each of those writes characters, not pixels.
Can I force a page break before a section?
The tool has no page-break controls, and CSS page-break rules are ignored by the image-based exporter. Two workarounds hold up: keep every code block under half a page so it cannot split, and export long documents section by section, then combine the PDFs in your reader. If page breaks are a hard requirement, move to Pandoc, where a heading can start a page with one template line.
Which Markdown flavor does the converter parse?
It uses marked, which implements CommonMark plus the GitHub extensions: pipe tables, fenced code, task lists, strikethrough and autolinks. It does not execute MDX, so remove JSX components and {expressions} first. Obsidian wiki links and callouts are not understood and appear as literal brackets and blockquote text.
How do I get Chinese or Japanese text to render?
The export uses fonts installed on your computer. On Windows, install the optional Chinese font pack or Noto Sans SC; on macOS, PingFang is usually present but a specific Simplified face may not be. Once the preview shows real glyphs, the PDF will too, because the text is baked in as an image. For identical output everywhere, embed the font with Pandoc and xeCJK.
Why did my images disappear from the PDF?
Almost always a path problem. A reference such as ./images/arch.png points at a file the page cannot read, and an absolute URL still fails if the host blocks cross-origin reads. Open the URL in a new tab first; if it loads there but not in the export, host it with permissive CORS headers or embed a compressed copy as a data URI.
Is my document uploaded anywhere?
No. Parsing, styling and export happen in your browser tab; there is no upload endpoint, and no copy is sent anywhere. The draft is saved to local storage so you can close the tab and return, which means it stays on your disk until you clear site data. On a shared computer, use a private window and clear the draft when you finish.