21 Jul 2010

Code Syntax Highlighter for Code Snippets

After my last blog post (and the first to contain a decent code snippet!), I wasn’t too happy with the way that the code snippet was rendered in the RSS feed:

I am currently using the Insert Code for Windows Live Writer plug-in, which has a decent rating and reasonable reviews.  I decided to check out the other possible code syntax highlighters.

As always, Scott Hanselman has already posted on this topic, and he came out in favour of Syntax Highlighter, a JavaScript library.  It looks great (see here), but there are a number of other options. These include:

  1. BlogTrot Code Window – An online tool to generate HTML for your code snippet.
  2. NeatHighlighter - Similar to BlogTrot.
  3. Google Code Prettify – A JavaScript library that does a similar job to the Syntax Highlighter.  There is a Code Prettify for Windows Live Writer plugin that can be used to automatically surround your code snippets with <pre> tags for use with the Prettify library.  Unfortunately, Google does not host the Prettify library, which would have been a major plus for me
  4. Source Code Formatter – Another code syntax highlighter for Live Writer, similar to the plug-in I am already using.

I have a number of code based posts that will appear over the next few weeks, so I will try out each of the above methods in a separate post, and post again on this topic to give you some feedback and my preferred method of displaying code snippets.  If you have any other methods of code highlighting that you would like me to consider, please get in touch.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.