Skip to content
Actions for Obsidian icon Home Actions for Obsidian 2024.1.3 › Actions

Actions for Obsidian › Actions › Insert Text At Placeholder In Note

Searches for a specified placeholder and either adds text above, below, or replaces it entirely.

Parameters

Vault

The vault to work in.

Type: Vault reference

File Path

The path of the note, relative to the vault root.

Type: Text

Placeholder

A “placeholder” is a one-line comment in a Markdown note: a piece of text enclosed in double percent signs, e.g. %%My Placeholder%%. Since Obsidian does not render the comment outside of edit mode, it is perfect for marking places in a document where text can be added later.

Use the %%placeholder%% style in the body of the note, and the #placeholder# style in the front matter (which is YAML and not compatible with Markdown’s percent style).

If the placeholder parameter doesn’t contain any delimiters (i.e., if the double percent or the hash sign is missing), the action will enclose the placeholder in double percent signs. However, it is recommended not to omit them.

Type: Text

Optional Replacement

The replacement text, i.e. the piece of text you want in your note instead of the placeholder.

Type: Text

Allow empty replacement

When enabled, your replacement can be blank, which would effectively just remove the placeholder from the note.

Type: Boolean (YES/NO)

Where should the text be inserted?

The text can be placed above the placeholder, below it or it can replace the placeholder entirely.

Hint: When adding items to a list, and you want to add new items to the end of the list, select “above placeholder”; if new items are supposed to go to the top of the list, select “below placeholder”.

Options:

  • above placeholder
  • below placeholder
  • replace placeholder

Open or focus note

If enabled, after a successful operation, the note will be brought to the front in Obsidian.

Type: Boolean (YES/NO)

Examples

Suppose you have a note Placeholder demo.md with the following content and a placeholder %%placeholder1%%. We’ll insert the texts text 1, text 2, and text 3 in sequence.

## Headline 1
%%placeholder1%%
## Headline 2
something else

Inserting above the placeholder

The result would be:

## Headline 1
text 1
text 2
text 3
%%placeholder1%%
## Headline 2
something else

Inserting below the placeholder

The result would be:

## Headline 1
%%placeholder1%%
text 3
text 2
text 1
## Headline 2
something else

This is because after text 1 is inserted, text 2 is placed directly below the placeholder (as it should be), i.e. in-between the placeholder and text 1 .

Replacing the placeholder

The result this time:

## Headline 1
text 1
## Headline 2
something else

The first insertion replaced the placeholder, and text 2 and text 3 have nowhere to go.