DominikPieper / obsidian-ReadItLater

MIT License
449 stars 35 forks source link

Change When The template variables are consumed to allow templater plugin's tp.file.include #184

Open rhhub opened 5 days ago

rhhub commented 5 days ago

⚠️ Please check that this feature request hasn't been suggested before.

🔖 Feature description

I want to be able to place ReadItLater template variables inside markdown templates and include them using the templater plugin. Is it possible to resolve the ReadItLater template variables after the tp.file.include() are called?

link to templater plugin.

Currently

The tp.file.include() call works fine in this case but I can't place templater variables inside markdown templates because they end up unchanged in the final note.

ReadItLater Youtube note template:

---
<% tp.file.include("[[_common_yaml_template]]") %>
url: %videoURL%
channel: %channelURL%
---
## Video
%videoPlayer%

✔️ Solution

Is there a way to consume the template variables after the templater calls resolve?

ReadItLater settings Youtube note template:

<% tp.file.include("[[youtubeTemplate]]") %>

youtubeTemplate.md:

---
<% tp.file.include("[[_common_yaml_template]]") %>
url: %videoURL%
channel: %channelURL%
---
## Video
%videoPlayer%

❓ Alternatives

No response

📝 Additional Context

No response

adamluckdev commented 2 days ago

Do you have enabled option "Trigger Templater on new file creation" in Templater plugin settings? Maybe that's because your templater syntax is not replaced.

rhhub commented 1 day ago

Yeah it's enabled. The templater plugin syntax does get replaced (I didn't provide the output). If I put ReadItLater template variables in the templater plugin markdown file, they won't get replaced.

adamluckdev commented 1 day ago

Thanks for the clarification, now I fully understand your issue.

Basically we need to invoke Templater logic, before ReadItLater starts to replace variables in template.

rhhub commented 1 day ago

Yeah.