Add option to to save and reuse custom formulas vault-wide

Use case or problem

I want to save custom formulas for easy repeated use in bases across my vault.

When working with bases, I often want to use the same formulas repeatedly across different custom properties in multiple notes.

For example, formulas like:

  • file.folder.replace(this.file.folder + "/", "") to show relative paths to the current MOC path
  • file.folder.replace(this.file.folder + "/", "").split("/")[0] to extract the first folder level

I have to find where I used it before and copy/paste it manually to a new custom property

Proposed solution

Add a “Formulas Library” feature where users can:

  • Right click on a custom formula to “add to Formula Library”, it adds an entry to the name (must be unique)
  • The saved formulas are suggested to the user in the bases properties, they appear in file, embebed and code-block bases.
  • Edit or delete saved formulas from the library (maybe in Settings → Bases)

Current workaround (optional)

I keep a note with my most-used formulas and copy-paste them manually each time I need them.

4 Likes