Although it's easy enough to paste code samples into a PRE tag in a blog post, I reckon it's worth using one of the many tools available for formatting or "prettifying" code so the code is more readable - as long as it's not too much effort.
My number one criteria for any tool that "prettifies" code to HTML for posting to a blog is that the tool is free. Secondly, that it's easy to use - I can do without hundreds of options. As for the output HTML, my current preference is for inline styles as it makes posting code snippets easier and more self-contained (also I don't have total control over my blog's CSS files). I'm permanently connected to the internet so I don't mind using something online versus a desktop download.
My last condition for a tool to format code as HTML - a condition which may set me apart from everyone else on the planet - is that I pretty much just need my code colored as it's already formatted, indented and capitalised to my liking.
So far I've looked at BrettB's SQL color coder, QuickHighlighter, Instant SQL Formatter and the Visual Studio add-in CopySourceAsHtml.
All the tools I've mentioned are excellent in their own way. CopySourceAsHtml is perfect for code from Visual Studio as it integrates into the context menu. I'm undecided between the others for SQL code - I think I prefer QuickHighlighter, but I'll try all three and see which one works better.
Here's some sample output from SSMS (1) which is the "baseline", QuickHighlighter (2) - which has very few options, but just works - and BrettB's SQL color coder (3):

Does anyone have any other suggestions for "prettifying" code for blog posts?
Tags: format, color, blog, prettify, code
posted @ Wednesday, November 05, 2008 12:40 PM