GitHub README to PDF

Paste a README and download a PDF that looks the way it does on GitHub, with its alerts, badges, code and tables. Handy for documentation you need to hand to someone who won't read it on GitHub. Free, and nothing is uploaded.

Markdown
Preview

Getting the README's Markdown

The README on a repository's front page is already formatted, and selecting it with the mouse copies the text without its Markdown. Copy the file itself instead:

  1. Open the file. In the list of files above the README, click README.md. The README panel on the front page has no copy button of its own.
  2. Click Copy raw file. It's the icon of two overlapping squares next to the Raw button, above the file. It copies the Markdown exactly as it was written.
  3. Paste it into the editor above, replacing the example. Choose the GitHub style to make it look like github.com, or any other style.
  4. Click Download PDF and choose Save as PDF in the print dialog.

There are other ways to get the same text. Raw opens the file as plain text, ready to select and copy, and Download raw file, the arrow beside it, saves README.md so you can open it here with Open file or by dropping it on the page. A README in a project on your own computer can be opened the same way.

What carries over

Paths inside the repository are the one thing to check before you download: such images don't appear, and such links print as plain words.

Alerts

GitHub alerts are quotes whose first line is [!, a type and ]. In the GitHub style, md2pdf.me draws all five the way GitHub does, with a colored bar, an icon and a title; the other styles set them off in their own way.

> [!NOTE]
> Useful information, even for someone skimming.

> [!TIP]
> A better or easier way to do something.

> [!IMPORTANT]
> Something needed to succeed.

> [!WARNING]
> Something that needs attention right away.

> [!CAUTION]
> The risks of doing something.

Put the marker on a line of its own, with the text on the lines after it, each starting with >. Obsidian's callouts work as well: names such as [!info] or [!danger] take the color of the closest GitHub type, and words after the marker on the same line become the title. GitHub doesn't know either, so leave them out of a README that people will also read on GitHub.

Badges

Badges, the small labels at the top of many READMEs, are images from services such as shields.io:

[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

Because they have full web addresses, they load here and print in the PDF. (The badge's own link, to LICENSE, is a path in the repository; see links to other files.) A badge that shows a live value, such as whether the latest build passed or the number of downloads, prints the value it had when you made the PDF. For a handout, you may prefer to delete the line of badges altogether.

Images with relative paths

A README often shows an image stored in the repository by its path, such as ![Screenshot](docs/screenshot.png). GitHub knows which repository the README belongs to and finds the file. md2pdf.me only has the text you pasted, so the image is missing in the preview and the PDF. The same happens to HTML images such as <img src="logo.svg">.

Give each one its full address on raw.githubusercontent.com, which serves the repository's files as they are. Put the owner, the repository and the branch in front of the path, without any / or ./ it starts with. If the README is in a folder, such as docs/README.md, the path starts from that folder, so add the folder's name too.

![Screenshot](docs/screenshot.png)
                    ↓
![Screenshot](https://raw.githubusercontent.com/OWNER/REPO/main/docs/screenshot.png)

For example, the repository at github.com/jbrecht/md2pdf has the owner jbrecht and the repository md2pdf. The branch is usually main, or master in older projects; it's shown on the branch button above the file list. To check an address, open it in a new tab: you should see the image on its own. PNG, JPEG, GIF and SVG images all work.

This only works for public repositories. Images in a private repository need a GitHub sign-in, so they may not appear. The troubleshooting guide covers other reasons an image doesn't load.

Links like [Contributing](CONTRIBUTING.md) or [license](LICENSE) work on GitHub, which reads them as files in the same repository. Here they have no repository to point to, so they print as plain words, not links. For a link the reader can follow, give it the full address of the file on GitHub, with blob and the branch before the path:

[Contributing](https://github.com/OWNER/REPO/blob/main/CONTRIBUTING.md)

HTML in READMEs

READMEs often mix HTML into the Markdown. md2pdf.me shows it as a browser would, which matches GitHub for most of it: <p align="center"> centers a logo or a line of badges, and <img width="…"> sets an image's size. A few things behave differently in a PDF:

Frequently asked questions

Is my README uploaded anywhere?

No. md2pdf.me makes the PDF in your browser, so the text never leaves your computer, which matters for internal documentation. Images and badges are loaded from wherever their addresses point, just as they would be on any web page.

Can I convert a README from a private repository?

Yes. Copy it while you're signed in to GitHub and paste it here; the text converts like any other. Images stored in the private repository may not load, since they need a sign-in.

Can I put several Markdown files in one PDF?

Paste them one after another. To start each on a new page, put <div class="page-break"></div> on its own line between them. The page breaks guide has more.

Does it work with READMEs from GitLab or Bitbucket?

Mostly. Headings, lists, code and tables are standard Markdown and come out the same. Each site has a few extras of its own, and any that md2pdf.me doesn't know show as plain text. Relative images need their full addresses there too: open the image in the repository and use its raw address.

Related pages

Read the Markdown guide