Windows Live Writer

Syntax highlighting in WordPress using Windows Live Writer

We always strive to make our code as readable as possible in our posts.  I’ve been searching for the perfect source code plug-in since I started blogging.  I finally found the style I like to present my code.  It looks like this:

        public void Foo()
            Console.WriteLine("Where's my code plug-in?");

You’ve probably seen this style many times before.  Until today I had no clue how I can present my code similar to this.  It just took a little bit of googling to find out that WordPress allows us to format our code like shown above.

Here’s the syntax we need to use:

[sourcecode language=’csharp’]

your code here


However, it doesn’t solves my problem completely.  I usually create my posts using Windows Live Writer (WLW) and if you try to type the code as above it is not going to look pretty.

So far I found this solution:

1. When pasting code into WLW change to Source view (Shift-F11).

2. Type following:

<pre>[sourcecode language=’csharp’]

— You code goes here.


3. Switch back to Edit view (F11).

Don’t be alarm that your code doesn’t look as expected in Windows Live Writer.  It’s going to look right in your WordPress blog.

kick it on


6 thoughts on “Syntax highlighting in WordPress using Windows Live Writer

  1. You can avoid switching between “Edit” and “Source” and eliminate the “pre” tags using the PreCode plugin for WLW ( I used it with the folowing setings:
    – Surround With: PRE
    – Highlighter Class: None
    – All others checkbox: false
    …and the code, between [language] attribute.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s