Blog tip: Windows Live Writer with source code formatting plugin
EDIT: This is no longer an issue since I moved to WordPress. The original post can be found here, and the source code below is formatted using the built-in code formatter in WordPress.
I am blogging about software development. Invariably, my posts will contain some kind of source code examples, be it XML, XAML, C#, VB, SQL or whatever. My two first posts here included a lot of <span style=”margin-left: 15px”> or <pre> or the likes. Not too productive…
As I had a feeling that I wasn’t the only nerd on BlogSpot, I had a feeling this problem would already be solved, so I turned to my all-knowing friend, Google. And sure enough, she knew. I found Steve Dunn’s plugin for Live Writer that does just that.
So on I went and installed both Microsoft Live Writer and Steve’s plugin, and this is the first post using these tools for publising. Here is a couple of sample source codes:
C#:
[TestMethod]
public void TestThatEqualPromoInfoObjectsReturnEqualsIsTrue()
{
PromoInfo info1 = new PromoInfo();
info1.PendingAccountID = 1;
info1.PromoID = 1;
PromoInfo info2 = new PromoInfo();
info2.PendingAccountID = 1;
info2.PromoID = 1;
Assert.AreEqual(info1, info2);
}
XML:
<compilation debug="true"> <assemblies> <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> </compilation>
Not too shabby…


