Windows Live Writer

Live Writer syntax highlighting plug-in for WordPress.

About a year ago I wrote a small article how to use syntax highlighting in WordPress using Windows Live Writer.  Few months ago I discovered  Rich Hewlett’s plug-in for Windows Live Writer that works perfectly with WordPress blogs.  I’ve been using it since.

I’m very happy with this plug-in it works great, but it misses the WYSIWYG.  It would be nice to see the code exactly like it appears on the published page during creation of the post.  Also for XML you cannot see code at all.  But it looks great on the published page.

<note>
  <to>Rich</to>
  <from>Vadim</from>
  <subject>Thanks</subject>
  <body>Rich, Thanks for the great plug-in.</body>
</note>

Rich also recently published a new version of his plug-in.  You can download it directly from this link.

I believe that you must have this plug-in if you host your blog on wordpress and publish snippets of code.

Advertisements
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

[/sourcecode]

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.

[/sourcecode]</pre>

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 DotNetKicks.com