shabegom / buttons

Buttons in Obsidian
The Unlicense
455 stars 47 forks source link

Templater User Scripts not working when generating new Note from button #132

Closed AlbertoEE closed 5 months ago

AlbertoEE commented 1 year ago

When trying to create a new note from a button (the name of the note is generated via templater script) the button shows random behavior.

My script just generates a random string in a concrete folder, I already tested it and it works 100%.

This is the button code:

button
name Add Session
type note(<% tp.user.my_script() %>, split) template
action Idea
templater true

1- After clicking the button it generates a new note with the following name <% tp.user.my_scripts(tp 2- If you check the Button code now it looks like this ->

button
name Add Session
type note(Areas/Gaming/D&D/Sessions/asdas) %>, split) template
action Idea
templater true

It looks like first, it tries to create the note, and then the script is executed.

Maybe it's related to how the plugin parses the parenthesis in the type note line.

Is this only happening to me? Anyone else?