Ole Zorn’s Editorial App for iPad is pure awesomeness and if you’re a Markdown (and iPad) fan you probably know that already. One of my (few) New Year’s resolutions is to learn (more) Python and to learn how to write Editorial workflows. Because the markdown documents I write contain usually a few images from web sites I research (not from my iPad image library) and because Editorial includes its own web browser I asked myself: why can’t I just somehow insert a markdown image link in my document to an image that’s on the web page I see in Editorial’s browser? Either I’m missing something or it just isn’t there (yet). Well, because I’m always eager to learn I started to implement exactly that.
The thing is: currently there’s no elegant way to preset the user a number of images (the ones from the web page you’re reading in the Editorial browser) and let him choose one interactively. With kind help from Ole (thanks so much, dude, you rock!) I was able to workaround this. The result are actually two workflows:
- The first workflow („InsertImageURL„) is the one you invoke directly. Prerequisites are that you have a web page open in the browser that contains images. If you have selected some text in your document when you invoke this workflow this text will be placed inside the [ ] brackets afterwards.
This workflow scans the web page for all the image URLs and builds a simple web page of its own that gets presented to the user with the „Show HTML“ action. Each image on that page can be tapped. You tap on the one whose link you want to have inserted into your markdown document as an inline image link. The trick is: the link behind the image uses the Editorial URL scheme and invokes the second workflow.
- The second workflow („InsImgUrlB„) just takes the image URL from the first workflow, builds the correct markdown syntax, inserts the selected text (if any) into the brackets and adds the URL into the parenthesis. That’s it. So you never invoke this second workflow by yourself. Always invoke just the first workflow, „InsertImageURL“.
It’s a first version and there maybe bugs. Also, it’s just inline image links for now. I do like reference style links more but it’s a bit more complicated to add those. And the page that presents the web page’s images could be fancier. I’ll be working on it. 😉
Please report bugs, suggestions, praise, hate etc. in the comments section below.
Thanks again to Ole for his kind help and thanks to Brett Terpstra, Federico Viticci, David Sparks, John Gruber, Fletcher Penney for being a constant inspiration in the fields of apps, workflows, tools, markdown and more! 🙂