Skip to content

Instantly share code, notes, and snippets.

@selfire1
Created February 20, 2022 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selfire1/af9b25f22939898c38b33f8826b50c5e to your computer and use it in GitHub Desktop.
Save selfire1/af9b25f22939898c38b33f8826b50c5e to your computer and use it in GitHub Desktop.
Appending to Daily Notes in Obsidian

<%* // Append to Daily var dailyDate = "DATE"; //date of the daily note to append to/create (eg."2022-05-20" or 'tp.file.now("YYYY-MM-DD")' const append = * TEXT; //text to append

const folder = app.vault.getAbstractFileByPath("20 Journals"); if (!tp.file.exists(dailyDate)) { await tp.file.create_new(append,dailyDate, false, folder) } else { const originalContent = await app.vault.read(tp.file.find_tfile(dailyDate)); const contentNew = ${originalContent}\n${append} await app.vault.modify(tp.file.find_tfile(dailyDate), contentNew) } *>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment