Skip to content
Actions for Obsidian icon Home Actions for Obsidian 2024.2.1 › 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

Note Lookup

Specify which note should be looked up or manipulated by the action:

  • "note": If you want to use another AFO action’s Note result, pick this option.
  • "note at file path": The full path of the note, should be used if you already know the full file path (including folder and file extension).
  • "note with UID": Use this if you are using unique identifiers for your notes, and you prefer to look them up by the UID.
  • the current Periodic Note (daily, weekly, etc.)

Options:

  • note
  • note at file path
  • note with UID
  • Daily Note
  • Weekly Note
  • Monthly Note
  • Quarterly Note
  • Yearly Note

File Path

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

Only available when Note Lookup is set to "note at file path".

Type: Text

UID

The unique identifier of the note. To configure the frontmatter key that is used for the lookup, go into Obsidian's settings, section "Community plugins", and find Actions URI.

Only available when Note Lookup is set to "note with UID".

Type: Text

Obsidian Note

A Note that was returned by another AFO action.

Only available when Note Lookup is set to "note".

Type: Note reference

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 frontmatter (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

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.