17
Aug
2006
Source Code Formatter for Windows Live Writer
Last night I decided to see if I couldn't integrate my source code formatting into Windows Live Writer using their SDK (which is really nothing more than a help file). It turns out that it is ridiculously easy to create simple plugins for this thing, and was able to create a functioning plugin in about an hour.
Since I've had a couple of people ask how I format source code for my blog, I'm going to go ahead and make it available for download. It's built for Framework 2.0, so you'll need to have that installed ahead of time. A CSS stylesheet containing the styles that I use is also included. Thanks to manoli.net for the actual source formatting code.
To use, just copy the assembly into Live Writer's plugins folder and start up the application. The new option will appear under the "Insert" menu. You will get the following dialog:
Paste/type in your code, select a language, choose line numbers and/or alternating line styles, and click OK. The resulting HTML will be dropped into your post. Just don't forget to splice the CSS into your blog's stylesheets, as the formatter does not embed the styles into the HTML tags.
Consider this unsupported. I cannot guarantee that it will not detonate your computer. Then again, I'm pretty sure it won't.