Define/use variables across Notes?

I'm looking for a way to assign a value/string to a variable that can then be referenced by any note such that the rendered markdown used the value of the variable at the time the note was rendered. I'd be happy with defining the variables in a centralized note, a separate file (json, csv, yaml, etc) or in userstyle.css. Any thoughts on how this can accomplished?

3 Likes

Should be implemented as a plugin

Indeed it's a good idea for a plugin.
I'll give it a thought to see how can I implement it on a plugin.

3 Likes

I'm already working on the plugin. You can see my progress on the Dev branch from my repository:

I wonder what's the use case for this?

1 Like

I use Joplin as a CMS to document procedures. I currently have approx 2,000 of these. Family members and team members access these regularly. The vast majority of these notes contain frequently used information that periodically changes (e.g., ip addresses, file names/directories, parameters, sometimes passwords (small trusted group...let's not go down the rabbit hole of discussing security). Currently, I use a Windows App (Advanced Find/Replace) to find/replace to try to keep everything current, but this is error prone. If I can, instead, use a variable that updates at the time the note is referenced, change it one place and everything stays current.

I've also been tinkering with interfacing Joplin with Node-RED and Home Assistant. If I configure a script to write state information to a file (i.e., define specific parameters in a centralized spot), I can easily publish different status reports for different people that are current at the time they access the report.

I think this capability expands the utility of Joplin greatly.

1 Like

I released the first version of the plugin!

Right now you can only manage the variables using a panel, but I'm thinking a way to export/import your variables from a json file.

Try the plugin and let me know your thoughts. It should be available on the official plugin list soon so you can install it directly form joplin.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.