Using checkboxes

I’d like to know how to do 2 things, one with checkboxes and the other with the Markdown variant.

First, I’d like to have a script step that forces a note to have the GitHub Markdown variant if it doesn’t already.

Second, when I click on a checkbox I’d like to add the “strikethrough” markers at the start and end of the text associated with the checkbox - which is why I need to control Markdown.

I can do both of these things manually of course, but where’s the fun in that? Can this be scripted? A pointer to the right documentation would be great.


To set the current draft to be have GitHub Markdown as its syntax, you can run a script step like this:

draft.languageGrammar = "GitHub Markdown";

For what it’s worth, the ThoughtAsylum - Writing action group has actions to set the syntax like this for each of the syntaxes.

There is currently no way to trigger an action on checking a checkbox.

You could trigger an action to check the checkbox and add the strike through markers, or you could have an action you run at the end to add the strike through markers for every checked line that does not already have them.

Thanks, that’s very helpful.

So, I can’t find docs that describe how to set triggers - are you able to point me at a description?

Actions are run by manually triggering them from within the app. My proposal was that you could manually trigger an action by manually running it either to update a particular line your cursor is on, or when you have completed your updates and then choose to have an action update everything marked and not previously struck through in the current draft.

You could tie this to an extended keyboard row for easier access, or even to a keyboard shortcut if you have a physical keyboard.

If you had some workflow external to Drafts, then drafts does support both Shortcuts actions that can run drafts as well as x-callback-urls. You could in theory schedule a run each night of an action that, for example, updated any draft for strike throughs that was tagged with a particular Drafts tag - I’m just not 100% sure off the top of my head if such an automation on i*OS for example might require the device to be unlocked, or require a Mac to be unlocked to process a callback request successfully. Some apps do seem to have interaction constraints and I’ve never attempted this with Drafts.

@pw6163 did Stephen solve your two requests?

Yes he did. It wasn’t quite the answer that, in an ideal world, I’d like to have received, but it’s accurate and tells me everything I need to know.

I’ll look into triggering Drafts action scripts from an external piece of software (via a callback URL I think) and then work out how to invoke that software from cron. Hopefully I can work something out. It would also help automate the backup that I currently initiate manually every few days.

Thanks for the help Stephen.

Great. Let’s see what the future of Drafts has in store for us. Thanks for your reply- I have set the topic to Closed. Feel free to reopen this one or a new one as you see fit.