mo-seph / obsidian-note-from-template

Simple plugin to create Notes from a template, and fill in fields defined there
MIT License
107 stars 9 forks source link

[Feature Request] `Destination`-> Active Note at Caret Position #8

Closed FelipeRearden closed 2 years ago

FelipeRearden commented 2 years ago

Hello @mo-seph !!!!!!

My first FR for this amazing plugin is easy to explain: insert the content of an template in the active note in the caret position !!!!

My Workflow

I use a lot of tables in my notes in Obsidian. And its a hard job to fill every cell of a table :(

My idea is to use your plug-in to help me with this

This is my template note with my template table (I will have many of this with different tables layouts 2x2, 3x3, 5x5) 0

It's amazing because I can't fill my table just using TAB !!!!

1

What I miss is the ability to insert this filled table in the current note :( and continue to write in my note


I hope you like my FR! Let me know if you need any information

Have a great day!

mo-seph commented 2 years ago

Thanks! I think this sounds like something for the Templater plugin: https://silentvoid13.github.io/Templater/ See e.g. https://www.thoughtasylum.com/2021/07/24/the-basics-of-templater-for-obsidian/ for an intro.

That said, I can have a look whether dropping it straight into the current note would work as well - I don't see why not.

FelipeRearden commented 2 years ago

Thanks! I think this sounds like something for the Templater plugin: https://silentvoid13.github.io/Templater/

See e.g. https://www.thoughtasylum.com/2021/07/24/the-basics-of-templater-for-obsidian/ for an intro.

Thanks for the information and the resource about Templater!

I know Templater for a long time but it's in my TO-DO list to start studying (I'm s little bit scary, since I don't know how to code)

That said, I can have a look whether dropping it straight into the current note would work as well - I don't see why not.

Thank you very much @mo-seph for trying !!!! Would be an amazing feature for me :)

Have a great day!

mo-seph commented 2 years ago

I've just pushed a big new change. There's now field you can use in the template replacement string {{templateResult}} that will put the body of the new template in where the cursor is. If you set your template to always replace text (template-should-replace:always) and turn off creating a new note (template-should-create:never), and template-replacement:{{templateResult}} this should give you the behaviour you want.

mo-seph commented 2 years ago

Oops: template-should-create:none

FelipeRearden commented 2 years ago

Hello @mo-seph !!!!

Thank you very very very much !!!!!!!!!!!

It´s working perfect !!!!!!

This is my yaml in case anyone wants to try

template-should-create: "none"
template-should-replace: "always"
template-replacement: "{{templateResult}}"

Thank you very much! I'm so happy !!!

Have a great day!

FelipeRearden commented 2 years ago

Hello @mo-seph !!!!

Just to let you know that this template stopped working after version 0.1.9 :(

---
template-should-create: "none"
template-should-replace: "always"
template-replacement: "{{templateResult}}"
---

|{{A1}}|{{B1}}|
| -----|------|
|{{A2}}|{{B2}}|
|{{A3}}|{{B3}}|

I used this to insert the template in the active note on caret position

I hope you could give some help :pray:

Have a great day!