Insert Text At Placeholder In Note

Screenshot of the action

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

A "placeholder" is a one-line comment: 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.

The %%placeholder%% style is used in the body of the note, the #placeholder# style is used 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 %% or # is omitted), the action will enclose the placeholder in %% percent signs. However, it is recommended not to omit them.

This action will throw an error if the specified note doesn't exist, so it's best to use it after the "Check For Existence Of Note" action has determined that it does exist.


Available Options

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".


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.



Changes / History

v1.2

Adds support for YAML-compatible placeholders, i.e. #placeholder# .

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Carlo Contact Carlo