More Variables, Functions and Basic Scripting in Templates

Use case or problem

The current note templates implemented by the core Templates plugin are lackluster and fall short of community made alternatives like Templater. Attempting to do something as simple as insert tomorrows date into a note with a template is impossible. There are only 3 variables that can be accessed, the current date, the note title and the current time (date and time overlap completely using format strings). What about accessing a property of another note? Or only inserting some text if it is a specific date? Or any of the more advanced uses that could be thought of given the amount of date accessable within a common vault.

Proposed solution

The new Bases core plugin exposes various functions and types that can be used within custom filters and formulas. I believe that offering similar functions to users of the Templates plugin would improve the user experience and make it competetive with community offerings.

For the sake of user familiarity, I believe that the functions available within bases should maintain their current syntax. As an example of this, see a simple expression that could embed tomorrow’s date if placed within a template.

{{(now() + "1d").format("YYYY-MM-DD")}}

Or what about a line in a daily note that depends on the current day of the week.

{{if(now().format("dddd") == "Friday", "Happy Friday!", "Still not Friday :( ")}}

With how plugins are designed in obsidian, I do not forsee there being perfect overlap in what can be accessed by Templates compared to Bases. I however do belive that offering even a few functions and their respective types, like shown above, would do a world for the power of templates.

Addendum

I am open for further discussion on this as I think this is the right way forward for the Templates plugin which has hardly been touched since its addition. If even just the date and format functions were implemented in Templates, I would be able to completely rid my vault of templater. Over time as users become more familar with Bases, they will likely find it annoying that all of the information available within formulas and functions isn’t available in templates.