Advertisement
dhniceday

Untitled

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