Sebastian Ärleryd's Website

In Obsidian, you can write js= 1+1 and get it displayed as 2.

That’s super useful!

Every so often, I write a note with some form of calculation in it. Perhaps I’m adding up time spent, the sizes of files, or spending for an upcoming vacation. In these cases, it’s super useful to have Obsidian actually do the math for me, right there in the note. With this, we can script our Obsidian note-taking with JavaScript right there embedded in our notes! No separate files needed.

And if I have to adjust the numbers, the results are immediately updated.

For this I’m using the Dataview plugin with the “JavaScript Inline Query Prefix” set to “js=”. I found that to interfere less with my note-taking than the default.