Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
Last active September 1, 2023 00:41
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save magnetikonline/4394355 to your computer and use it in GitHub Desktop.
Save magnetikonline/4394355 to your computer and use it in GitHub Desktop.
Bookmarklet to pretty print Gist pages without the usual page chrome, just content.

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,#footer{display:none;}.file-box{border:0!important;}';document.getElementsByTagName('head')[0].appendChild(el);alert('Please consider the environment before printing :)');
  • Navigate to your Gist of choice
  • Hit the bookmarklet
  • Now print
  • Done!
@chankeypathak
Copy link

I get this error

Please consider the environment before printing :)

@magnetikonline
Copy link
Author

@chankeypathak there is a very good chance this no longer works. And just testing now, it seems you no longer need this anyway with the current GitHub stylesheet.

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