Bookmarklet to create a printable version of a Markdown file on GitHub. Create a bookmark in your toolbar with this code as the URL, then click the bookmark while viewing a Markdown document (like a README) on GitHub to strip away the rest of the page for a clean, printable version. Or, if what I just said sounded scary, visit this page: http://…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){ document.body.innerHTML = document.getElementById("readme").getElementsByTagName("article")[0].outerHTML; })(); |
It's working fine and very handy sometime.
I just changed as per my need ( to trigger the print )
javascript:(function(){
let readMe = document.getElementById("readme")?.getElementsByTagName("article")[0]?.outerHTML;
if(!readMe) return false;
document.body.innerHTML = readMe;window.print();
})();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It says
undefined
for me.. however, im running on an super old firefox OSX version:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28.