Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload Obsidian template plug-in #17

Closed
pancan21 opened this issue Nov 26, 2020 · 6 comments
Closed

Overload Obsidian template plug-in #17

pancan21 opened this issue Nov 26, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@pancan21
Copy link

pancan21 commented Nov 26, 2020

  1. When using the DailyNotes plug-in the Overload works as expected. However with the internal template plugin or external plugins like the Calender the Overload is not triggered. This results in all Templater templates not being replaced.
  2. When using Alt+E all {{date}} {{time}} are not being replaced without specifying user defined templates.

It would be nice to have a general Overload triggered for all of this plugins. Or at least support all the native templates of the Obsidian templates like {{date}} {{time}} so the plug-in can replace the internal template creation while using the same syntax.

I know that {{tp_today}} can replace the functions however it makes basic templates not usable in the Templater workflow.
For now I was helping myself by adding custom commands for {{date}} {{time}} but I think it could be good to have this implemented for everyone. Especially as this workaround can not serve all formats like {{time:HH:mm}} to my knowledge.

Sorry if I missed something out. Just started using Obsidian 👍

Issue accuring on Windows 10 using
Obsidain 0.9.15
Templater 0.4.2

@pancan21 pancan21 added the enhancement New feature or request label Nov 26, 2020
@SilentVoid13
Copy link
Owner

Hey @pancan21, sorry for the late response.
I agree with you that a global overload would be cool. Unfortunately that's not possible or I would have to overload each function for each plugin manually in my code, and that's just not sustainable in the long term.
For the Templates core plugin, the idea of Templater is to kinda replace it. Everything available in the core Templates is available in Templater (including date / time formats, check arguments in internal templates), you shouldn't have to use the Templates core plugin anymore.

@pauljacobson
Copy link

@SilentVoid13 I just noticed the "Overload" option for the plugin. How does that work? Does this enable me to add a Templater field to my Daily Notes template, and have that become active? So, for example, I could add the weather option to my usual Daily Note template, and have that render a bit like I suggested in #10?

@SilentVoid13
Copy link
Owner

SilentVoid13 commented Dec 2, 2020

@pauljacobson Yes exactly ! That's why i closed your suggestion.

@pancan21
Copy link
Author

pancan21 commented Dec 3, 2020

@SilentVoid13 I have a idea how to prevent to make an overload for every function.
How about making the Overload function/Templater availible for the current document or better current selection to trigger the replacement for all {{templates}}? I was thinking about a keyboard shortcut for example.
This should work from my point of view and not create this long term support issue that you mentioned.

@rapatel0
Copy link

rapatel0 commented Dec 13, 2020

Sorry maybe i'm missing something, but wouldn't it be possible just to overload {{date}} and {{time}} as keywords in templater. Just render them with the same basic logic that obsidian employs? I haven't started digging into Obsidian functions, but I expect that you would either just need to have access to the internal time lib or perhaps just all the internal function used to render '{{date}}' and '{{time}}. Not sure however, if it's exposed

I just want to point templater at my existing directory of templates, and use it as the full replacement, and not manually rename all the keys and formatting. Seems like obsidian only has the two keywords (date and time), and there should be no conflict I if i'm just invoking templater.

@SilentVoid13
Copy link
Owner

Hey @rapatel0, you can use {{tp_date}} and {{tp_time}} as a replacement in your templates.
I don't want to overload {{date}} and {{time}}, because I don't want plugins to conflict with each other.
Even though using the Templates core plugin along with Templater is unlikely, since Templater does everything the core Template plugin does, I prefer to avoid imposing an overload to users.
If you really want to use {{date}} and {{time}}, then don't use internal templates and define them as custom templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants