Sunday, December 13, 2009

Blogging with Code Snippets using Windows Live Writer

Microsoft recently released a tool called Windows Live Writer.  While many bloggers pretty much need only images and text, technical posts often require inserting samples of source code.  Quite frankly, I personally hate reading posts that have source code displayed as images because I want to copy and paste it so that I can try out whatever I’m reading about.  

Windows Live Writer allows plug-ins to be installed to enhance your blog.  I came across one that enables you to paste source code snippets from Visual Studio into your blog.  You can download the “Paste From Visual Studio” plug-in at http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&bt=9&pl=8

Here is an example of some source code pasted from Visual Studio using Windows Live Writer and the “Paste From Visual Studio” plug-in.

private void RegisterRoutes(RouteCollection routes)
{
routes.Add(new Route
(
"home",
new WebFormRouteHandler("~/Default.aspx")
));
}

As you can see the syntax color is maintained as well as indentations.  The only issue I’ve seen with it as that pasting ASP.NET markup seems to not function but to me this is still a huge time saver.  Enjoy!

No comments:

Post a Comment