What I’m trying to do
I created a script that uses selected text in the note as input, using tp.file.selection()
. I would like to, after the script ran, delete the selected text.
Assume the following note, before I run Templater. Mind the the selected text as it is indicated below:
People:: <% tp.user.formatPeopleList(tp.file.selection()) %>
(all the text below is selected)
Bob Marley <[email protected]>; Jane X Doe <jane[email protected]>; John A Smith <[email protected]>
After running the Templater script, I get this, which is perfect for me, EXCEPT the remaining (still selected) original text:
People:: [[Bob Marley]] - [[Jane X Doe]] - [[John A Smith]]
(the text below is still selected)
Bob Marley <[email protected]>; Jane X Doe <jane[email protected]>; John A Smith <[email protected]>
Ideally, I would like this outcome instead:
People:: [[Bob Marley]] - [[Jane X Doe]] - [[John A Smith]]
Things I have tried
I have tried to add a second call to Templater, this time to delete the selected text. But I do not know if Templater can do it. I read the documentation but I was not able to figure this out. I have tried stuff like this…
People:: <% tp.user.formatPeopleList(tp.file.selection()) %>
<% tp.file.selection().delete %>
Help would be greatly appreciated!