Sunday, July 06, 2008

Switching to LiveWriter

Up to this point, I've crafted the HTML markup for my posts this year using Notepad++.  While working with a local editor is far superior to using Blogger's editor window, I've found stylizing elements and adding hyperlinks to be somewhat time consuming, not to mention difficult to read/review/write content with all the HTML markup in the way.   Despite having better control over the markup, the largest problem with this approach is you really can't see what your post will look like until you publish, and even then, I usually follow a nervous publish/review/tweak/publish dance number to sort out all the display issues.

Recently, I downloaded LiveWriter and w.bloggar to test drive alternatives.  (Actually, I was interested in w.blogger's ability to edit Blogger Templates -- but it turns out that they don't work on blogger's new layout templates.  Drat.)   So far, I'm pleasantly surprised with LiveWriter.

Although I'm pretty excited that the tool is written in .NET with support for managed addins, I am most impressed with the feature that can simulate a live preview of your post.  LiveWriter is able to pull this off by creating a temporary post against your blog and analyzing it to extract your CSS and HTML Layout.  You can toggle between editing (F11), preview (F12) and HTML (Shift + F11) really easily.


The biggest snag I've encountered thus far is that the HTML markup produced by LiveWriter is cleaned up with lots of extra line-feeds for readability.  While this makes reading the HTML a simple pleasure, it wreaks havoc with my current Blogger settings.

Blogger's default setting converts carriage-returns into <br /> tags.  So all the extra line breaks inserted by LiveWriter are transformed into ugly whitespace in your posts.  This feature is configurable within Blogger: Posts -> Formatting -> Convert line breaks.

Settings - Formatting - Convert Line Breaks

Unfortunately for me, this is a breaking change for most of my posts (dating back to 2004).  To fix, I have to add the appropriate <p></p> tags around my content -- fortunately, LiveWriter will automatically correct markup for paragraphs that I touch with additional whitespace.  So while the good news is my posts will have proper markup in the editor, the bad news is I have to manually edit each one.


David Tchepak said...

Ugh, I feel your pain. I turned off the Convert Line Breaks setting after about 50 posts.

You could write some code to do it (here's a linq-to-xml example of processing blogger posts), but for me it was quicker/more reliable to just manually flick through them.

David Tchepak said...

Just wanted to add, if you do try to automate a change to the line breaks, Blogger In Draft now has import and export. So you could back up your blog, edit the exported file, kill the olds posts and re-import the old ones.

...if you are very brave :)

bryan said...

The programmer in me had thought of doing exactly that -- and by the way, linq to xml is a nice touch. As you pointed out, performing in bulk is a bit risky. The manual effort to verify that the posts are okay probably isn't much more than touching them by hand when you factor in the development time.

As much as it sucks, it's also a great opportunity to fix typos and insert embedded video players for old posts that previously had hyperlinks.

I'll definitely check out the import/export feature. I'm interested to see if the exported content can be re-edited within LiveWriter.