×

OmniFocus: Markdown Link to Selected Item (template)

The actions of the following shortcut can be used to return a link in Markdown format to the currently selected project, task, tag, or folder. These actions can be copied and pasted into your shortcut.

DOWNLOAD SHORTCUT

This template works with Apple Notes, Apple Mail, Drafts, Bear, Craft, and other 3rd-party applications with integrated Shortcuts support that accept text as input.

Markdown Link to Selected Item
Markdown Link of Selected Item


try { var sel = selection.databaseObjects if(sel.length === 1){ var selectedItem = sel[0] if (selectedItem instanceof Folder){ var objType = "folder" } else if (selectedItem instanceof Tag){ var objType = "tag" } else { var objType = "task" } } else { throw { name: "Selection Issue", message: "Please select a single task, project, folder, or tag." } } var ID = selectedItem.id.primaryKey var urlStr = `omnifocus:///${objType}/${ID}` var markdownLink = `[${selectedItem.name}](${urlStr})` markdownLink } catch(err){ var alertPromise = new Alert(err.name, err.message).show() alertPromise.then(result => {throw new Error(-128)}) }