Advertisement
dhniceday

_toDo

Jan 14th, 2023
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%*
  2. const logHeader = "## To Do"
  3. const file = tp.file.find_tfile(tp.date.now("YYYY-MM-DD"))
  4.  
  5. if (file) {
  6.     loggedItem = await tp.system.prompt("ToDo")
  7.    
  8.     const content = (await app.vault.read(file)).split("\n")
  9.     const index = content.indexOf(logHeader)
  10.        
  11.     let addContent = "- [ ] #todo " + loggedItem
  12.     content.splice(index + 1, 0 , addContent)
  13.     await app.vault.modify(file, content.join("\n"))
  14. } else {
  15.     new Notice("No daily note found.")
  16. }
  17. -%>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement