Windows Live Writer Plugin: Wrap code in
July 19, 2009 by Daniel HoelblingAs of late I try to mark code parts inside normal text with the tags to make them stand out as code. While writing my MonoRail tutorial yesterday I got really annoyed by switching between source and normal view inside Windows Live writer to add all over the place, so I figured I’d use the WLW Plugin API to write a plugin that wraps text inside .
namespace wlwWrapIn
{
using System;
using System.Windows.Forms;
using WindowsLive.Writer.Api;
[WriterPlugin("37CB2E7F-1809-4344-9527-526768A99E9F", "WrapInTT", PublisherUrl = "http://www.tigraine.at")]
[InsertableContentSource("Wrap in <tt>", MenuText = "Wrap in <tt>", SidebarText = "Wrap in <tt>")]
public class WlwWrapIn : ContentSource
{
public override System.Windows.Forms.DialogResult CreateContent(System.Windows.Forms.IWin32Window dialogOwner, ref string content)
{
content = String.Format("<tt>{0}</tt>", content);
return DialogResult.OK;
}
}
}
Oh yeah it is that simple, just reference the WindowsLive.Writer.Api class and you can write a plugin like that.
In case someone needs my wrapping plugin, you can get it here: WrapInTT.dll