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 try to create a template to remove the content under a specific header in Daily Notes.
Things I have tried
<%*
const view = app.workspace.activeLeaf.view;
const editor = view.editor;
const header = “### New Heading”;
const headerRegex = new RegExp((${header}\\n)([\\s\\S]*?)(?=\\n## |$), “g”);
const newContent = tp.file.content.replace(headerRegex, “$1”);
tR = newContent;
%>
what this code does, is creating a new file with the const header empty and append it to the original one.
I can’t figure out how to deal only with the content under the heading.
I have a section with the task overdue (dataview) and 3 random notes to remind myself about that. This section is relevant only for the current day, so at the end of the day I want to remove those queries.