Pages

Friday, March 29, 2013

Code Snippets

Presently, I am using Google's Code-Prettify to include code snippets in my posts.  Getting this up and running was fairly painless.

1.  Navigate to Design>Template>Edit Html.
2.  After the <head> tag insert <script defer="defer" src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?autoload=true&lang=tex&skin=sons-of-obsidian"> </script>. 3. Within the <body> insert onload='prettyPrint()'. The tag should now look similar to: <body expr:class='"loading" + data:blog.mobileClass' onload='prettyPrint()'>
4.  Consult the Google pages linked to above to see how to employ code-prettify.

One must be careful to encode the snippet so that it is HTML ready.