I’m positively surprised that you got the template stuff to work within a button, I’ve raised an issue and the plugin developer said (my words) that it didn’t always work, so they suggested using a template instead.
And with regards, to your request to add multiple lines, I think you’ll get better result if you add a template instead of a text. In other words, make yourself a template like, newNoteButton:
<% tp.date.now() %>
And then use a button like:
name add value
type note(<%"my_folder/" + tp.date.now("X")%>, split) template
Then you can add as many lines as you want, keep the button “clean”, and have a stable output. I’m not sure whether the “, split” is the best variant, as it keeps splitting my window in two, but I’m not sure what the alternatives are.
The button issue known to me with templater true and type [append|prepend|line] ... text - that is all kind of operations on the note where the button lives in, let’s name it “button’s note” - is:
Clicking the button does execute all the Templater commands in the button’s note, but immediately after that the content of the button’s note as it was before clicking the button is restored again. So, you just see some changes in the note flickering and gone. That’s a kind of feature but only if you want to go your text into another note (i.e. type is note, and not [append|prepend|line]):
The command will be converted to its value when the button is clicked and converted back to the command after.
If you’re operating inside the button’s note, then it’s a feature killer. Besides of that, it does collateral damage on the rest of your note if there are Templater commands in other places - even if the Templater commands are in other buttons.
Thanks for the template suggestion. That’s a valid option. But with a drawback in my use case: the name of the new note to create is dependent on data in the button’s note - (not as in the snippet given by me above; I simplified my use case for the purpose of this forum post). The text I want to go into the new note is dependent on data in the button’s note, as well. That’s why I prefer to keep all my Templater commands affecting the new note in one place; here: in the button code block.