Markdown to PDF

Write or drop in Markdown, see it rendered, and download it as a PDF.

Preview

Release notes — v2.4

A short sample so you can see how the preview maps onto the page. Replace it with your own text, or drop a .md file above.

What changed

  • Bold and italic and struck through text
  • inline code and links
  • Nested lists:
    • second level
    • and a third
  1. Ordered lists work too
  2. Numbered from the source

A table

ComponentStatusOwner
ImporterShippedAna
ExporterIn reviewBen
SchedulerBlockedCai

A checklist

  • Write the migration
  • Backfill the old rows

Blockquotes are indented with a rule down the left.

const total = rows.reduce((sum, row) => sum + row.amount, 0)
console.log(total)

Anything after a horizontal rule keeps flowing onto as many pages as it needs.

About Markdown to PDF

Paste Markdown into the editor or drop a .md file onto the strip above, check the rendered result on the right, and download it as a PDF. The preview is not a rough approximation: the same stylesheet drives both, the preview is measured in the same Helvetica metrics and whole-point sizes the PDF is drawn with, and the file is built by copying that rendered document offscreen at the exact page width and walking it. Text is written into the PDF as text, so the result can be selected, searched and copied rather than being a picture of a page.

What gets rendered

The parser handles CommonMark plus the GitHub extensions, which covers nearly everything a README or a set of notes contains: six heading levels, bold and italic, strikethrough, ordered and unordered lists nested to any depth, task lists drawn as ticked and empty checkboxes, pipe tables that honour the alignment colons in the separator row, blockquotes including nested ones, fenced and indented code, inline code, horizontal rules, images, footnotes, and bare URLs recognised as links. Line breaks follow Markdown's rules — a single newline continues the paragraph, two spaces at the end of a line force a break, and a blank line starts a new paragraph. One caveat about links: in the preview they are clickable, but the PDF renderer writes text rather than link annotations, so in the downloaded file a link is coloured and underlined but not clickable and the address behind it is not stored. Write the URL out in the visible text when readers will need it. For the same reason the return arrow that closes a footnote is left out of the PDF — it would not be clickable, and it is not a character the standard PDF fonts can draw.

Two things are deliberately absent. Raw HTML embedded in the Markdown is printed as visible text rather than interpreted, which means a document from an untrusted source cannot inject anything into this page. And code blocks are not syntax highlighted; they are set in a monospace face on a light panel, with the language label carried in the markup but not coloured.

How the page is put together

Choosing A4 or Letter sets the render column to the page width less a half-inch margin on each side — 523 points for A4, 540 for Letter. The rendered document is laid out as one continuous column at that width, and before anything is drawn the tool measures every block in it and works down the page seams in order: a paragraph, heading, list item, table row, code block or image that would sit across a seam has whitespace inserted in front of it so that it starts the next page whole instead. That is why a long table breaks cleanly between rows rather than through one. There is no way to force a break at a particular point.

One case cannot be tidied away: a single block that is taller than a page on its own — a very long code block, an unusually long paragraph, or a tall image. It has to be cut somewhere, so it is drawn on both pages and clipped at the margins, and the tool reports how many such splits a document produced once the file is saved. Content is never dropped. (A tall image split this way also runs into the top and bottom margins on the pages in the middle of the run; that is a limitation of the underlying renderer.) Sideways, nothing runs off the paper: everything is made to fit the column instead. A table is always set to the full column width, so a twelve-column table simply gets twelve narrow cells with the text wrapping inside them; an unbroken run of characters longer than the line is broken mid-word; an oversized image is scaled down; and long lines inside code blocks, which scroll sideways in the preview, are re-wrapped for the PDF because a printed page has no horizontal scrollbar. The limit is legibility rather than clipping — past roughly eight columns a table becomes unreadable, and CSV to PDF is the better tool, since it lays the data out as a ruled table and can print it landscape.

Fonts, glyphs and images

Text is drawn with the standard PDF fonts every reader provides — Helvetica for prose, Courier for code, with bold and italic variants — so no font file is embedded and a long document stays small. The limit of that approach is the character set: only the Latin-1 and Windows-1252 repertoire has glyphs, which covers accented Latin, curly quotes, dashes, the ellipsis, the euro and so on. Accents are composed first, so decomposed text — the form macOS hands over — still prints as café. Cyrillic, Greek, Arabic, Hebrew, Devanagari, CJK and emoji have no glyph, so each visible character becomes one question mark and the tool tells you how many it replaced, which is better than the look-alike Latin rubbish those bytes would otherwise turn into; characters that draw nothing anyway, such as zero-width joiners and byte-order marks, are dropped instead of being replaced. Images referenced by an http or https URL are loaded by your browser, re-encoded as a right-sized JPEG so a screenshot costs a few hundred kilobytes rather than several megabytes, and embedded when the host serves them and allows a cross-origin read; one that is missing, unreachable or refused is left out and counted for you, and the renderer never touches the network itself, so a dead image URL cannot stall a conversion. Images written as data URIs are dropped by the Markdown renderer before they reach the page.

Related tools and privacy

For plain typed text with no formatting at all, Create PDF is simpler and produces a smaller file. For existing markup, HTML to PDF takes the same route from a sandboxed preview. Markdown Previewer is the place to edit and export standalone HTML, and Paste to Markdown converts rich text from a word processor into Markdown you can bring here. Once you have the PDF, Merge PDF, Add Page Numbers to PDF and Protect PDF pick up where this leaves off. Nothing you type or load is uploaded: parsing, rendering and PDF generation all run inside this browser tab.

GitHub-flavoured Markdown

Headings, bold, italic, strikethrough, ordered and unordered lists, task lists with real checkboxes, pipe tables with column alignment, blockquotes, fenced code, horizontal rules, footnotes and bare-URL autolinks are all parsed and rendered.

The preview is what gets printed

One stylesheet drives both the pane on the right and the offscreen copy that becomes the PDF, and the preview is measured in the same Helvetica metrics at the same whole-point sizes the file is drawn with, so words and punctuation land where you saw them. Mainly the line breaks move, because the pane is as wide as your window while the PDF column is fixed — 523 points on A4, 540 on Letter.

Selectable text, no upload

The renderer writes text-drawing operators rather than a screenshot, so the PDF can be searched and copied. Parsing, layout and file assembly all happen in this tab; your document is never transmitted.

Frequently Asked Questions

Which parts of Markdown are supported?

CommonMark plus the GitHub extensions: headings, emphasis, strikethrough, ordered and unordered lists, task lists rendered as ticked or empty checkboxes, pipe tables with per-column alignment, blockquotes including nested ones, fenced and indented code blocks, inline code, horizontal rules, images, footnotes and bare URLs turned into links. Links are styled but not clickable in the downloaded PDF — the renderer writes text, not link annotations. The little return arrow at the end of a footnote is dropped from the PDF: it is a character the standard PDF fonts have no glyph for, and it would not be clickable in the file anyway. Not supported: LaTeX maths, which prints as literal dollar-sign text, definition lists, and Markdown extensions specific to a particular static-site generator.

Can I put raw HTML in my Markdown?

No — HTML tags are printed as visible text rather than interpreted. Typing a bold tag around a word puts the angle brackets on the page. This is a deliberate safety property: because no markup from your document is ever inserted as live HTML, a pasted document cannot run anything in this page. If you already have HTML and want it laid out as a browser would, use HTML to PDF instead, which previews it inside a sandboxed frame.

Are code blocks syntax highlighted?

No. A fenced block keeps its language label in the markup but is drawn in one colour in a monospace face on a light panel. Long lines inside a code block wrap in the PDF rather than running off the right edge, because a printed page cannot be scrolled sideways, whereas the preview pane lets the block scroll — that is the one place the PDF deliberately differs from the preview. Wide tables used to differ too; they no longer do, because the preview now uses the same fixed table layout as the page.

What happens to images?

An image with an http or https address is fetched by your browser, shown in the preview, and re-encoded as a JPEG at roughly twice its printed size before it goes into the PDF — that keeps a screenshot to a few hundred kilobytes instead of the several megabytes of raw pixels it would otherwise add. The re-encode needs the host to serve the file and to allow a cross-origin read; an image that is missing, unreachable or refused is taken out of the document, the rest of the page is unaffected, and the number left out is reported after the download. A host that accepts the connection and then goes quiet is given twenty seconds before it counts as unreachable, and that twenty seconds belongs to the whole document rather than to each image: six load at a time and the clock is only restarted by an image that actually arrives, so a README full of dead badges costs one wait no matter how many of them there are, while a slow but working host is never cut off part-way down a long page. Note that loading such an image is a request from your machine to that server — nothing of your document is sent, but the image host does see the request. Data-URI images are dropped by the Markdown renderer and will not appear. For a PDF built out of pictures on your own disk, use Image to PDF.

Which fonts and characters can the PDF use?

The output is drawn with the standard PDF font set — Helvetica for body text and Courier for code — with bold and italic variants. No font file is embedded, which keeps the file small and consistent everywhere, but it also limits the glyphs to the Latin-1 and Windows-1252 repertoire: ASCII, accented Latin letters, curly quotes, dashes, the ellipsis, the euro and so on. Accented letters are composed before anything is measured, so text that arrives decomposed — which is what macOS hands over when you copy from a native app — still prints as café rather than as cafe followed by a question mark. Cyrillic, Greek, Hebrew, Arabic, Devanagari, CJK and emoji have no glyph, so each character you can see becomes one question mark, counted once: a multi-part emoji costs one, not five. The number replaced is reported after the download rather than being quietly turned into look-alike Latin rubbish. Characters that draw nothing in the first place — zero-width joiners, bidi marks, a stray byte-order mark — are dropped rather than replaced, so they cannot leave a question mark inside a word that looked clean in the preview. For documents in those scripts, print the preview with your browser instead, since browser printing uses your system fonts.

How are page breaks decided?

The rendered document is laid out as one long column at the page width minus a half-inch margin on each side, and the tool then measures every block in that column and inserts whitespace so that no paragraph, heading, list item, table row, code block or image sits across a page seam — a block that would straddle the break is moved down to start the next page instead. You cannot force a break at a chosen point. One thing cannot be moved: a single block that is itself taller than a page, such as a very long code block, an unusually long paragraph or a tall image. Those are split at the seam, the split is drawn on both pages, and the tool tells you how many such splits happened after the download. Nothing is ever dropped. On a document of well over a thousand pages the planner eventually runs out of the work budget it is given; if that happens it says so afterwards, and blocks past that point may sit across a seam. Sideways, nothing runs off the paper either: a table always fills the column, so extra columns make every cell narrower and the text inside them wraps, and an unbroken run of characters too long for the line is broken mid-word. Past roughly eight columns a table stops being readable that way — for wide tabular data, CSV to PDF sets it as a proper table and can print it landscape.

Which files can I load, and what is the PDF called?

The drop zone accepts .md, .markdown and .txt files, read as UTF-8 text. Anything else — a PNG, a PDF, or a file with no extension at all, which is how a bare README often arrives — is rejected, and the tool says so instead of doing nothing. Rename such a file or paste its text into the editor, which is often quicker anyway. The download is named after the file you loaded — notes.md becomes notes.pdf — or markdown.pdf when you typed straight into the editor.

Is any of this uploaded?

No. The Markdown is parsed in this tab, rendered into the preview you can see, cloned offscreen at the page width, and walked to produce the PDF, all inside the browser. Everything the converter needs is loaded with the page, so there is no server round trip when you press the button and the tool still works with the network off — the only exception is an image referenced by an http address, which your browser has to fetch from its host. That makes this a reasonable place to typeset notes you would not paste into an online editor.