<<TextExpander>> in New Draft with Template Action

Loving the New Draft with Template action – thank you!

Curious whether the TextExpander <<snippet>> tag works with this action, though?

I have a draft where Some Words <<name-of-snippet-that-otherwise-works>> is in the first line.

When I run New Draft with Template, everything works fine, but that snippet does not expand.

(Couldn’t find any reference to this elsewhere in the community.)

Device/OS: iPad Pro (12.9-inch) (3rd generation) running iPadOS 15.3.

1 Like

P.S. Settings > TextExpander > Expand in Action Templates is already enabled.

They should work in this context, as the action passes through the template engine, with a few caveats:

  • iOS only. TE snippets in actions do not work on Mac.
  • A few types of snippets do not work, like ones with fill-in values.

Is this snippet working when typed in Drafts? Does it work if you use the <<snippet>> syntax in other action templates?

Thanks, (I assume this is) Greg. :slight_smile:

I believe the requirements you noted are met…

  • iOS only – I’m on iPadOS; assume that’s included in iOS scope
  • no TE fill-ins

Is this snippet working when typed in Drafts?

Yes, the snippet works when typed in Drafts.

Does it work if you use the <<snippet>> syntax in other action templates?

No, it doesn’t seem to work in other action templates.

I only had snippets in that one template, so I created a test with that snippet, and a different one:

  • xtod inserts the current date
  • xbul1 inserts the character :ballot_box_with_check:

Template contents and screenshots are below for reference.


Test template contents

Test template - TE snippet expansion

## Snippets to test

1. **xtod** -- TE snippet that inserts the current date
2. **xbul1** -- TE snippet that inserts a checkmark emoji

## Test: typed snippets

**Expected:** when a TE snippet is typed, the snippet will expand as defined

1. **xtod** result when typed: Monday, Feb 7, 2022 `(passed)`
2. **xbul1** result when typed: ☑️ `(passed)`

## Test: <<embedded>> snippets

**Expected:** when New With Template action runs on this template, each <<snippet>> will be replaced by the same output as in the section above.

1. <<xtod>>
2. <<xbul1>>

Output screenshot

Thanks for the details.

Did some digging in the code, and, yes, this is not supported. Scripted expansion of templates does not support TextExpander expansions for technical reasons related to the limitations of TextExpander integration.

Apologies for my initial misleading reply.

No problem.

In case it’s helpful, here are the pages I touched on my journey to trying the above. (Thought it might be possible to add a note about the limitation…)

I think I started here:

Note: the “Drafts tags” link on this page referenced above links to https://reference.getdrafts.com/topics/templates.html, which redirects to https://docs.getdrafts.com/, which I remember being confused by. (But that happens fairly often, so… ¯\_(ツ)_/¯ )

I searched a bit, and think I wound up here…

which eventually led me here:

and here:

Hope that’s helpful.

1 Like