Skip to content

Instantly share code, notes, and snippets.

@vojtech-dobes
Created January 22, 2015 10:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vojtech-dobes/8d8323af058adc31be3a to your computer and use it in GitHub Desktop.
Save vojtech-dobes/8d8323af058adc31be3a to your computer and use it in GitHub Desktop.
Make <pre> readable
[].slice.call(document.querySelectorAll('pre'), 0).forEach(function (el) {
el.innerHTML = el.innerHTML.split("\n").join('<br>');
});
var style = document.createElement("style");
style.appendChild(document.createTextNode(""));
document.head.appendChild(style);
style.sheet.insertRule("pre { white-space: normal }", 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment