Tuesday, July 9, 2013

SyntaxHighlighter in blogger

I can't believe that I wrote a dev blog for a year without using a tool to highlight Syntax.

I added SyntaxHighlighter (http://alexgorbatchev.com/SyntaxHighlighter/) today and am delighted with the result. Followed the tutorial on http://oneqonea.blogspot.com/2012/04/how-do-i-add-syntax-highlighting-to-my.html

You basically have to add the following to the in the blog template.








We can keep only the brushes we need (.js includes) and remove the rest.

There are several themes as mentioned in http://alexgorbatchev.com/SyntaxHighlighter/manual/themes/ and I'm using the eclipse theme.

When creating blog posts surround the code snippets with following tags. Pick the right brush depending on the programming language used.

<pre class="brush:java;"
Code Snippet
</pre>


No comments:

Post a Comment