Skip to content

What a Markdown file keeps when it becomes a PDF

Markdown is written to be read in two ways: as plain text, and as the formatted page a site like GitHub draws from it. A PDF of it should look like the second. Headings become larger type, code goes into shaded monospaced blocks, tables get rules and columns, and links stay clickable, so the PDF can be sent to someone who has never opened a .md file.

Updated

Which tool you need

  • A README or documentation to hand to someone outside the repository

    Markdown to PDF draws it as GitHub would, task lists and tables included, with every link still working in the PDF.

  • Meeting notes or a draft kept in a notes app

    Export the note as a .md file and convert it here. Page numbers at the foot of each page help when the notes run long.

  • A plain text file with no Markdown in it

    Text to PDF keeps every line and its indentation as typed, which suits files that were never meant to be formatted.

    Text to PDF

  • Going the other way, from a PDF to Markdown

    PDF to Markdown reads the text of a PDF and works out its headings and lists from the size of the type.

    PDF to Markdown

Why pictures are not in the PDF

A picture in Markdown is usually a link to a file somewhere else — on GitHub, on a server, on your disk. Drawing it would mean requesting that address from your device, which is exactly the kind of network traffic PDFCheetah promises not to make while it holds your document.

So each picture is replaced by its description, the words inside the square brackets, and the count of them appears before you create the PDF. If the pictures matter, add them afterwards with Edit PDF, which places a picture you choose from your own device.

How the Markdown page is typeset

Body text and headings are Noto Sans, and code, inline or in a block, is Courier on a light gray background. The sans face is bundled in a single weight, so bold is drawn by thickening the letters and italic by slanting them. The two largest heading levels are ruled underneath, and a heading that would land at the foot of a page moves to the next one with the lines it introduces.

Front matter, the block between two --- lines at the very top that Jekyll and many note apps write, is treated as metadata and left out. A line of code too wide for the page breaks between characters onto the next line, so nothing in the block is cut off, though one long command can read as two.

Which links still work in the PDF

A link with a full web or email address stays clickable, and so does a bare address such as www.example.com. A link to another file in the repository, such as docs/setup.md, or to a heading on the same page with #, has no address a PDF reader could open, so its words are kept in ordinary type and the result says how many links that happened to.

Before sending a README out of its repository, it is worth turning its relative links into full addresses, because the reader of the PDF will not have the other files.

What to know before you start

  • Pictures are shown by their description, never fetched.
  • HTML tags are not drawn; the text inside them is kept.
  • Emoji never draw, and nor does a script above the chosen Fonts level; both become a replacement mark.

Read next