Drafts Diagnostic Action

As a passionate user of the Drafts app by AgileTortoise, I usually spend at least some time each day on the Drafts forums catching up on the latest news and discussions, and helping other users with their queries where I can. Sometimes that help requires a few iterations of questions, tests and reviews. At times people can struggle as to what it is they are looking for. Recently I gave some consideration as to what I could do to speed up the process and help people provide pertinent information faster.

I decided to see what I could do to start developing some sort of diagnostic assistance tool for Drafts. Given that users of the app could be experiencing issues with their iPhone (and Apple Watch), iPad, and Mac, I was sure that whatever I created I’d want to run on any of the primary platforms. As a result, going with a Drafts action-based solution was the obvious approach, and would give me easy access to query many of Drafts’ settings.

The Initial Version

The first version I created was to help investigate this query on the Drafts forum. After several back and forth interactions, I decided to put together the initial version of the action.

It consisted of a set of information gathering actions I figured would help in investigating this issue (specifically the file listing for the Previews directory), as well as some others that I quickly put together to allow me to put something out there that wasn’t just a one shot.

I also included a set of output options. By default, the action is set to preview the output in a prompt window. This provides the user with an initial view of what the output will be.

Below this, I included some options to allow the content to be placed on the clipboard in a range of formats based around Markdown (or more specifically MultiMarkdown), HTML, and rich text.

The hidden details section is one that I feel is particularly useful and was created with the Drafts forum in mind. The Discourse (not Discord) software that runs the forum allows content in Markdown format to be hidden in spoiler/summary sections. These sections have a disclosure triangle that allows you to expand them and reveal the content beneath. Given the potential length of some of the output from the action, I thought that automatically wrapping the output on the clipboard with the appropriate mark up was a good idea; particularly as many forum users do not know that the option even exists.

The action ultimately did help to identify an error in the user’s folder path.

A Few Iterations Later

That was almost three weeks ago, and since then I’ve been running through a few iterations making some additions and improvements to the action.

Here’s what has been added in each revision.

Version 2

  • Added several additional data gathering sections for app and action information.

After the initial release I had a quick run through of what else I thought might be useful, based on some of the more recent issues I had seen come up. As a result I added some more data gathering around actions, workspaces and the editor (object).

Version 3

  • Fixed an action name containing emoji display bug on macOS.

I prefix a number of my action group names with emoji characters and while the display of these in the preview was working fine on my iPhone and iPad, the same was not true on my Macbook Pro. Instead it was displaying odd looking accented characters - a sure sign of an encoding issue. I found it a little odd that it varied between devices, but after several attempts at amending the output encoding I found an option that worked and now my action group names show perfectly wherever the action is run.

Version 4:

  • Added higher performance file/directory listings for macOS (only).
  • Removed unnecessary element spacing in action group listing.

After contacting Greg, the Drafts developer, about performance when dealing with iCloud storage, I figured that while I couldn’t make much if any change to the performance of the File System queries on i*OS, the same was not true of macOS where I can run shell scripts. As a result I modified the action to take advantage of this option and use some shell scripting to return directory listings instead. This is several orders of magnitude faster, and I would certainly recommend that for complex file structures that this is run on the Mac.

For example, I have my entire TADpoLe library working files, including the documentation web site it generates all embedded and git version controlled within a sub-directory of my Drafts Scripts folder. That is a lot of files and a complex directory structure. It is not suitable to scan on i*OS from Drafts.

Version 5

  • Added current draft information, including content dump and version information.
  • De-Markdown action/separator and action group names so they are not interpreted on output.
  • Added wrapping to code sections.

In this latest version I added some additional data capture based around the current draft. The main idea was to allow data about the draft, including its content, to be captured to include as an example of a draft where an issue may be occurring. Having these details for an example can make it much easier to reproduce an issue.

In addition I added some code to “de-Markdown” action, separator and action group names. If these names contained content that was valid Markdown, that would be interpreted and we don’t want that. We want to see the actual names even when rendered.

Along with this I amended the CSS used by the action to wrap the content in the pre-formatted/code sections. While this won’t wrap really long singular content (on purpose), it will make a nicer display in the preview for content that is long. For example a paragraph of text that is constructed on a single line will be soft-wrapped when tagged for pre-formatting.

The Current Action

As of today, the action can capture content in the following areas:

Drafts Set-up

  1. Drafts Info
  2. Editor Info
  3. Workspace Info
  4. Current Workspace


  1. Device Info

File System

  1. Directory Listing for Previews
  2. Directory Listing for Scripts
  3. Directory Listing for Templates


  1. Action Group Listing
  2. Action Listing
  3. Action Keyboard Shortcuts Listing

Current Draft

  1. Current Draft Info
  2. Current Draft’s Versions
  3. Current Draft Content

The action can also output to the following:

  1. Rendered Preview Window in Drafts
  2. Content to Clipboard
    1. As MultiMarkdown
    2. As MultiMarkdown in a Hidden Details Section
    3. As HTML
    4. As Rich Text

You can always download the latest version of the action from the Drafts Action Directory.


I’ll be endeavouring to update the action whenever I think of anything useful to add, and I’m certainly open to suggestions - just contact me on the Drafts forum or on Twitter if you have any suggestions. Otherwise, I hope you find this action useful and that it is useful to the wider Drafts community in troubleshooting issues in Drafts.

Author: Stephen Millard
Tags: | drafts |

Buy me a coffeeBuy me a coffee

Related posts that you may also like to read