Skip to content

Instantly share code, notes, and snippets.

@reallistic
Forked from mash/prettyprintgist.md
Last active September 25, 2019 21:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save reallistic/189c1fade597d6af8869d7d076351df2 to your computer and use it in GitHub Desktop.
Save reallistic/189c1fade597d6af8869d7d076351df2 to your computer and use it in GitHub Desktop.
Bookmarklet to pretty print Gist and Github pages without the usual page chrome, just content. Handy for Markdown document printing.

Pretty print bookmarklet helper for Gist pages

Create a new bookmark somewhere handy in your browser with the following URL:

javascript:var el=document.createElement('style');el.media='print';el.innerHTML='#header,.pagehead.repohead,.gist-description.container,.file-box .meta,#comments,.js-comment-form,.gist-header,.file-header,.gisthead,#footer,div.commit-tease,div.file-navigation{display:none;}.file-box{border:0!important;}';document.getElementsByTagName('head')[0].appendChild(el);alert('Now, cmd+p to print');
  • Navigate to your Gist of choice
  • Hit the bookmarklet
  • Now print
  • Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment