Last active
December 22, 2015 21:19
-
-
Save decklord/6532814 to your computer and use it in GitHub Desktop.
Code snippet for syntax highlight in Tumblr
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
<!-- Base For Syntax Highlight --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> | |
<script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js" type="text/javascript"></script> | |
<link rel="stylesheet" type="text/css" href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css"></link> | |
<!-- Loads a nice template for syntax highlight --> | |
<!-- Get more templates on: http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html --> | |
<link rel="stylesheet" type="text/css" href="https://google-code-prettify.googlecode.com/svn/trunk/styles/sons-of-obsidian.css"></link> | |
<script type="text/javascript"> | |
function styleCode() { | |
if (typeof disableStyleCode != 'undefined') { return; } | |
var a = false; | |
$('pre').each(function() { | |
if (!$(this).hasClass('prettyprint')) { | |
$(this).addClass('prettyprint'); | |
/*$(this).addClass('prettyprint linenums'); to show line numbers*/ | |
a = true; | |
} | |
}); | |
if (a) { prettyPrint(); } | |
} | |
$(function() {styleCode();}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment