Wrapping selected text in Drafts with [[wiki-brackets]]

For anyone using Drafts – which is great for quick capture and then prepping text to paste into Obsidian or making a .md file to import – you might be interested in a custom Action that I’ve just posted to the Drafts Action Directory: Wiki Wrapper. Works on macOS or iOS or iPadOS.

It’s based on the developer’s “Smart Brackets” Action, but with [[double brackets]]. If you’ve selected text, the Action will wrap the text (I have the keyboard shortcut set to ⌘⌥-[). If there is no selection, the Action will scan text for last open or close, and close the wrapping it if last one was an open, or insert the opening [[ if not.

3 Likes

How is this different than the built-in function that runs when I type [ twice?

That works beautifully in Obsidian, but in Drafts the selected text is replaced with [[.

This is great, thanks for sharing! I stage most of my stuff in Drafts so this will be great on the iPad.

@AutonomyGaps thanks for sharing this Drafts action.

I was excited to see this Action, thanks for sharing! I am still using my legacy copy of Drafts 4, and when I tried to add the Action, I got a script error: “ReferenceError: Can’t find variable: editor.“ I know very little about programming, so I don’t know if this Action simply won’t work with my old version of Drafts, or if there is actually something amiss with the script. Any help would be appreciated!

I’m afraid I’m not in a position to help: I merely tweaked the developer’s Drafts 5 script.

No problem—thanks anyway! I suspect it’s a Drafts 4 issue.

Thank you. This is very helpful!