Research notes

Markdown to PDF: what prints well

We printed one real README through our Markdown to PDF tool and from GitHub, then measured what ran off the page and what the PDF text kept.

Updated 24 September 2026

Paper doesn’t scroll. A code line wider than the page gets cut off at the edge, and the cut part is gone from the PDF’s text too, so you can’t even copy it out. When we printed the README of the command-line tool bat through our own Markdown to PDF tool, 4 of its 58 code blocks ran off the page. Printing the same README from GitHub’s own page cut 7.

One README, printed three ways

On 24 September 2026 we took the README of sharkdp/bat (MIT or Apache 2.0 licence, commit 4987f76): 942 lines with 58 code blocks, 2 tables and 8 pictures. We printed it three ways in Chromium 153, all to A4 with 10 mm margins and the date and address lines turned off: through our Markdown to PDF tool, from GitHub’s page for the README file, and from the repository’s front page, where most people first see a README. Then we counted pages, measured what ran past the edge, and read the text back out of each PDF.

The bat README (commit 4987f76) printed to A4 PDF in Chromium 153, 10 mm margins, 24 September 2026 (n=1 README; our tool measured before and after the fix described below)
Printed fromPagesPDF sizeCode blocks cut offNotes
WipeTheAI, before the fix23590 KB4 of 58Two lines missing from the PDF text
WipeTheAI, after the fix23588 KB0 of 58Long lines wrap
GitHub, README file page22905 KB7 of 58Menus and file details on page 1
GitHub, repository front page18971 KB0 of 58File list fills page 1; everything shrunk to 79%

The front page gets its short page count the wrong way. It was 912 pixels wide against 718 for the paper, so Chromium shrank every page to 79% to make it fit, and the list of files took all of page 1. The code blocks only fit because the text got smaller.

Two lines were cut short on paper and in the text. A shell line from the Windows section stopped at $(cygpath --windows "${ar, and the theme preview command stopped at /path/to/fil. We changed the tool the same day: in the PDF, code now wraps onto the next line instead of running off the page. Every line of the README is now in the PDF’s text apart from the picture descriptions, which print as pictures.

Wide tables shrink everything

We made a second test file with the GitHub extras a README might use, including an eight-column table with a long web address in one cell. Before the fix, that table was 1,076 pixels wide on a 718-pixel page, so Chromium printed the whole document at about two thirds of its size, headings and all. Long addresses in table cells now break where they need to, and the page stays at full size. A long address in a paragraph wraps the same way.

Long tables print well. A 150-row table we made with our CSV to Markdown table tool came out as 6 pages of 26 rows, and Chromium repeated the header row at the top of every page without being asked. Tables and pictures shorter than a page are kept whole, which can leave white space at the bottom of the page before them.

What prints differently from GitHub

Our tool follows the GitHub Flavored Markdown spec. GitHub’s website shows a few things the spec doesn’t cover, and those print as typed:

  • Footnotes: [^1] stays as those characters, and the note prints where it was written.
  • Alert boxes: bat’s README has five > [!NOTE] boxes, and each printed as a plain quote starting with “[!NOTE]”.
  • Maths and emoji codes: $E = mc^2$ and :tada: print as typed.
  • Pictures with a short address such as doc/logo.svg: GitHub knows which repository they belong to, our tool doesn’t, so they show as a broken picture with their description. bat’s logo is one. Give such pictures their full web address before printing.

Folded sections (<details>) used to print folded, with their contents left out of the PDF. The tool now opens them before printing, since nobody can click to open one on paper.

Selectable text, mostly

The PDF holds real text: search works and you can copy from it. The copied characters depend on the reader. From our bat PDF, macOS’s own reader gave back “中文” and “Русский” exactly, but broke some words across lines. pdf.js, the reader built into Firefox, kept the words whole but swapped in look-alike characters: a different code for 文, a “ĸ” for the “к” in Русский, and a different apostrophe in “don’t”. Fine for reading and searching in the same reader; check before pasting non-English text into something that compares it exactly.

To print a README, paste it into Markdown to PDF and check the preview for pictures that show as broken. If the text should go somewhere else as plain words, not a PDF, Markdown to text drops the formatting marks; our notes on tables and plain text cover what happens to tables on the way.

Sources

  1. sharkdp/bat on GitHub (the test README, MIT or Apache 2.0)
  2. GitHub Flavored Markdown spec
  3. GitHub Docs: basic writing and formatting syntax (footnotes, alerts, emoji)
  4. GitHub Docs: writing mathematical expressions
  5. MDN: overflow-wrap