How to get tags as hashtag list without commas?

I’m trying to move drafts to Evernote while maintaining the tags. Evernote’s mail to evernote functionality allows you to include tags in the subject line if they are formatted as a space-delimited list of hashtags. The [[hashtags]] template variable produces a comma-delimited list of tags formatted as hashtags, separated by commas.

Is there a straightforward way to use a space as the separator instead of commas when converting a set of draft tags to a list of hashtags?

There is not a built-in template tag that formats tags in that way, but this script would work. Add a “Script” action step before your email step with this script, and then you will have a new custom [[evernote_tags]] tag you can use in the subject template for the email step:

// convert tags to an array of hash tags
let hashTags = => `#${x}`)
// join tag array into a space separated string
let tagString = hashTags.join(" ")
// create a custom template tag for use in subsequent steps
draft.setTemplateTag("evernote_tags", tagString)

Thanks–this worked great!