I want to write an entry for my blog but boy howdy I can’t stand typing a bunch of text into a text field on a web page! Whatever can I do?
You can use TextMate, that’s what you can do.
Wait, I thought you were going to say, “Use ecto.” Isn’t TextMate just a text editor?
Saying that TextMate is a text editor is like saying that the oceans are damp, or that the sun is slightly luminous. Sure, you’re right… but only as far as you go. And you don’t go very far. Magic Dave Ball to the rescue!
Gratuitous Background
If you want a history of TextMate, I refer you to two sources: TextMate’s Wikipedia page and a pretty excellent book by the Pragmatic Progammers about TextMate. Any history I can give would only be stolen from these two sources.
Suffice it to say that TextMate has won numerous awards and each revision continues to improve upon the basic ideas of simplicity and excellence, the pillars of which bolster the roof of awesomeness. Ah, metaphor.
We’ll also be discussing Markdown. I’ll let John Gruber explain:
Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).
What all that means is that you get to write regular ol’ text, with some formatting conventions, and this nifty tool will transform it into HTML. Because, really, no one likes writing HTML; anyone who says otherwise is concerned for his/her job security.
I Thought This Was About Blogging
You’re right, of course, I was going to write about blogging.
The first thing that happens when I conceive of a blog entry is that I must, immediately, write down that idea somewhere. My brain is a sieve, and were it not for the more persistent forms of memory handed down to us by our silicon masters I would be reduced to a gibbering gibbon, scratching my red butt as I wondered where to fling my next batch of poo. That’s where TextMate comes in. TextMate help me fling my poo at my blog where it can be shared with the rest of the world. Excellent.
So fire up TextMate. If you need to download it, go get TextMate here. No more installation instructions, we’re all adults here.
TextMate is filled to the brim with loads of helpful bundles. Among these is the “Blogging” bundle. Yes, that’s right, the one we’ll be discussing at length today. Very good. Have a donut.
In Textmate, go to File > New from Template > Blogging > Blog Post (Markdown). You’ll notice three other choices in that last menu: Textile, HTML, and Text. Textile is like Markdown but, I feel, not quite as readable in raw text form (sorry, Dean!). We all know about HTML (job security), and Text is — well, Text is Text. We’ll stick with Markdown for now.
And voilà! A brand new TextMate window is now open with an empty blog post.
Is Your Blog Ready?
Ah, yes, of course. No, it isn’t.
One geeky-cool thing about TextMate is that some of its configuration is available as, well, text. In TextMate, go to Bundles > Blogging > Setup Blogs. A window should open up that looks a bit like this:

Check it out: That looks like an entry named “magicdaveball” with a funny looking URL after it. The format of the URL is very, very easy:
http://<username>@<address.of.your.blog>/<path.to.endpoint>
“username” seems straightforward (usually “admin” on a Wordpress blog unless you’re all multi-author in which case bully for you for having friends). “address.of.your.blog” is also pretty straightforward.
What the heck is that “path.to.endpoint” nonsense? Ah, well, that’s the path to your (get ready for it) XML remote procedure call endpoint. Y’know, the part of your blog software on the server that is easily susceptible to SQL injection attacks (bad!) and also handily lets you post to your blog with desktop clients (good!). According to the TextMate Blogging bundle’s own help file, here are the likely places for the XMLRPC endpoint on your blog:
Movable Type http://myusername@mydomain.com/mt/mt-xmlrpc.cgi#1
WordPress http://myusername@mydomain.com/blog/xmlrpc.php
Typo http://myusername@mydomain.com/backend/xmlrpc
The usually helpful help files are lying, just a little bit, since the location of your endpoint also depends on where you installed your blog. Magic Dave Ball’s blog isn’t in a “blog” subdirectory, for instance, it’s at the root. So my XMLRPC URL is:
http://admin@www.magicdaveball.com/xmlrpc.php
That was terribly easy. Yay us. Once you’ve made the necessary changes just hit ⌘-S (Save).
Let’s Test This Whole Setup Thing
We need to make sure this whole complicated process works. Make sure that your blog has at least one published post. This is key.
Go to Bundles > Blogging > Fetch Post. If you’ve defined more than one blog (how trusting!) you will now see that TextMate is helpfully displaying the names you gave your blogs back to you. How nice of it. You won’t see this if you only configured one blog; TextMate will immediately try to fetch the posts.
You should be challenged with a prompt for your password. Go ahead and type that bad boy in and hit Return (or Enter, sheesh).
If you’ve done these three things:
- Set up the blog with the correct username, address, and endpoint.
- Have at least one published post on that selfsame blog.
- Typed in the correct password for that blog.
…you should see a selection box allowing you to pick a post to look at! Neato!
If instead you see something like this:

Then something Bad has happened with one of your three steps, above. Check carefully. We’ll all wait until you’ve fixed things. You can do it. The Magic Dave Ball believes in you!
Once that’s all done and taken care of, we’re on our way.
I’m On My Way
I like to ruminate at length upon my words. I like the essence of blog to steep within my text. I don’t like publishing poo. So I’m excited that we’re finally at the poo-refinement phase of our operation here.
In that new blog entry window you opened up a few steps back (you have been following along, yes?) you should see something like this:
Title: untitled
Main entry text
(funny scissor-looking-thing line)
Main entry continued
Title seems fairly self-explanatory. Put something clever there, something diggable: “Top Ten Blog Poo Consistencies”, “Fifteen Worst Computing Mistakes of All Time”. Yeah, there ya go.
But what about those other three lines? “Main entry continued?” And what place do little scissor-looking-things have in a text editor? What the heck?!
Take a deep breath. Ever seen the fancy, “Click here to read more…” links that some blogs have? That’s what that funny scissor-looking-thing-line is: It’s the cutoff point in your entry. Now the scissors seem kind of cute, don’t they?
Try this for me. Highlight the entire line of funny scissor-looking-things and delete them. Go ahead, get rid of ‘em.
Now find a blank line and type the word “cut” and then hit the TAB key.
Whoosh! You made your own line of scissor-looking-things! What the heck?
Here a Snip, There a Snip…
One of the most powerful concepts in TextMate is that of “Snippets”. Every bundle in TextMate has some. The Blogging package, being a TextMate bundle, has lots of blogging-related ones.
Try this: Go to some other blank line, type the word “keyw” and then hit the TAB key.
Whoosh! You made the text “Keywords: ” appear! Say, doesn’t your blog do something with keywords? Couldn’t you, say, put that near the top of this blog entry and further define some metadata about your blog entry besides the words themselves? Whoa!
Let’s pull back from the precipice a bit and just concentrate on getting a post up.
Fence Building
Get it? “Get a post up”?
I slay me.
Anyway, type in some text into your new blog entry like so:

(And how did I generate that great “Lorem ipsum” stuff? Using the “lorem” snippet in TextMate… try it!)
Once you’ve got some text, let’s preview it. Sure, you could use the menu and go to Bundles > Blogging > Preview… or you could be more awesome and type the unlikely key combination of CTRL-ALT-COMMAND-P (for you Mac-savvy types, that’s ⌃-⌥-⌘-P) to see your lovely blog post.
Hmm. Not so lovely.
Wait a minute! What happened to Markdown, anyway?
Aha! Go to your blog entry and paste in the following:
Heading The First
=================
Blah blah blah...
Subheading 1
------------
*Italic blah blah blah...*
Subheading 2
------------
**Bold blah blah blah...**
Now preview it. Whoa! Look at how nicely formatted it is! Close the preview window and look at the text you pasted in. No, really, look at it.
Did you look? Did you really? Look again.
Okay, now that you’ve looked at it… what did you notice? Look at how the headings have underlines. Look how the italic text and the bold text are surrounded by asterisks… I mean, c’mon: Who doesn’t do that when IMing their friends? Or emailing them (you old fogies)?
TextMate can even help you here. Type this into your blog entry window:
Here Is My Heading
=<TAB>
Of course, instead of typing <TAB> try pressing the Tab key.
Shazam! TextMate underlines the entire header with equals signs, which is Markdown for, “Surround this with an H1 tag.”
Try typing something between a pair of asterisks. You’ll notice that TextMate formats the text in the window to remind you that you’re bolding or italicizing your text. Not bad, eh? Try and do that in Notepad. This works with underscore characters (_) and asterisks (*). Either one works as well as the other and can be interchanged (but not used together!). One asterisk/underscore set around a phrase (*here is a phrase*) makes the phrase italic. Two asterisks/underscores set around a phrase (**here is another phrase**) make the phrase bold.
Okay, so finally we’re about to put your post up on your blog. Are you excited? You shouldn’t be, because all you have to do is type ⌃-⌘-P or use the wimpy Bundles > Blogging > Post to Blog menu item. TextMate should think for a bit, send some bits up the tubes, and then attempt to display your post in your default web browser!
Did that not happen for you? Were you able to fetch a post earlier? Go back and try to get that working first, as that step is rather crucial to posting to your blog.
Wait a minute, why didn’t it ask me for my password?
Ah, I’m glad you are just as security-minded as I am. Here at the Magic Dave Ball, I’m always worried about security. Constantly. Fervently. Waitaminute, where’s my tinfoil hat?!
Your password is getting stored in a keychain. If you’re adventurous and feel like messing with Keychain Access or with the security program from a terminal, you’ll find an entry that looks an awful lot like your blog site. You can change the password from Keychain Access through (strangely enough) the Edit menu.
And we’re done!
Things To Remember
TextMate is fantastically powerful. Markdown is usually pretty simple. Most blogs are mind-numbingly dull. Be a part of the solution, not the problem.
At any rate, remember these simple points:
- Is your blog set up? If not, in TextMate, Bundles > Blogging > Setup Blogs will do the trick.
- Can you fetch posts? Don’t be fooled by TextMate’s lies when it can’t find any posts… unless you don’t have any published posts.
- Type ⌃-H for Markdown help at any time. TextMate context sensitive help really can, if you let it.
Poke around in TextMate’s bundles. There’s some pretty awesome stuff in there that we might even cover in a future entry! Neat.
In Summary
Look at you! Blogging from a super-powerful text editor! You could almost be mistaken for a Unix geek if only you would grow a neck-beard, or have an opinion about microkernels and SMP (and be willing to express them at great length).
For a pretty visual representation of the whole frickin’ process, check out this movie by Mr. Macromate himself.
As always, I love feedback. Was this too long? Spot any errors? Any part confusing? Does any bit need more wit? Let me know!
Give use a shake next time as we cover… links!



