Reference

Runtime Variables

Template variables available when an action is rendered and executed.

Before an action runs, the plugin renders its code with Mustache. These variables come from the current vault, active file, editor state, and execution time.

Example

echo "Processing {{{file_name_with_ext}}} at {{time}}"

Variable Reference

VariableDescription
pathAbsolute path to the active file when available
relative_pathPath relative to the vault root
extensionActive file extension
readonlyWhether the editor is read-only
selectedSelected editor text
selected_lowerLowercased selected text
selected_upperUppercased selected text
length_selectedCharacter count of the selection
word_countWord count of the selection, or the full editor content if nothing is selected
line_indexCurrent zero-based line index
column_indexCurrent column index
vault_nameVault name
file_nameFile name without extension
file_name_with_extFile name with extension
contentFull editor content
content_lengthCharacter count of the editor content
timestampISO timestamp for the current run
dateLocalized date string for the current run
timeLocalized time string for the current run
hello_worldTest value used by the settings UI during manual execution

Notes

  • Variables may be empty when there is no active file or editor.
  • The same variables work in both js and shell actions.
  • Use triple braces such as {{{path}}} when you want the raw rendered value.

On this page