Before blogging about code....

The first thing that we need before blogging in a tech blog, is a way to display well-formatted code, and that means with all the syntax highlighting that our more beloved editors do. You can’t deny, after all, that reading code without colors, is not the same. So I checked a bit online and I managed to show code like this:


var total = (from u in ctx.Blogs
                     where u.Name.Contains("Blogger")
                     select u).Count();
        if (total > 1) return "I though blogger was the only one";


The best thing about this tool is that supports “brushes” to render a lot of languages, so we can have pieces of code in html, c#, c++, python or whatever we want, the setup is quite easy. I found many entries on internet but finally when to they integration page to really see it working.

So it seems we are ready to start blogging with source code!

Comments

Hi!

You are right . Syntax highlighting for code snippets is the key to success ;). I've tried the script you mention and it's cool (although it doesn't highlight LinQ expressions ... ?)

By the way in my blog I use built-in Trac syntax highlighting . Anyways I like your blog. Keep posting good stuff .
Secondly, please take a look at this message I got right now ... :-/


paneque.blogspot.com

SyntaxHighlighter

Can't find brush for: c-sharp


Things like this may be a PITA for some users :-/
I will have to try a new highlighting tool, they should have one included here... :(

Popular posts from this blog

Get-ChildItem vs Dir in PowerShell

The case for a 4 week sprint

NODE.js fs.readFile and the BOM marker