Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@FTWynn 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