I’ve tried a lot of tools and addons to use syntax highlighting on my weblog and BloggingAbout.NET in general. I’ve fallen in love with two of them.

The first I use to use for my weblog. But this causes a lot of markup within the code and it can never be changed later on. I still use CopySourceAsHtml for posting in PowerPoint, Word and other tools though. Simply because it’s really, really good and easy to use from within Visual Studio.

SyntaxHighlighter is a set of Javascript that gives your code its color after it’s being displayed, ie. when the page has loaded. The code itself is rendered within <pre> tags and has no specific markup in HTML for the coloring. This makes the highlighting a bit slower, but with the additional benefits that there’s no extensive markup in the code, that the coloring libraries can be updated. Additionally a popup window is displayed for easily copying the code and some other useful buttons.

For installation I’ll redirect you to the official site.

SyntaxHighlighter plugin for Windows Live Writer : PreCode
What makes my life especially easy as a blogger, is this plugin called "PreCode". The plugin fits nicely into Windows Live Writer and with a popup window, a paste and a fix indentation you have some new code layed out on your weblog. Could not be any easier.

This is the end result:

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            for (int i = 0; i < 10; i++)
                Console.WriteLine("Hello world");

You may also like...

6 Responses

  1. Clemens says:

    Always got problems with the colors, I just stopped using code 😉 [That’s true almost a year ago I posted some code samples… ]
    But, although you us a nice code coloring plugin, my feedreader [FeedDemon ] doesn’t use it, still plain text.

  2. Paula says:

    Thank for the tip on CopySourceAsHtml — that’s exactly what I was looking for!

  3. CodeKiwi says:

    Yeah, the formatting in Google reader is fine but it loses the color coding. Not sure what plugin he uses but Rick Strahl ( seems to have that problem sorted.

  4. Actually, Visual Studio places code into clipboard in RTF format too, not just plain text, and it always has styling info. I’ve made a Live Writer plugin which parses such RTF content and outputs nice clean HTML that fits my needs. Anyone would love to see code snippets formatted as in Visual Studio in their blogs, right?

    Source code is not yet published but I’ll do it soon.

  5. Dennis van der Stelt says:

    @Clemens & @CodeKiwi : It’s because in the HTML there’s no markup. If you want to see color coding, visit the blog, not the reader! 🙂

    Maybe I should use a signature, that if you want to see color, come to the site 😉

  6. This is understandable that cash makes people free. But how to act when somebody doesn’t have cash? The only one way is to receive the loan or commercial loan.

Leave a Reply

Your email address will not be published. Required fields are marked *