Code Formatter for Windows Live Writer

A plugin for Windows Live Writer that formats code!

Updated 31st July 2010:  Version 2.5 now available.

Check it out at here.


Updated 15th May 2009:  Version now available.

 Download it here, or read on...

This plug-in formats and highlights code and also does the following:

  • Fixed in - Some users reported that the plugin tried to load configuration from the wrong place.  This has now been fixed - thanks to Jason Bunting for the feedback and apologies to everyone who experienced this problem
  • The ability to format the code 'live'
  • The ability to wrap lines
  • The ability to change the background color
  • The ability to just quickly paste what's in the clipboard as code
  • The ability to change the font, including the font name, size, weight, and style.
  • Dozens of languages, including PowerShell, MSIL, Pascal and XAML
  • NEW: The ability to use different formatting engines - in this release, ActiPro (Insert formatted code), and SyntaxHighlighter (Insert highlighted code)
  • NEW: The ability to output either formatted text (html) or images
  • NEW: Now works with the latest version of Windows Live Writer
  • NEW: The code editor now uses the superb ActiPro code editor.  ActiPro very kindly donated the license.

As well as new stuff, there's also er, different stuff

  • Different: Line numbering has gone when using ActiPro output (it's there when using Syntax Highlighter output though)
  • Different: Word wrap is gone.  Same as above - only gone in ActiPro, still there with Syntax Highlighter)
  • Different: In previous versions, there was an option to quick paste code from the clipboard.  This is still there - just hold down shift when clicking Insert Formmated Code

This plugin adds three options in WLW's tool window:

 Code as bitmap

This uses the ActiPro formatting engine to take a snapshot of the code. 

You'll see this screen when clicked:

 This srceen allows you to set the size of the editor window.  You can either select common widths from the drop-down or put in your own width - for instance, 465 is the ideal width for my template on Blogger.  The buttons on the bottom right allow you to then:

a) insert the image straight into the blog post or b) have the plugin copy the image or c) discard it. 

The advantage of the first option is that the code is still editable in WLW; the disadvantage - you cannot [yet] apply bitmap effects, such as reflection or drop shadow.   

The advantage of the latter option is that you can apply bitmap effects, but the disadvantage is that code will no longer be editable.

Formatted code

This also uses uses the ActiPro formatting engine.

When inserting code, the plugin window will allow various properties of the code to be changed:

When clicking edit code, you'll see the new Edit Code screen:


 Highlighted code

 This uses the Syntax Highlighter formatting engine.  Support in this release is quite limited, although you can tweek the output by switching to the HTML pane in WLW.

 To see examples of the output, please see this blog post.

 Version can be downloaded here. This version now works with the latest version of Windows Live Writer.

To use it, extract the binaries to Program Files\Windows Live\Writer\Plugins and run WLW.  If you're using a version of WLW prior to Beta 3, then change the directory to \Program Files\Windows Live Writer\Plugins (but preferably, download the released version!)

Planned for the next release is:

  • Bitmap effects for when outputting code as an image
  • Getting line numbers and word wrapping back in ActiPro generated output

Thanks again to all those that left feedback.   Please keep it coming.