I am trying to figure out how to run JavaScript code in Obsidian

Well, there is not much to see in there.
If anything, I showed a different plugin at work.

As for the problem, I recommend to check templates for syntax from the oft-cited SoRobby demo vault:

Actually, I recommend downloading the zip from the main page…

…and adding the vault to Obsidian for testing, getting ideas, etc.

The basic things to remember is that when you want to run arbitrary Javacript, you need this syntax (well, I have tp function here, but I wanted to show a one-liner):
<%* tR += await tp.user.getAliases(title) %>
Other times you don’t need the asterisks.
See docs:

I tried to search for wrapper in the docs but no results. People on this forum often call those bits around the code wrapper.

1 Like