jump to navigation

Tweaking the CodeFormatter plugin for Windows Live Writer February 13, 2007

Posted by Karl Hulme in .Net, Windows Live Writer.
trackback

This blog is no longer actively maintained. The content is well over 5 years old – which is like 50 coder years. Use at your own risk!

I downloaded the binaries of the CodeFormatter plugin for Windows Live Writer (the blogging tool) from Steve Dunn’s blog.  He’s provided the plugin in binary form so you can just extract the contents to your \Windows Live Writer\Plugins directory.

One small problem with it though, is that the code it produces is enormous.  I’m not talking about code bloat, i mean physically on the screen it’s huge.  To make matters worse it doesn’t scroll, which means you can end up losing half of the code.  Luckily the source is also available. 

Using the source you can easily edit the HTML that’s produced.  For some strange reason I can’t get it to pick up the font-family correct in the end result, but it looks ok in the editor so i think that’s something to do with the template i’m using on word press.

sb.Append(@"<div style=""width: 430px; max-height: 500px; overflow: scroll; font-family: 'Courier New', monospace; font-size: 7pt;""><pre style="""); if ( this.BackgroundColor != Color.Empty ) sb.AppendFormat( @"background-color:{0};", ColorTranslator.ToHtml( this.BackgroundColor) ); if ( this.WordWrap ) sb.Append( @"white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;" ); sb.AppendFormat( @""">{0}</pre></div>", s );

If you don’t have time to edit the files yourself then you can grab the binaries that I rebuilt.  If anyone has a problem with me reposting here then let me know and i’ll take them down.

There’s more plugins on the codeplex site here, which includes a PasteAsHtml plugin by Bryant Likes.  It installed easy enough but I didn’t have much luck with it.

Comments»

1. Simon Middlemiss - February 13, 2007

Didn’t you notice the ‘Font’ button in the control panel??

2. Steve Dunn - March 13, 2009

Hi,
I’ve just updated my Code Formatter Plugin. Version 2.0.0.1 now supports the ActiPro Syntax Highlighter output and also the popular JavaScript SyntaxHighlighter output.
http://stevedunns.googlepages.com/codeformatterforwindowslivewriter


Leave a comment