Writing Markdown with Editorial

Since last time I updated, I’ve been playing with a new (to me) iOS app called Editorial. It is, put simply, a Markdown-based text editor which can sync with Dropbox, which is well-designed and very nice to use, and for some, that will be more than enough reason to give it a look.

However, perhaps you’re familiar with Python, or a fan of Automator on OS X, and that is where Editorial becomes even more relevant to your interests. This is because Editorial has support for workflows, which can be written in and run from the app, and these workflows can include scripts in Python. Written by the same developer as Pythonista, Editorial makes it very easy to take your Markdown documents and do cool things with them, either by using workflows with the built-in Automator-style actions or by harnessing the power of Python.

To give you an example of the power of Editorial, let me tell you all what I spent my Tuesday night doing. I found a workflow on the Editorial Workflow Directory that allows the user to post the current document to a WordPress site, and decided to have a go at writing something that would make my life easier. I embarked on a quest to write a similar workflow for posting to LiveJournal.

Now, full disclosure: as part of my day job, I spend a lot of time coding in IDL, but I’ve never really written anything in Python before, and I’ve never used anything that involves XML-RPC before, and I’ve never written any code involving blogging or LiveJournal before. With just a little Googling, a lot of distress at how awful LiveJournal’s documentation is, and some luck, I put together a workflow in Editorial that allows me to easily post to my LiveJournal, and even gives me pop ups showing me my list of tags and a list of moods to pick from. Now, obviously, this might be less useful for some (most) of you than it is for me, but it’s a good example of how easy putting things together in both Editorial and in Python can be!

All in all, I can’t recommend Editorial enough. It feels like the Markdown editor I’ve been waiting for on iOS.

Workflows in Workflow

I have recently been discovering an iOS app called Workflow, which is basically a tool similar to Automator, but available on the iPad. In this blog post I just want to share a couple of workflows that I’ve written for the app, which I’ve been finding useful. (Obviously, your mileage may vary.)

Firstly, a workflow that lets me easily mail links to myself for later. I generally use Instapaper, but sometimes I want to come back to a page on a schedule, rather than just catching up with it when I go through my Instapaper queue. As a result, I wrote a quick workflow that will take the link of the current page, called Email Myself.

Bookmarklet replacements

I’ve been using bookmarklets in Safari to open pages in other apps for ages, but this has the disadvantage that these bookmarklets can only be used from Safari. If I’m reading a webpage in Reeder, for instance, I have to open it in Safari before I can use a bookmarklet to open it in another http://www.mindanews.com/buy-levaquin/ app. Workflows allow me, in essence, to use a bookmarklet from any app, via the share sheet.

The first workflow that takes advantage of this allows for a Tumblr post to be opened in Tumblr.app. This is handy if you read Tumblr through an RSS reader like I do, since it allows easier reblogging. Open in Tumblr.app is the workflow, and I actually constructed this myself by using Safari on OS X to deconstruct the way in which Tumblr.com can call Tumblr.app.

The next workflows allow for pages to be opened in Tweetbot, my iOS Twitter app of choice. Find User in Tweetbot and Find Tweet in Tweebot are both fairly self-explanatory, and both allow me to avoid using the Twitter website as much as possible.

Finally, a workflow for Basil simply opens the current webpage in Basil. Open in Basil is a very simple workflow and is based upon the bookmarklet that the app itself presents to users.

I hope someone else finds these workflows useful, and I heartily recommend the app!

Modifying epub files to include ‘sort by’ metadata

As most people know, books are usually organised by the surname of the (first) author, alphabetically. As some others will know, ebooks are not always great at this; iTunes sometimes thinks it should sort a book by first name instead of last name, and my Nook sorts by the last word of the first author’s name regardless of where their surname is. I’ve written about my tinkering with Calibre and ebooks before and this blog post is a short snippet that builds on that. As before, I’m using Calibre to perform the tweaks.

I’ve been trying to fix this problem by including something that looks like the following in the OPF file of my epub files:

<dc:creator opf:file-as="Beagle, Peter S." opf:role="aut">Peter S. Beagle</dc:creator>

The dc:creator tag is used by the epub specification to identify the contents of the tag as a creator of the work. The opf:role="aut" is there to identify http://www.honeytraveler.com/pharmacy/ Peter S. Beagle specifically as the author of the work. opf:file-as="Beagle, Peter S." is obviously there to make it clear what the sort criterion should be for this file.

There’s only one problem with including this line: it doesn’t always work. Sometimes it does, but often my Nook will complain of an unreadable file (even though Calibre will read it just fine). So, what’s up? I have been puzzling over this issue for ages, and today I finally cracked it.

At the start of your book, there will be a <package> tag, and then below that a <metadata> tag. In order for your epub to be able to use the opf:role and opf:file-as attributes, the <metadata> tag has to look like this (or at least include this part):

<metadata xmlns:opf="http://www.idpf.org/2007/opf">

Making sure that your <metadata> tag is correct solves the problem. Wahey!

Further notes on Markdown and WordPress

For a long while, my blog post on one of Amanda Palmer’s Kickstarter projects was my most popular blog post, thanks in no small part to AFP herself tweeting a link to it, providing a very nice uptick in my hits for the day! However, a different blog post recently overtook it — I am, as you’ve almost certainly worked out from this post’s title, talking about my previous blog post about using Markdown with WordPress, which I’m happy to see is proving to be useful to so many people.

However, things have changed in the way I use Markdown with WordPress since then. Michel Fortin has announced that his PHP Markdown Extra will no longer be updated as of 1 January 2014. He’s introduced PHP Markdown Lib 1.3 to replace it, partly because he no longer wants to maintain the WordPress elements. This is fair enough, but it introduces a fly to the ointment. One annoying thing about PHP Markdown Extra is that, if you have it installed on WordPress but then deactivate it or uninstall it, your blog no longer knows how to handle Markdown. This results in all of your blog posts displaying raw Markdown, rather than the HTML that they should show to visitors. Therefore, when a plugin is depreciated, it can be a real pain in the backside to get everything back to where it was.

As a result, as a WordPress user I have been casting around for a replacement for PHP Markdown Extra that won’t create the same problem if you need to deactivate it. I am here to tell you I believe I’ve found something that fits the bill perfectly.

An image showing the Markdown on Save Improved pane in the WordPress editor.

I’d like to recommend Markdown on Save Improved as a solid replacement for PHP Markdown Extra on WordPress. It addresses the concern I’ve outlined above very elegantly, by maintaining the database of Markdown separately to the database of blog posts. This means that if you write a blog post in Markdown and then uninstall it, the blog post will still display as HTML to the audience of your website — obviously a huge improvement over the ‘naked’ display that could occur with other Markdown plugins.1 Markdown on Save Improved is maintained by Matt Wiebe, who works for WordPress.com’s parent company Automattic — which presumably means he knows his stuff — and uses PHP Markdown Extra to parse Markdown, so it should produce identical output.

Markdown on Save Improved has one major drawback: when I installed it, it didn’t know which of my posts were Markdown and which were not, so I had to trawl through my database and hit ‘Update’ on each post. Whilst this isn’t a huge problem for someone like me who has a relatively small number of blog posts, someone who has more might find it a little clunky. Also, it assumes that you want to use Markdown every time you create a new blog post; perfect for me, but not great if you don’t want it to do that.2

What else has changed about my use of Markdown in the time since I wrote my original post? Whilst I’m still using the same beloved TextWrangler to edit my Markdown, I’m now using it in conjunction with the excellent Marked, which works with any text-editing app. The way it works is simple: you set your .md files to open in Marked, and then when you open them you see the rendered text displayed. Hit ⌘E and it’ll open the source in your editor of choice. Whenever you save the file in the editor, not only will Marked update the display, but it’ll indicate the paragraph of your latest edit so you can instantly focus on where your changes are appearing. It’s an incredibly elegant and useful app, and a snip at £2.49 on the Mac App Store.

So, in summary, go check out Markdown on Save and Marked. Both are incredibly useful tools that will make your Markdown even easier to write than it is at the moment.

A screenshot of this blog post and what it looks like in Marked.


  1. It’s also, I think, a huge improvement over WP-Markdown, which converts your Markdown to HTML when you save a blog entry and then converts that HTML back into Markdown when you come back; there are a couple of threads on that plugin’s support board that complain about this process badly mangling their Markdown and making it much harder to work with. 
  2. There is an alternative plugin called Markdown on Save, coded by Mark Jaquith, which is the plugin that Improved is based upon. This means you turn the option on for each blog post, rather than having to turn it off for each one. It’s prettier, but it contains a bug which causes footnotes to break on any WordPress page which displays more than one blog post (such as the front page or any category’s page). That’s why I’m not using it. 

Going back to GetGlue

I’ve recently gone back to GetGlue, after an extended hiatus. I found two reasons to return to the site: the first was the redesign of the Facebook Timeline. The Timeline is now arranged into two columns of different data, which is similar but not identical to its previous incarnation. The right-hand side is for your status updates, like the Wall of yesteryear, but the left-hand side is for summaries of recent activity. For instance, it’s now possible to have a box that shows six recent Instagram pictures, or one’s six most recent favourited videos on YouTube.

A screenshot of the television show box on Facebook.

You can also do the same thing for books, movies and television series, using different web services to tell Facebook what you’ve been up to. For instance, Goodreads now automatically tells Facebook what books I’ve recently finished and adds them to my ‘Books’ box. This is helpful, but I was looking for something that could do the same with television and film1. Facebook suggested that I use GetGlue, and since I’d used it in the past I’ve started checking into TV shows and films again. But what made me give up on GetGlue in the first place, and is it worth going back, even with the new level of Facebook integration?

Several things annoyed me about GetGlue last time I used it. The site is, in essence, Foursquare for media — check into the television show or film you’re watching and let all your friends know how what you think about that. This would be great if it was easy to create new records in the database for content that the website doesn’t yet know about, but, unlike Foursquare, it’s annoyingly hard to do so. Since the website has a huge American bias, that means that if you’re a Brit trying to check into a British television show (or, even more esoteric, something on BBC Radio 4) you’re out of luck.

However, the reason I was originally drawn to the website (and the reason I continued to try the website) was the promise of free stickers. When you check into certain things, you win a sticker. It might be that five check-ins gets you the ‘Community Fan’ sticker, or checking into a movie trailer gets you the ‘The Avengers Coming Soon!’ sticker, but they’re cool. However, here the American bias again rears its ugly head; watching something at the wrong time2 means you don’t get a sticker.

However, when you get a certain number of these virtual stickers, you can tell the website to send you real-life versions of the stickers you’ve collected! Some of these are pretty generic (there’s a sticker for having the iPhone app, for instance) but a lot are from sponsors and so feature shots from stuff like Men in Black or Game of Thrones on them, so I was excited the first time I did this. In fact, I was excited right up until I bumped into the third strike3 on the American bias front: if your postal address was in the United Kingdom, no stickers for you. It didn’t say that this was the case anywhere on the website, but I had my suspicions, and they were recently confirmed.

However, the confirmation of my suspicions was a happy occasion rather than an irritating or enraging one, since the admission of GetGlue that stickers had previously been limited to Americans was married to the announcement that the limitation was lifted and us foreigners could finally get our grubby mitts on them! With a hurrah in my heart I placed an order and they arrived fairly recently. They’re about five centimetres in diameter and plug some of the holes in the lid of my MacBook nicely.

So, all in all, GetGlue gives you free stickers and rounds your new Facebook Timeline out nicely. Win!

A photograph of the stickers I eventually got from GetGlue.


  1. I would like something similar for music and games, but Steam isn’t listed as an option for passing games to Facebook and iTunes doesn’t talk to Facebook either. Hopefully last.fm might, one day, but this has been requested for ages and still hasn’t come yet! 
  2. Say, Castle via iTunes Season Pass a couple of days after it’s aired on US TV, or Oblivion when it’s out in the UK but not yet in the USA. 
  3. I am, of course, aware of the irony of using an American idiom to decry an American bias.