WordPress makes blogging super easy, but there was one aspect of this whole thing I underestimated: Posting source code to a blog. Here’s a quick note on two things I learned about last week: Windows Live Writer 2012, and the Source Code Shortcodes in WordPress.

Windows Live Writer 2012

Shout out to Scott Hanselman, whose post, Download Windows Live Writer 2012, made me realize that Live Writer is much more useful than it looks.

Live Writer can download the theme of your blog so that you can preview how your post looks before it’s thrown up onto the web.  It integrates with WordPress as well as a bunch of other blog services, so all I had to was plug in my blog address and login info.

The best time-saver I’ve seen though? Easy image uploading.

I’m writing on Windows 8.1, so if I want to take a screenshot of something and add it to a blog post, I can use the Snipping Tool to capture part or all of a window, copy it to the clipboard and paste it right in. Live Writer lets you re-size the image however you want, which is nice since I can preview the post with the image right in there.

Once a post is published from Live Writer to WordPress, the images are uploaded automatically with it, so I don’t need to separately upload images to the media section on WordPress.

Thankfully I can publish the post as a draft first, so I can check out a preview before making it public.

How To Get Windows Live Writer 2012

The whole reason for Hanselman’s 2013 post is that it’s pretty hard to find Live Writer 2012 if you don’t know where to look; googling “Live Writer 2012” does not show the download page of the current version.

As Scott points out, it’s part of the Windows Essentials suite, along with a bunch of other stuff you probably don’t use, with a OneDrive installer thrown in for good measure. Download Windows Essentials, and choose just Live Writer to install.

Screenshots are One Thing. Source Code, Though…

I read an article the other night by Jon Galloway, 8 Windows Live Writer tips. Two things struck out at me:

… the other killer feature of WLW is plugins. I just use two (Flickr4Writer and PreCode Snippet), but it’s of course up to you – what you’re posting and how the editor can better support it.

What? There are plugins for Live Writer? And there are plugins to help in posting source code? Nice. Couldn’t I just copy-and-paste with <pre> though? Or take a screenshot?

I like PreCode because it cleanly formats source code in <pre> tags with support for a lot of code formatting JavaScript systems. (note: if you’re inserting screenshots of code into posts, stop doing that)

…Oops. Okay, so no screenshots of code. That makes sense, actually; I’ve seen code on a blog and wanted to copy-and-paste it myself.

Source Code Shortcodes on WordPress

The PreCode Snippet for Live Writer was clunky and I couldn’t get it to work correctly, possibly because it’s pretty old. The newest version for download seemed like a pain just to get into Live Writer, and then I figured I had to get into WordPress somehow.

Turns out, the WordPress team integrated that functionality already, in the form of source code shortcodes. Now for me to post code, all I need to do is surround the code in a

 

shortcode:

public void CSharpMethod() { } 

Part of this journey to code involves learning how to write about code, and I’m sure this won’t be the last surprise I get.