'Prettifying' Code for Blog Posts

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: , , , ,

posted @ Wednesday, November 05, 2008 12:40 PM

Print

Comments on this entry:

# re: 'Prettifying' Code for Blog Posts

Left by Tim at 11/5/2008 10:41 PM
Gravatar
Hey,

try GeSHi (http://qbnz.com/highlighter/) and syntaxhighlighter (http://code.google.com/p/syntaxhighlighter/) they worked fine for me.

# re: 'Prettifying' Code for Blog Posts

Left by Thomas Williams at 11/6/2008 3:15 PM
Gravatar
Thanks for the tips Tim. I liked the first one better (GeSHi) as it has plenty of options...I didn't see an option for inline styles though, it seemed to generate separate CSS and "prettified" code (no good for me as I don't have complete control over my blog's CSS).
Comments have been closed on this topic.
«September»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789