.Net, Windows Live Writer

WLW Plugin for WordPress.com – New Version

Almost immediately after I published the WLW WordPress.com Syntax Highlighter to CodePlex a little voice inside my head was telling me that I can do better than that. Luckily for me, that voice was right.

You can find it here: WLW WordPress.com Syntax Highlighter Plugin

The problem with the initial version of the plugin was the fact that I could not get around the "auto-encoding" feature from WLW. This basically meant that any time you wanted to have quotes or angle brackets in your code it would get encoded. Worse still was you had to go to the "Source" tab, correct the encoded characters and then remember to not go back to the "Edit" tab. Sounds like a great plugin to me…

To resolve this issue I switched from using the ContentSource base class to using the SmartContentSource base class. This base class provides you with the ability to have two sets of content: the "Editor" version and the "Publish" version. The "Editor" version is obviously what you see within WLW while the "Publish" version is what is sent to your blog.

Two methods… how simple is that?

Well… when you start off using the ContentSource and WPF… not so simple. The SmartContentSource has what is called an "Editor" which appears in the right pane of WLW when the content is selected. This "Editor" must inherit from SmartContentEditor which in turn inherits from Windows.Forms.UserControl.

Rather than attempting to fight that battle I found it was simpler to just pull out the WPF stuff and go directly with a Forms version.

Funny how the original intent was to show how to create a plugin for WLW using WPF only to rip it out. Live and learn… I guess.

Advertisements
Standard

2 thoughts on “WLW Plugin for WordPress.com – New Version

  1. Pingback: Testing WLW Plugin for WordPress.com « Mattias Fagerlund's Coding Blog

  2. Great plug-in. I tried using Insert Code for WLW from the Gallery but that was horrible especially on WordPress. You eased my pain.

    This is wonderful and works like a charm. I don’t even need to first check the draft and then publish.

    Thanks a zillion.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s