Nested and globally available user script #1511
YlanAllouche
started this conversation in
Templates Showcase
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
I don't know how obvious this is to everyone but you can call user modules from other user module once you pass the
tp
object as a context.This allows breaking down functions into reusable atoms.
Even better, because Templater registers the CommonJs module in the script folder into the API, it means those modules are also globally available from anywhere else making Templater probably the best way to expose the Obsidan API in order to build a personal repository of functions without necessarily relying on a custom plugin.
For example: the content of
scripts/myJSfile.js
:then
scripts/second.js
with this content.then in template
But this also works anywhere in obsidian:
I have a write up here to explore that and more (it's also great for remote execution).
Beta Was this translation helpful? Give feedback.
All reactions