Drafts - Add to Obsidian (Details)
With a Pro subscription, you can create, duplicate, and edit actions. This explains how I created this action so you can understand how it works, make any adjustments, or duplicate and edit your own version.
Select Add to Obsidian, Control+Right-click (Trackpad tap), and select Edit… from the menu.
The system will display the Edit Action window, allowing you to define or edit the action details. It has three panes with general information on the left, action steps in the middle, and selected action step details on the right.
Icon
I selected the plus icon in a blue circle by tapping on the icon, selecting its background color (blue), and searched built-in icons for plus, and chose this one with a plus in a circle.
Name
I named the action Add to Obsidian, since this action adds a text draft to the Add folder bookmark in the Obsidian vault for further processing.
Description
I included the following description to explain what this action does.
Add the current draft to an Obsidian vault as a new Markdown file.
The file name is a “safe version” of the note title based on the first line of the draft; it removes the heading tag (#), path separators (/), and all ASCII control characters (like colon or question mark) that are not allowed in Obsidian file names (\/:*?<>|#).
It automatically adds a tag “note/draft” to identify draft notes so dataview queries can process new draft notes added to Obsidian. You can also add any other tags in your draft.
The File action writes directly to a file in a specific Drafts bookmark folder named “Add”. For example, I associate this bookmark with the inbox folder (“+”) in my Obsidian vault (“Ideaverse”), although you use any folder you want, if you want to separate these drafts from additional notes. When using iCloud sync, you would select the same iCloud folder for both macOS and iOS.
The action group bar uses the label “Add” along with an icon, which I assigned as a white plus on a blue circle. For Markdown convenience, it also has buttons for header, list, bold, italic, and link.
You perform an action by tapping the action group bar button, or you can use the command palette (Shift-Cmd+P) or toolbar icon (plus in search).
I also assigned hotkeys to run the Add action (⇧⌘O), and some Markdown formatting: header (^⌘H), bold (⌘B), and italic (⌘I).
After successful completion, the action moves the draft to your Drafts Trash, where it gets deleted automatically after 30 days. When the action was unsuccessful, brief notifications and action logs reflect only error completions (in red).
The most common reasons you might get an error are a blank title (first line) or a duplicate file name. Just ensure you have text on the first line as your title, and add a suffix if necessary to make a unique file name, and then add it again.
Note: This might require some change if I moved to Obsidian Sync, rather than iCloud, since then the bookmark folders would be different on both.
Configuration
Then I configured some additional parameters:
- The button appearance has a label, Add, along with the icon.
- I currently have no defined keyboard shortcut, but it might be useful.
- After successfully executing this action to file the draft in Obsidian, it’s moved to the Trash, since this temporary draft doesn’t need to be saved.
- Also, this action is visible on the List and Action Bar for both macOS and iOS .
Steps
This action has a single File step that writes the draft to Obsidian in the folder assigned to the Add bookmark.
Note: Template Tags
Initially, I had two preliminary steps to Define Template Tag that assigned[[safe-title]]
to fileName andnote/draft
to draftTag, and those were then used in the File step. However, it seemed simpler to combine them all into a single File step; however, you might choose to use these extra steps if you edit the action, and you might even use Script steps to get fancy.
File
Bookmark
Directory
I submitted this action to the Drafts Directory as unlisted, so it’s only available from this private URL for Add to Obsidian. After receiving additional feedback and further experience, I plan to make it available in the public directory.
I tapped Share to publish my unlisted action in the Draft Directory.
I received this confirmation after the update. I copied the private unlisted link to included in this documentation. When someone uses that link to view the action, they see the name, description, and steps with a button to Install it in the Actions app on their system.
The Drafts Directory section reflects its current status with options to view, update, or remove.