Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
Last active July 10, 2022 04:52
Show Gist options
  • Save pesterhazy/2e53deede0b4e32a9acb4c00ecc23b6a to your computer and use it in GitHub Desktop.
Save pesterhazy/2e53deede0b4e32a9acb4c00ecc23b6a to your computer and use it in GitHub Desktop.
Print Github Markdown

I often want to read Markdown documentation on Github — or proof-read my own documents — without staring at a backlit screen. Here's an easy way to print the files in a readable format.

  1. Create a bookmarklet with the following code and give it the name "github print"

    javascript:void function(){b=document.body,c=document.querySelector("article"),b.innerHTML="",b.appendChild(c)}();
    
  2. Go to the markdown view on Github of the file you want to print, e.g. Ripgrep's user guide

  3. Click on the bookmarklet. Alternatively (in Chrome) type "github print" in the search bar, select the bookmarklet code with cursor keys if necessary and press enter.

  4. Use the browser print feature to print the document, to a physical printer or (to save paper) to PDF on a reMarkable eInk tablet.

This bookmarklet, which works with private and public repositories and even gists like this one, will remove all the user interface and leave you only with the content.

@pesterhazy
Copy link
Author

This is what the printed output looks like

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment