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
So I’m trying to set up a code in my daily note template that will automatically generate a list of tasks based on any instances of a certain hashtag in my vault, along with the line of text that accompanies said hashtag. So ideally I’d get:
- [ ] #Tag lorem ipsum blah blah blah
- [ ] #Tag More lorem ipsum
Etc.
I don’t want it in a Dataview/Query style list, unless the tasks can be added to my “Tasks Completed Today” list at the end automatically, I use a very simple code there like so:
tasks
done on 2023-07-12
Things I have tried
Got some help on the Discord, I’ve tried reading about Templater and Dataview, and the code I have so far should be able to find instances of my hashtag, #Next, throughout my vault:
<%* app.vault.getMarkdownFiles().forEach(file => {
if (tp.file.include("#Next")) {
}
}) %>
… But I cannot figure out how on Earth to retrieve the line of text AFTER these tags, and then to add that to the document in the format of a task. Extremely frustrated after trying to figure this out a couple days.
The normal way to do this is to simply tag the task directly with #next. This way the task is simple to fetch, and you don’t need to mess around with reading the next line in a file and so on.
Hey holroy, thanks for taking the time to reply,
That wasn’t exactly what I was looking for-- I tried using recurring tasks but that was cluttering up the files that contained them with repeats for every day-- hence what I wanted was something that could grab normal lines of text with the hashtag and create tasks from them.
Someone in the Discord was very kind and helped me figure it out, I’ll post the sum of the code they put together in case it helps someone else: