Templater <%...%> commands not rendered

What I’m trying to do

I installed templater plugin in Obsidian on Ubuntu. The button of side bar works. However, any <%…%> commands are not rendered in note.

Things I have tried

I checked the plugin setting and I am sure it’s working.

Any one know what’s possible reason that the commands are not rendered?

Thanks a lot!
Derek

I found the reason, I cannot type the code. I have to use templater button to insert code.

Please close this thread. Thanks.

You can type the code in an note, and then have Templater replace it using the “replace templates” command. However, if you want to execute javascript, you need to use an asterisk in the command opening:

<%* your code %>

In this case (execution commands), you also have to explicitly return the template results using tR = your output, or by defining varibles, and putting them in an interpolation command:

<%* 
const myTitle = tp.file.title;
%>

<% myTitle %>
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.