‹ Jack's Brain

Remove GitHub Diff Markers

Aug 10, 2015

If you’ve ever needed to copy chunks of code from GitHub but hate having to deal with removing the pluses and minuses in the diff view, I just wrote bookmarklet for you – it removes them with a couple lines of JavaScript.

Check out the gist, or just drag this link into your bookmarks bar: [No Diff Markers][2].

Click to enlarge image

[2]: javascript:(function(){for(var elements=document.getElementsByClassName(“blob-code-inner”),i=0;i<elements.length;i++)(elements[i].parentNode.classList.contains(“blob-code-addition”)||elements[i].parentNode.classList.contains(“blob-code-deletion”))&&(elements[i].innerHTML=elements[i].innerHTML.substring(1));})();