Skip to content

Instantly share code, notes, and snippets.

@FTWynn
Last active February 13, 2023 13:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FTWynn/1ce114769381d2aed449739bf21c9d47 to your computer and use it in GitHub Desktop.
Save FTWynn/1ce114769381d2aed449739bf21c9d47 to your computer and use it in GitHub Desktop.
Shamelessly stolen from chhoumann/Templater_Templates, but trimmed down to fit the simple case of appending an Interstitial Journal to the Daily Note

<%* var now_time = tp.date.now("HH:mm"); var input = await tp.system.prompt(now_time + " - Interstitial Journal"); if (input == null) { return; } input = "- " + now_time + " - " + input; var filePath = tp.date.now("YYYY-MM-DD") + ".md"; console.log(filePath); if (await app.vault.adapter.exists(filePath)) { const file = await app.vault.getAbstractFileByPath(filePath); console.log(file); let original_fileContent = await app.vault.read(file); const fileContent = ${original_fileContent}\n${input}; await app.vault.modify(file, fileContent); } %>

@FTWynn
Copy link
Author

FTWynn commented Jun 15, 2021

Update: better title and handled escaping out of the prompt

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