MarsEdit IRC Channel

March 12th, 2007

This is an experiment and we’ll see whether it takes, but if you want to chat about MarsEdit with myself and other passionate users, join us on irc.freenode.net in the ##marsedit channel (note it’s important to use the TWO ## as the beginning of the group name).

Blogging From TextMate

March 12th, 2007

In case you’ve been asleep for the past two years, you should know that many, many people are excited about TextMate, or as I like to call it, “emacs 2.0” (joke slightly spoiled by the fact that emacs is currently at version 21.x).

People who love TextMate tend to want to do as much of their text editing as possible in that editor. This means blog-editing, too. I know of at least three approaches that people are using to achieve this, each involving varying levels of UI polish and blogging-system support.

MarsEdit And TextMate

The first technique is to simply use MarsEdit’s “Edit With External Editor” command. This allows you to start a new post in MarsEdit, press Cmd-J, and be off and editing in TextMate. Just set TextMate as your external editor in MarsEdit’s preferences.

This trick also works well with in other editors such as BBEdit, where people also tend towards residing permanently.

The SteamSHIFT blog recently wrote about this technique, also describing a bundle which can be installed to allow “external editing” from any Cocoa application to TextMate.

BlogMate

The next approach is BlogMate, a brand new TextMate plugin from Todd Ditchendorf. It’s a step down from MarsEdit in terms of UI bells and whistles, but has the advantage of being free and working directly inside TextMate.

BlogMate uses TextMate’s plugin architecture to allow a custom UI panel to appear while editing a blog post in TextMate. From it you can choose the post to edit, set categories, etc.

It’s worth noting that BlogMate only supports the MetaWeblog API, so it won’t work with all blogs. Oh, and as Todd points out, it’s vaporware (meaning it’s not available to the public yet). But it will be interesting to watch it evolve.

TextMate Blogging Bundle

Lowest on the list in terms of user interface is the TextMate Blogging Bundle, written by Brad Choate. This is the answer for anybody who would just as soon configure most of their blog settings with text, and only see a minimum of UI feedback (most of the feedback is by way of “Help Tag” style floating windows).

The Blogging Bundle appears to be standard issue with the latest versions of TextMate. So the good news is if you’re a TextMate fan, you’ve probably already got this installed and at your command. Just check it out from the Bundles menu.

This solution also, for the time being anyway, only supports the MetaWeblog API.

Which To Choose?

Whichever makes you happiest, of course. A number of factors may play into your decision. Price, convenience, and blog API support among them. I’d like MarsEdit to be irresistible to you, but if you’ll be happier with another solution, that’s where I want you to go!

Really Simple Discovery

March 12th, 2007

As I mentioned in my last post, Really Simple Discovery is a mechanism by which blog editors (such as MarsEdit) can programmatically obtain information about the publishing APIs a particular blog supports.

Most of the “big blogs” support this feature, albeit to varying degrees of usefulness. Take a look at the source code to this page, if you’re reading it on the web. You’ll see near the top of the page a line like this:

<link rel=”EditURI” type=”application/rsd+xml” title=”RSD” href=”http://www.red-sweater.com/blog/xmlrpc.php?rsd” />

See the href= section? That’s pointing at a separate URL where my blog advertises information about how it can be programmatically edited. The idea is the user gives MarsEdit a simple home page URL, and MarsEdit can go work out the details of the interaction with the blog, by examining its RSD file.

As you can probably imagine, my new role as the principal developer of a popular weblog-publishing application, requires me to be pretty familiar with this format and with the contents of RSD files on various sites. It hasn’t taken me long to get sick of manually looking up the RSD for a particular page, and loading it in a separate window. I want to see the RSD, and I want to see it now!

Show RSD

Go ahead, click it. You should see an alert appear with the content’s of my blog’s RSD file displayed. Better yet, if you’re in the unusual position of needing to look at these things all the time, you can drag the above link to your bookmarklet bar, for convenient access whenever you’re staring at a blog you’d like to discover.

Personally I tend not to use bookmarklets, preferring to package up the JavaScript in an AppleScript so that I can easily attach it to a keyboard shortcut with FastScripts. From now on it’s Cmd-Opt-R for RSDs in Safari.

Credit: The Bookmarklet contains code from Apple’s excellent documentation on the subject of XMLHTTPRequest. My first time using the handy little beast!

MarsEdit For Your Custom Blog

March 11th, 2007

Although the vast majority of MarsEdit users are using it to manage posts on one of the big publicly available blogging systems, there are a good number of users, especially in the tech community, who run their own custom blog or blog-like software. I’ve received several private inquiries and this public one, all asking about the steps required to get MarsEdit working with a custom piece of hosting software.

Many have suggested that it would help for MarsEdit to support some kind of plugin system whereby custom software authors could develop a script or piece of code to help MarsEdit interface with the site. This general line of thinking is the right one, but the plugin is probably more appropriate for the server than for the client.

So how do you get MarsEdit working with your custom server software? You adopt a standard API and implement it for your site, in the form of a “xmlrpc.php” type file that accepts POST requests from MarsEdit and returns the appropriate responses. This isn’t as hard as it sounds, because there are really only a few calls involved. And after all, I assume if you’ve got a custom solution already, you know your way around a bit of web programming (or you know somebody who does!).

The best part is that by adopting a standard API, you’ll be prepared to work with other clients besides just MarsEdit. I mean, you’d be crazy to not use MarsEdit, but I’d rather keep you as a happy customer than a locked-in one!

Pick An API

The first thing you’ll need to do is choose a publicly documented API to implement. The choice is yours, but if you have no clue about which to adopt, I’d probably recommend the MetaWeblog API. You’ll be in good company, since some major services such as WordPress and Microsoft Spaces use the API for their remote editing support.

Observe A Working Case

Once you’ve settled no an API, I suggest setting up a working test blog that uses the API. That is, get a free blog somewhere, set it up and throw a few test posts up. Now you have a working case to compare your custom implementation against.

MarsEdit makes it easy to examine the chit-chat that goes on between it and a given blog publishing system. From the Window menu select “RPC Console”, and you’ll see a verbose transcript of all the messages sent from and received by MarsEdit:

Now you’ve got a working case to compare everything against as you iron out the details in yoru custom script.

Write Your Custom Script

Start small. Very small. Just write a simple CGI script that accepts a HTTP POST request from MarsEdit and prints out the cargo of the request. You’ll see that it matches exactly what showed up in the RPC Console. From here I would start with a single API call, probably the “getRecentPosts” call, and build your way up from there. Once you’ve got getRecentPosts working you’ll be able to see your list of blog entries show up in MarsEdit, which will surely inspire you to finish the rest!

If you get completely stuck, the good news is there are lots of working code examples out there as well. For instance, take a stroll down Google Code Search way on the MetaWeblog term. Be mindful of the licensing of any code you find, as always.

Configure MarsEdit For Your Blog

You’ll actually do this as soon as you’ve got your first very small test-case of a script finished. Just click the + button beneath MarsEdit’s list of blogs to add a new one, and specify the name and URL. Obviously MarsEdit will fail to obtain meaningful information about the blog, so you’ll have to edit the information manually. Assuming I set up a custom blog using MetaWeblog, the settings window might look like this:


(Note: The appearance of this dialog is slightly different in 1.1.3 and earlier. Look for this new layout in MarsEdit 1.1.4 and later)

Extra Credit: Really Simple Discovery

If you want to spare yourself and future users of your software from the pain of manually entering the data into the settings dialog, you can describe your blog’s API support by embedding in the home page a “rel” tag identifying a specially-formatted file called an RSD file. This stands for Really Simple Discovery, and is a format which MarsEdit can read to automatically determine which standard API your system uses.

Any questions I didn’t cover? Feel free to ask in the comments.

Update

Tom Insam posted this example a couple weeks back, where he implemented the MetaWeblog API for his site’s custom software, Zimki. Should serve as a good concrete example of the steps required.