Tuesday, September 11, 2018

Compiling and Exporting iOS Review Chapters With Drafts

Federico Viticci (tweet):

At the same time, I also wanted to simplify my process so that I wouldn’t end up writing my review in an app and editing it in another. For the past few years, I’ve experimented with Scrivener and Ulysses for this, but neither of them is well suited for the unique mix of longform writing and heavy Markdown automation I’m looking for. Drafts 5 felt like the spiritual successor to Editorial that I could fully script and customize to my needs. So for the past three months, I’ve been writing and editing my upcoming iOS 12 review entirely in Drafts.


One function of the Draft object in Drafts 5 is the ability to retrieve an array of drafts by querying the app for items that match a specific search string, filter, or tag (or combination of all three). Essentially, this allows you to search Drafts 5 for items that match specific conditions; items can then be iterated upon in JavaScript for additional manipulation. My action involves querying Drafts 5 with a tag filter, which returns an array of drafts that can be read in a repeat loop and appended (one after the other) to a new variable, which then becomes the .md file to share with other apps.


Finally, because iOS doesn’t have a way to save data directly into another app’s container, saving the .md file to a GitHub repository in Working Copy is done via the share sheet.

Previously: Drafts 5.

Comments RSS · Twitter

Leave a Comment