Posts tagged

Testing an iOS Shortcut: iA Writer → WordPress /

I have a workflow in Apple’s Shortcuts app for iOS that automates publishing a post from iA Writer (a Markdown text editor) to my WordPress website. Actually, it does more than simplify a tedious task. It allows me to set all the post data in iA Writer with MultiMarkdown metadata, keep my copy locally, and avoid the WordPress editor altogether. iA Writer’s own WordPress feature doesn’t do that (yet?).

I can set a Title (or just use a Markdown header), Category, Tags (converted from iA Writer Twitter-style hashtags to comma-separated WordPress tags), the URL slug based on the filename, a Format, the Status to “Published” (not just the default “Draft”), and a Date (scheduled posts!). It handles Markdown export (WordPress must also be set up to receive it with a plugin like Jetpack) or the default HTML export. I set up my WordPress site to expect the posts and update any post with the same filename, allowing me not just to create new posts but edit existing ones. It all works well and I’ve been using this workflow exclusively for some time.

Except that the shortcut always crashes when I first run it. It succeeds when I immediately run it again. It’s hard to debug because I have to wait some time for it to crash again. I suppose this has something to do with a cache, or the shortcut not having enough memory allotted to it to begin with.

I’ve tried some things to see if I could give it more juice: set up a dummy shortcut that called the longer shortcut, or paused and then called it. I tried to add an action to force the shortcut to run in the Shortcuts app rather than from the Share menu of iA Writer (“Continue Shortcut in App”). I even tried to put various pauses or “Quick Look” actions at the beginning of the shortcut to see where it failed, but it collapses before running even the first action, like Shortcuts sees what’s coming down the line and faints.

I admit the shortcut is long at 150 steps. It is made of up of several stages that were once separate shortcuts chained together, and it would sometimes crash then too. I may have to break it up further, but then it becomes less shareable.

Half the fun is putting a shortcut together. They are not usually one-size-fits-all but connect the dots between a choice of services and apps. Apart from my choices of iA Writer and WordPress, this shortcut isn’t too idiosyncratic. It follows MultiMarkdown and WordPress conventions. You can customize it, of course. I documented it with comments in the shortcut to help others (and my future self).

Do you use iA Writer and WordPress? Try it on and see if it suits. Give some feedback and any ideas about the source of the crash.

Get the iA Writer → WordPress shortcut

iA Writer Markup /

I’m using iA Writer to write with Markdown formatting. It’s an effective app and a pleasant way to write (compared to, say, Microsoft Word or straight HTML). The files are portable because they are plain text, but that also leads to a shortcoming: apps handle Markdown differently.

This page just tests the limits of iA Writer’s output, a kind of acid test. The markup also ends up being a test of this website’s styling of all the different HTML elements.

The HTML that I exported is immediately below and the original MultiMarkdown source from iA Writer is further below for reference. I sent the whole thing to the website by an iOS Shortcut.

See also the MultiMarkdown Syntax Guide and iA Writer’s own Markdown Guide.


Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
Placeholder image
Placeholder image

Paragraph with important text, emphasized text, and super important text (BETTER THAN ALL CAPS!). There is a strikethrough, code, a link, of course, and an inline image in a link with a footnote: inline placeholder image1.

  1. Ordered list item
    • Nested, bulleted list item
    • Task list item (click to check off in iA Writer!)
  2. Ordered, completed task list item

The rare definition list:

definition2
a statement of the exact meaning of a word, especially in a dictionary
the degree of distinctness in outline of an object, image, or sound

A block quote (with a citation reference):

Someday we’ll find it, the rainbow connection, the lovers, the dreamers, and me, … la da da dee da da doo, la la da da da dee da doo.

—Kermit the Frog[3]

And a code block:

alert( "Hello, World!" );

Markdown supports tables but they are messy. iA Writer handily includes a CSV file as a simple table:

Header Row Column 2 Column 3
Row 1 Data is nice
Row 2 So make it look good

Markdown is meant to format simple writing in a way that is readable to both human and computer. It is not meant for more complex formatting. When all else fails, use raw HTML. This snippet has embedded Markdown (be sure your quotes are straight!):


## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

![Placeholder image](https://via.placeholder.com/160/999/999)

Paragraph with **important text**, *emphasized text*, and ***super important text*** (BETTER THAN ALL CAPS!). There is ~~a strikethrough~~, `code`, [a link, of course](https://ia.net/writer), and an inline image in a link with a footnote: [![inline placeholder image](https://via.placeholder.com/24/999/999)](https://music.apple.com/us/album/the-muppet-movie-original-motion-picture-soundtrack/1440805864)[^Media courtesy of Apple Music. Use their service and maybe they won’t hold it against me.].

1. Ordered list item
    - Nested, bulleted list item
    - [ ] Task list item (click to check off in iA Writer!)
2. [x] Ordered, completed task list item

The rare definition list:

definition[^_Oxford Dictionary of English_]
: a statement of the exact meaning of a word, especially in a dictionary
: the degree of distinctness in outline of an object, image, or sound

A block quote (with a citation reference):

> Someday we’ll find it, the rainbow connection, the lovers, the   dreamers, and me, … la da da dee da da doo, la la da da da dee da doo.
> 
> —Kermit the Frog[#book]

And a code block:

``` javascript
alert( "Hello, World!" );
```

+ + +

Markdown supports tables but they are messy. iA Writer handily includes a CSV file as a simple table:

/_/Table.csv

Markdown is meant to format simple writing in a way that is readable to both human and computer. It is not meant for more complex formatting. When all else fails, use raw HTML. This snippet has embedded Markdown (be sure your quotes are straight!):

<audio controls src="https://audio-ssl.itunes.apple.com/apple-assets-us-std-000001/AudioPreview118/v4/51/77/6c/51776c55-224f-a10a-74a6-7eb004e94f84/mzaf_6308902825983025033.plus.aac.p.m4a">*Your browser does not support HTML5.*</audio>

* * *

Some notes:

  • There are a few things not tested here that iA Writer is capable of handling: Setext-style header, Table of Contents ({{TOC}}), Markdown table (or table caption), or Math (TeX).
  • iA Writer wraps a block image (one that is on its own line) as a <figure> element with the optional text as a <figcaption>. This is preferred. (Inline images are just the <img> with the optional text set as its alt attribute.)
  • iA Writer doesn’t distinguish between *emphasis* and _citation_, rendering both as <em> instead of <i> or <cite> (I’m not aware of any Markdown editor that does differentiate them, but they are semantically distinct).
  • iA Writer doesn’t recognize ::highlight:: (HTML: <mark>). It doesn’t claim to but it would be nice.
  • iA Writer has it’s own file transclusion syntax, beginning a new line with / followed by the relative path to an image or text document to include (also works with an absolute URL on it’s own line). Much neater than MultiMarkdown spec. The table above is included this way.

iA Writer’s implementation of Markdown is the best in my opinion, compared to other apps and tests, even MultiMarkdown Composer.

It’s a good idea to export directly from iA Writer to HTML or Microsoft Word rather than let another tool convert it such as the Markdown module in the WordPress Jetpack plugin (which uses Markdown Extra). Pandoc comes very close.


  1. Media courtesy of Apple Music. Use their service and maybe they won’t hold it against me. ↩︎

  2. Oxford Dictionary of English ↩︎

  3. Jim Henson, It’s Not Easy Being Green: And Other Things to Consider. (This quote may or may not be contained in this book.)