SyntaxHighlighting with Tumblr
Tumblr isn’t really made for showing of code, and I don’t want to use GitHub’s gists to embed code in my blog-posts. So here is how you can add nice code-snippets in Tumblr.
Add this to your <head> section (must be changed depending on what languages you intend to use):
<script type="text/javascript" src="http://shjs.sourceforge.net/sh_main.min.js"></script> <script type="text/javascript" src="http://shjs.sourceforge.net/lang/sh_css.js"></script> <script type="text/javascript" src="http://shjs.sourceforge.net/lang/sh_html.min.js"></script> <script type="text/javascript" src="http://shjs.sourceforge.net/lang/sh_sh.min.js"></script> <script type="text/javascript" src="http://shjs.sourceforge.net/lang/sh_ruby.min.js"></script>
Set the onload of your <body>:
<body onload="sh_highlightDocument();">
Add code with <pre class="sh_..."> (caveat: you have to escape < and & manually with < and & respectively):
<pre class="sh_html"> <body onload="sh_highlightDocument();"> </pre>