daledesilva / obsidian_ink

Other
464 stars 10 forks source link

Add handwritten note section to daily note template #65

Open marcaddeo opened 3 months ago

marcaddeo commented 3 months ago

I was wondering if there's a good way to add a handwritten note section to my daily note template? I tried just putting in the handwritten-ink code block, but it complains that ink file doesn't exist when I generate the new daily note.

marcaddeo commented 3 months ago

Okay, I was able to accomplish this with Templater by adding the following in my Daily Note template:

## Notes
<% tp.file.cursor(1) %>
<%* app.commands.executeCommandById("ink:create-handwritten-section") %>
daledesilva commented 3 months ago

There isn't currently a way to do that. But it's a good idea so I'll look into it! Thanks :)

daledesilva commented 3 months ago

Okay, I was able to accomplish this with Templater by adding the following in my Daily Note template:


## Notes

<% tp.file.cursor(1) %>

<%* app.commands.executeCommandById("ink:create-handwritten-section") %>

Oh. That's super interesting. I'll see if there's a way to make this more intuitive, or I'll at least document it in the on settings page for others.

marcaddeo commented 3 months ago

Okay, I was able to accomplish this with Templater by adding the following in my Daily Note template:

## Notes

<% tp.file.cursor(1) %>

<%* app.commands.executeCommandById("ink:create-handwritten-section") %>

Oh. That's super interesting. I'll see if there's a way to make this more intuitive, or I'll at least document it in the on settings page for others.

Yeah, it works! But it's a bit of a workaround, as it does have the caveat of messing with the cursor location. Without that, it gets placed at the top of the file. Having to do this may conflict with setting cursor position in other places in the file, but I'm not 100% sure as I'm not using it currently. So having the plugin handle it would be ideal.

Also, thanks for making this plugin! This functionality has been what's keeping me from switching to Obsidian, but now I'm making the move!

marcaddeo commented 1 month ago

Just an update on this, my original workaround ended up not being very reliable and would place the Ink section at the top of the note a lot of the time. This seems to work better:

<% tp.file.cursor(1) %> 
<%*
tp.hooks.on_all_templates_executed(() => app.commands.executeCommandById("ink:create-handwritten-section"));
-%>