First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.
What I’m trying to do
I’ve created a customized task bullet that automatically attaches relevant tags. However, when I input the task, I want to have the cursor placed where I’ll be defining the task (in below code, where ‘ZZZ’ is positioned). This has proven to be challenging. The templater code I’m using is
<%*
// Read the value of ‘Entity’ from the YAML frontmatter
const entity = tp.frontmatter[“Entity”];
const urgency = await tp.system.suggester(t => t, [“ASAP”, “Soon”, “No_Rush”]);
// Check if the entity value exists
if (entity) {
// Insert the tag with the entity value
tR += - [ ] ZZZ #${entity} #${urgency}
;
} else {
// Handle the case where the entity value is not found
tR += #UnknownEntity
;
}
%>
Things I have tried
I’ve tried inserting <% tp.file.cursor () %> into the code (as per Obsidian Templater documentation) but it doesn’t work for me. Am I missing something simple? Thank you!