This plugin allows you to add custom URI commands to the command palette. Can be used with the Obsidian URI scheme, as well as any other URI scheme your computer supports.
You can use the placeholders below in your URI. All of these are URL-encoded for you unless you turn off URL-encoding, so you don't need to worry about your text having any unescaped illegal or reserved characters.
All commands with placeholders are hidden when there is no active file.
Placeholder | Description | |
---|---|---|
{{fileName}} | Just the base name of the file, without the filepath or file extension. | |
{{filePath}} | Path, relative to the vault, to the current file. E.g. FolderName/filename.md |
|
{{fileText}} | Entire contents of the file, including frontmatter. Available only in markdown files. | |
{{selection}} | Your current selection. If nothing is selected, placeholder is replaced by the empty string. | |
{{line}} | Current line. | |
{{vaultName}} | Name of the current vault. | |
{{meta:FIELD_NAME}} | The value of the metadata field corresponding to FIELD_NAME. Note that if there are multiple values in one field (as a comma-separated list or [array]), the values in the field will be inserted in the URI as a comma-separated list. Requires MetaEdit. |
- Open the vault
work vault
:obsidian://open?vault=work%20vault
- Open the note
hotkey reference
in the vaultmy vault
:obsidian://open?vault=my%20vault&file=hotkey%20reference
- Append your selection to today's daily note (requires Advanced URI plugin):
obsidian://advanced-uri?vault=&daily=true&data={{selection}}&mode=append
- Open this plugin's settings page (requires Hotkey Helper plugin):
obsidian://goto-plugin?id=uri-commands&show=config
- Open an email draft of your current note in your mail client:
mailto:friend@example.com?subject={{fileName}}&body={{fileText}}
- Email your current note to Roam:
mailto:me@sendtoroam.com?subject={{fileName}}&body={{fileText}}
- Open a spotify album:
spotify:album:4niKC11eq7dRXiDVWsTdEy
- Open a new HackMD collaborative markdown pad:
https://hackmd.io/new
- Note that for websites, you must start your URI with
https://
orhttp://
, notwww.
- Note that for websites, you must start your URI with
- Open the wikipedia page for the contents of the YAML field "topic":
https://en.wikipedia.org/wiki/{{meta:topic}}
- Look up your selection in your Calibre library:
calibre://search/_?q={{selection}}
- Open the url in the "external-link" metadata field:
{{meta:external-link}}
- Note that for this to work, URL encoding must be turned off
- Advanced URI: enables URIs for daily note, appending text to a file, jump to heading, search and replace, and more
- Hotkey Helper: enables Obsidian URIs for plugin READMEs, settings, and hotkey configurations
For more information on URIs in Obsidian, see the Obsidian documentation. An incomplete list of other URI schemes can be found here.
Parts of this code, especially the icon picker, borrow heavily from phibr0's plugins, including Obsidian Macros and Customizable Sidebar.