Applying OOP into note-taking

Hello friends!
I am a newbie to obsidian and i am aware that you can create a note from a pre-defined template. My problem is that sometimes my note can be a ‘hybrid’ of multiple template so this prompted me to come up with the idea of creating a plugin that lets you create a note out of multiple templates. Basically, it is similar to the idea of Multiple Inheritance in OOP. I couldn’t find any information on this.

Is there an existing plugin that does this?
If not how do i get started to create this plugin?

1 Like

Have you looked at the Templater community plugin? I don’t know if it does this but it sounds like something it would do.

As an avid Templater user, I can confirm this is possible with the Templater plugin.
You can just specify <% tp.file.include() %> template instruction inside of your template where/when you want the sub-template to be interpreted.

Something like this.

*Note for this note was created on [[<% tp.date.now("ddd - MMM DD YYYY") %>]]
---
<% tp.file.include("[[My Included Template]]") %>
> ![INFO] Did you know?
> <% tp.file.include("[[Info Inner Info Template]]") %> 

These can be embedded within each other so that [["My Included Template"]] or [[Info Inner Info Template]] can have included templates within them as well.
When your root template is applied to a note, the Templater plugin will interpret each in turn, starting with the root template.

I hope this helps.

3 Likes

Very basic use of tp.file.include, but posted this the other day:

1 Like

Hello, I had this thought. But actually imitating the oop programming style to write notes, I feel as uncomfortable as writing a draft for matrix and calculus in laTeX。