Skip to content

Instantly share code, notes, and snippets.

@jclement
Created July 18, 2012 20:08
Show Gist options
  • Save jclement/3138548 to your computer and use it in GitHub Desktop.
Save jclement/3138548 to your computer and use it in GitHub Desktop.
Javascript function to decorate all pre/code blocks with "prettyPrint" for Google's code highlighting
function styleCode()
{
if (typeof disableStyleCode != "undefined")
{
return;
}
var a = false;
$("pre code").parent().each(function()
{
if (!$(this).hasClass("prettyprint"))
{
$(this).addClass("prettyprint");
a = true
}
});
if (a) { prettyPrint() }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment