Paste from Visual Studio for Live Writer
I've tried one or two code-formatting plugins for Windows Live Writer, but this one from Doug Stockwell is the best so far. Instead of trying to syntax-highlight the code you're pasting using its own highlighter, it just pastes the RTF contents of the clipboard directly into Writer. That means that whatever colour scheme you're using in Visual Studio is preserved in your blog post. To whit:
static class ServiceFactory { // creates a new instance of the given web service reference, // replacing its host name and url path with values from the // user's settings public static T New<T>() where T : HttpWebClientProtocol, new() { string server = Properties.Settings.Default.AppServer; string path = Properties.Settings.Default.AppPath; T service = new T(); service.Timeout = 30000; if (!string.IsNullOrEmpty(server)) { service.Url = Regex.Replace(service.Url, @"http://(?:[^/]*)/(?:[^/]*)/(.*)", @"http://" + server + "/" + path + "/$1"); } return service; } }
Nice, huh? It even wraps it in a <pre> tag with a class of "code" so you can add some CSS styling if you like. Now all I need is some code worth posting.
Update! Oops! It looks like Community Server is playing silly-buggers with the inline style that the plugin uses to colourise the code! Damn!
Update 2! Ok, editing the post from within Community Server fixed it. Weird. I wonder if it's a metablogapi thing?

# Trackback from TrackBack on 12/10/2006 2:40 PM
Comments
# jsg
5/02/2008 9:29 AM
I tried this plugin and the lastest version has a "feature" of including hidden links in your code back to their web site.
# mabster
5/02/2008 10:37 AM
Hey, you're right! That's odd.
It's an empty link so it's not clickable by a user. Perhaps Douglas is using it to see how often it's getting used (by looking at incoming links on technorati or google).