Command
The pochoir-command code block allows you to trigger a template from the command palette and/or a ribbon.
You need to enable pochoir-command code block in plugin settings.
For example, let's add a ribbon action to create a new unique note from [[Unique note template]]:
```pochoir-command
id: create-unique-note
title: Create unique note
icon: file-pen
action: create
trigger: ribbon
```
Attributes
The code block only accept the disabled attribute to ignore it.
Options
id
Useful if you want to trigger the command from another plugin.
If not provided, it is generated from title property or template basename.
Warning
It is recommanded to write your id in kebab case
for consistency with others Obsidian Commands
and must be different with other templates.
```pochoir-command
id: create-unique-note
```
title
This is the command title used for the command palette and the ribbon action.
If not provided, it is generated from template basename.
```pochoir-command
title: Create unique note
```
icon
Set a lucid icon for the ribbon action.
If not provided, file-question-mark is used.
```pochoir-command
title: Create task
icon: square-check-big
trigger: ribbon
```
action
Configure how to apply the template.
Values accepted (by default, the value is create):
- create
- insert
```pochoir-command
title: Insert task
action: insert
icon: square-check-big
trigger: command
```
trigger/triggers
Configure how to trigger your command. It can be a text or a list of texts.
Only two values are accepted: ribbon and command. By default, the value is command.
Tip
To prevent errors, trigger and triggers options are equivalent and both accept a text or a list.
For example, to register a command with two triggers:
```pochoir-command
title: Create task
icon: square-check-big
triggers:
- ribbon
- command
```
and another example, with a single one:
```pochoir-command
title: Create task
trigger: command
```
template/templates
TODO
```pochoir-command
title: Replace selection
action: insert
trigger: editor-menu
template: selection()
```
```pochoir-command
title: Insert from clipboard
action: insert
trigger: editor-menu
template: clipboard()
```
```pochoir-snippet name="My snippet" id="my-snippet"
hello world
```
```pochoir-command
title: Insert from clipboard
action: insert
trigger: editor-menu
template: snippet(my-snippet)
```