Adding automatic code highlighting to your blog

Update: PrismJS is a much better option now

One of the things I really liked about wp-svbtle is that it would automatically highlight any code samples I added. When I changed to Sparkling, the highlighting stopped.

Thankfully, it was an easy fix. To re-enable it, I added the following to my footer.php file in the theme:

jQuery("pre code").addClass("prettyprint");
<script src="">

This enables all code blocks to be pretty printed, then includes Google’s pretty printer library. As you can see, it works like a dream.

March 25, 2015

How To