Corey Coogan

Python, .Net, C#, ASP.NET MVC, Architecture and Design

  • Subscribe

  • Archives

  • Blog Stats

    • 112,314 hits
  • Meta

Posts Tagged ‘WordPress’

Blogging with MS Live Writer

Posted by coreycoogan on November 9, 2009


A while ago, Microsoft released some pretty cool tools under the “Live” brand.  There are some pretty cool tools under this label that allow you to work with email/calendar, images and video and synch them to multiple services throughout the web.  The tool I’m blogging about now is Live Writer. I’m writing this post right now using Live Writer and am really enjoying the interface, which is much more fluid than the editor that comes from the browser.

According to the website:

“Writer makes it easy to share your photos and videos on almost any blog service—Windows Live, WordPress, Blogger, LiveJournal, TypePad, and many more.”

Live Writer is a desktop application that supports writing blogs with images, video and more.  I’m using WordPress (WP), which is a pretty awesome platform, and the integration is seamless and the Preview feature gives me a pretty good idea of what it will look like when published.  There’s even the ability to save your drafts to the blog server so you can edit it later from a different location.  In addition, there is a nice Plugin model where you can get and develop plugins to do all sorts of things.

Syntax Highlighting

Since this is a technical blog, the ability to copy/paste code snippets into my blog is very important. WP gives me a special tag for this (sourcecode lang=’csharp’).  When this tag is found, WP will automatically format my code using the SyntaxHighlighter found on Google Code.  I really like this highlighter’s ability to show line numbers, copy/paste functionality and the ability to view the source.  Unfortunately, I haven’t found any plugins that work equally as well for LiveWriter.

I did a little digging and found a simple method to allow me to get my desired syntax highlighting.  First, I found this answer on Superuser.com that shows how to stop LiveWriter from formatting special characters.  Next, I used this technique, in which you simple wrap your “sourcecode” tag in a <pre> and then all is well.  It’s a little bit of a hassle, but I think the trade off is worth it.  It wouldn’t take much to develop a plugin to do this, and there’s examples on the web for how to write one, but I’m content for now to just add the <pre> tag.

//sample code to show syntax highlighting
public void BlogThis(string blogPost)
{
	WordPress.PostBlog(blogPost);
	this.Observers.Notify(blogPost);
}

Posted in Blogging, Uncategorized | Tagged: , , | Comments Off on Blogging with MS Live Writer