Commands
There are two ways to identify a command.
commandname
That's the one you see when searching in Obsidian's command palettecommandid
That's invisible to the user, but can be read from the plugin's source code
info
Using the command's ID is strongly recommended, because it's not likely to change. Using Helper Commands the ID is automatically obtained.
In the following <command>
can be replaced with either commandname
or commandid
.
parameters | explanation |
---|---|
<command> | Executes command by its name |
<command>, <identification> | Opens file and then executes command by its name |
<command>, <identification>, line=myline | Opens file, sets the curosor to myline and then executes command by its name |
<command>, <identification>, mode=append | Opens file, adds empty line at the end and sets cursor, then executes command by its name |
<command>, <identification>, mode=prepend | Opens file, adds empty line at the beginning and sets cursor, then executes command by its name |
<command>, <identification>, mode=overwrite | Opens file, clears the file, then executes command by its name |
Example
Close specific tab by its filepath:
obsidian:?vault=<your-vault>&filepath=<your-file>&commandid=workspace%253Aclose
To explain this example: It first switches to the tab specified by filepath
and then executes the command Close current tab
by its ID. Resulting in the ability to close any tab by its filepath.