Skip to content

Instantly share code, notes, and snippets.

@ashutosh2411
Forked from beevelop/gitprint.js
Last active October 24, 2018 08:55
Show Gist options
  • Save ashutosh2411/a97c815edafa4cfd5a25c67db389f43a to your computer and use it in GitHub Desktop.
Save ashutosh2411/a97c815edafa4cfd5a25c67db389f43a to your computer and use it in GitHub Desktop.
Print GitHub markdown files
document.querySelector('#readme').setAttribute('style', 'position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; background-color: white')
document.querySelector('body').appendChild(document.querySelector('#readme'))
window.print()
// For a zoomed in version, without the border, use the following code snippet.
(function () {
var $ = document.querySelector.bind(document);
$('#readme').setAttribute('style', 'position:absolute;top:0;left:0;right:0;bottom:0;z-index:100;background-color:white');
$('#readme>article').setAttribute('style', 'border: none');
$('body').innerHTML = $('#readme').outerHTML;
window.print();
})();
@ashutosh2411
Copy link
Author

This is for the absolute beginners, those wondering what to do with this piece of code?

@ashutosh2411
Copy link
Author

You can also remove border from .readme if you don't want in the print document.

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