Introducing "Obsidian Live Variables" Plugin: Simplify Data Management in Your Notes

Hello Obsidian community!

I’m excited to introduce a new plugin I’ve been working on that brings a powerful coding concept into the realm of note-taking.

What is it?

Obsidian Live Variables is a plugin designed to help you efficiently manage and reuse data within your notes. By allowing you to define variables directly in your note’s properties, this plugin ensures that any changes you make to these variables are automatically reflected across all instances in your note. This feature is especially useful for maintaining consistency and saving time when dealing with frequently updated information.

Key Features

  • Dynamic Variable Management: Easily define and update variables within your note’s properties. All instances of these variables in the note will update automatically, ensuring consistency.
  • User-Friendly Interface: The plugin offers an intuitive setup and management system for variables, making it accessible even for those new to coding concepts.
  • Markdown Support: You can define variables with markdown styles, and this formatting will be preserved wherever the variable is used in your note.

How to Use

  1. Install the Plugin:

    • Download the plugin from the GitHub repository.
    • Place the plugin folder in your Obsidian plugins directory.
    • Enable the plugin through Obsidian’s settings.
  2. Define Variables:

    • Open the note where you want to use variables.
    • In the note’s properties, define your variables. For example:
      ---
      projectName: Obsidian Live Variables Plugin
      dueDate: 2024-12-31
      ---
      
  3. Use Variables in Your Note:

    • Insert a variable by using the command Live Variable: Insert live variable and then select your desired variable.
  4. Update Variables:

    • Modify the values in the note’s properties, and all corresponding instances of the variables in the note will be updated automatically.

Contributing

Contributions are highly encouraged! If you have ideas for new features or improvements, feel free to open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License.


I’m looking forward to your feedback and hope this plugin enhances your Obsidian experience!

1 Like

That could be a fun MadLibs. :slight_smile:

1 Like

It doesnt work in code blocks.

var=var+1

This plugin is not designed to work in code blocks.
Please explain your use case in details and I’ll try to implement it

Its actually quite useful for using it for Lab SOPs.
In lab “Standard Operating Procedure” you have a certain workflow for an experiment. But sometimes you need to change the amount of a compound. It would be amazing to be able to change the variable in your tool and then use it in code blocks with Plugin “Numerals” to recalculate values, but also update the text (this does not work with Numerals).

Best :slight_smile:

1 Like

Hi @Sharpie6935, thanks for the suggestion, I am currently working on this feature, one of its uses will be inserting variables inside code blocks and re-rendering them once the value is changed, this will be released soon.

Here is a demo of the feature
ezgif-4-64c853d93f

2 Likes

I released a beta version here, and I can use some of your feedback before the final release.
Thank you.

Hi, thanks for the effort it is good plugin so far I have really high hopes.
It works nice and could soon become a great alternative to the Dataview plugin.
Tested Custom JS Functions so far and it works like a charm, I can refer my notes parameters and make operations on them so that changes are visible live.
One important feature is still missing however when it comes to query variables (or I simply couldn’t find it yet).
Namely when I create a note from the templater; Custom JS function still works but it does refer to the variables located in the template not to the variables in the newly created note. So IMHO it cannot be feasibly used with templates yet.
Good luck with further development.

1 Like

Hi @axjankow, I also use Templater and understand the need for the feature you’re mentioning. It was initially planned to be part of the query variables feature, where local variables would be listed before any others. However, there’s currently an issue with the code. I’ll work on fixing this before the final release.

Thanks for your feedback!

1 Like

I released a new version handling this issue: 2.0.0-beta.1
Changelog:

  • Local Variable Suggestions: In the Query Variables form, local variables are now prioritized over vault-wide variables and resolved relative to the file they are in. For Templater users, this means when a note is created from a template, variable references will pull values from the note’s properties rather than the template’s.
  • Code Block Language Support: Added support for specifying code block languages.
  • Error Message Improvements: Enhanced error messages for argument-related errors to provide clearer feedback.
  • Code Cleanup: Refactored and cleaned up the codebase for better maintainability.
1 Like

Thank you for making this !!! I think a lab SOP will be a great use too!! I second the use! I am wondering if latex text is supported as a property and will it be rendered properly? I am trying to write a manuscript and I am thinking if I can use this to make text holder for text… I guess another option is to use clean inline embeds but I couldn’t get the CSS to work properly…

1 Like

Hi @edgie, thank you for the positive feedback.
I am not familiar with rendering Latex in Obsidian, does it get rendered natively or using a plugin ? I believe that you can do almost everything with the Dynamic Code Block and Custom JS Function features, and I can guide you on how to achieve what you want if you can explain in more details.