Operates on <code> tags in arbitrary documents. Only tested in Firefox. Compiled with John Gruber's thing. Uses google-code-prettify.
Greasemonkey version by masterfuol here.
Click here: Prettify!
var d = document;
var PR_keywords = false;
var loc = "http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.";
var h = d.documentElement.getElementsByTagName("head")[0];
// Add the class flag to all code elements
var g = d.getElementsByTagName("code");
for(var i = 0; i < g.length; i++) {
g[i].className = "prettyprint";
}
// Add the library JS to the header
var c = d.createElement("link");
var s = d.createElement("script");
s.setAttribute("type", "text/javascript");
c.setAttribute("type", "text/css");
c.setAttribute("rel", "stylesheet");
s.src = loc + "js";
c.href = loc + "css";
h.appendChild(c);
h.appendChild(s);
// Set up a loop to initialize the library JS as soon as it's loaded.
(function() {
if (PR_keywords) {
prettyPrint();
} else {
window.setTimeout(arguments.callee, 250);
}
})();