I frequently capture posts from Mastodon to hold as reference and would like to be able to escape the hashtag symbol.
This allows me to control the tags within drafts and within downstream apps (like reminders and Obsidian) to not treat the Mastodon tags as hashtags in those systems.
I only want to escape the hashtags in the title and body of the draft and not any drafts assigned hashtags.
By “escape”, you mean added a
\ before any hashtags?
Do you want to alter the draft itself, or just have these cleaned up as you export them to those other locations?
In the simplest case, you can use regular expressions to locate and replace any hash tags with a scripted line something like:
draft.content = draft.content.replace(/(#\S+)/g, "\\$1")
draft.update() // save changes
That looks daunting if you don’t know regular expressions, but it’s basically looking for any string that starts with a
# and any non-whitespace characters after it, and putting a
\ in front of them in the text of the current draft.
Yes, I meant the back slash to “escape” the hashtag symbol.
My regular expression chops aren’t up to following that entire expression, yet.
So my options seem to be either insert this into a standalone action (EscapeHashtags) or append to the actions where I send something to another destination. I think I would like to have the standalone action.
I’m not familiar with how to create a custom action so I’ll be looking into that in the documentation.
thanks for the jump start.
The action is saved here:
That was about as easy a process as I have ever done customizing an app. I’ve been using drafts for years and now I will enjoy it even more.