KevinBatdorf / obsidian-raycast

Raycast extension with commands for the note taking app Obsidian.
MIT License
106 stars 19 forks source link

Can template be used in the default note name? #17

Closed zcysxy closed 2 years ago

zcysxy commented 2 years ago

Hi, thanks for this amazing extension! I downloaded Raycast just for your extension 🤣

I wonder if I can use some basic templates, like {{time}}, in the default note name, prefix for append, etc.? The use case is that I use this extension to quick capture things that I don't want to spend time naming them, yet I still want to log the time.

marcjulianschwarz commented 2 years ago

Hi @zcysxy,

thank you so much for the nice feedback 🔥

Right now templates are not supported. However you could use the Obsidian Plugin Templater. It can automatically rename new notes based on a template that you store in a folder in your vault.

For people not very familiar with Templater or plugins in general it might be a good idea to support some basic templates and I would love to implement those in the Create Note command and the default name, prefix for append, etc.

These are the ones I could think of:

Do you have any more suggestions for templates? Maybe even templates for the content of the note?

zcysxy commented 2 years ago

Hi @marcjulianschwarz, thanks for the reply. I use Templater and it would be great if the new note creation triggers Templater. However, on my end, the new notes created by the extension will not trigger Templater.

And for extension built-in templates, I think your comment is very thorough; I have nothing to add for now : )

marcjulianschwarz commented 2 years ago

Hi @zcysxy,

I just found out that Templater will only be triggered if Obsidian is running. That's not ideal, maybe I can create a feature request at Templater to not only listen for note creation but additionally listening for new files (e.g. on startup). This could however create problems with templates where you use the current time.

Will let you know when the suggested templates are available.

marcjulianschwarz commented 2 years ago

Got it working, added the mentioned templates in my local repo.

The feature will be released with the next update.

marcjulianschwarz commented 2 years ago

I have just pushed the templates, see e0c0334d2d6bf58c102f9e26ffc162ece1d904f5. You can try it out by cloning this repository, running npm install and then npm run dev.

I followed the syntax that was introduced with the newest version of Raycast which is {template}. Templates work in both the filename and content.

Current list of available templates:

zcysxy commented 2 years ago

Works like a charm! Thank you!