Announcing Obsidian Wielder - Write & Evaluate Clojure inside your Obsidian documents!

This Obsidian plugin allows you to use the full power of Clojure directly inside of your documents in Obsidian! If you view documents with code blocks marked as clojure in the view-mode of Obsidian, this plugin will automatically run the code you have specified inside the block.

The plugin has just been accepted to the official “community list of plugins” so you can install it straight from Obsidian.

Here is a short video demonstration of what you can do:

Edit: not sure videos work to embed on this forum? In case it doesn’t work for you, you can watch the video here as well:

Wielder allows you to do anything you can do with JavaScript on a webpage, although with Clojure! So you can do anything from simple calculations to building fully interactive applications with React :slight_smile:

You also get access to the Obsidian API, so your applications can include lists of your Obsidian documents in the current vault, creating new pages from form elements and more.

Installation instructions for people who want to give it a try can be found here: 02-Installation - Obsidian Wielder

Or, just click this link and Obsidian should open the plugin page for you: Plugins - Obsidian

Once you have it installed, you can get started by reading through the tutorials written on the demo-vaults published website: 01-Introduction - Obsidian Wielder

The source code itself (MIT licensed) can be found over here: GitHub - victorb/obsidian-wielder: Clojure inside your Obsidian documents!

I’m eager to hear your feedback about it, any feature requests or just generally your thoughts about it!


Very cool! I started reading the tutorial and had the following question: if Clojure is interpreted by the JVM, where is that JVM coming from in Obsidian? I realize I could probably figure this out from the source code with enough staring, but I thought it’d be easier to ask here.

Additional for-fun questions: why Clojure out of all the functional or (I guess mostly-functional since some side effects are allowed?) programming languages there are these days? Are there specific activities where thinking functionally has been easier than the imperative version?

Cheers and thanks for making and sharing such a neat plugin!

Thanks @scholarInTraining!

if Clojure is interpreted by the JVM, where is that JVM coming from in Obsidian?

It’s actually using SCI behind-the-scenes, which is a Small Clojure Interpreter, so it’s not quite using JVM. Clojure exists in bunch of different “flavors”, one for JavaScript (ClojureScript), one for C# (ClojureCLR), one for JVM (Clojure) and so on, and you could say SCI is another one (not quite right, but simplified for the explanation).

why Clojure

Main reason is that I’m using Clojure as my main language for most things I do, and I guess I can say at this point, when I approach problems, I think in “Clojure” when I’m trying to figure out solutions. So Wielder is a natural addition to the tools I already use for thinking (Obsidian).

Secondary reasons are that the functional/immutable features of Clojure matches really well with the “code blocks in documents” model Obsidian offers, so your documentations don’t really rely on lots of mutation. It becomes a bit easier to reason about, at least for me.

What’s more, Clojure code tends to do a lot of things in small amount of “space” visually, the code tends to be kind of dense, compared to other languages. So you can “fit” more features into one codeblock compared to lets say JavaScript without it becoming messy.

But overall, I’d say the biggest reason is just because I really like Clojure and use it daily, so having it working together with Obsidian just makes sense.

1 Like

Fantastic, thank you for explaining! The official tutorial linked from your syntax guide did not make that clear at all in the portion of it that I read.

One other question/FR: do you have any control over the error message text in terms of making error messages clearer to users? For example if I go to 05-Obsidian+Integration in a browser I get your nice warning (which you might want to add to page 04 as well) at the top to expect error messages and I was curious what they looked like. I’m noticing that some of the error messages are a little clearer than others. These are all similar (except with more lower case) to messages I’ve gotten in Obsidian when working with Dataview or Javascript and making the inevitable typo or logic error, and they don’t always give much hint about where in the code something has first gone wrong. Can Clojure do better / be more informative than JS here since it has type information?

I like this point and look forward to thinking about it more as I learn more clojure! From a purely conceptual interest in programming languages, I’m curious how you would compare the DQL non-javascript query language aspects of Dataview with this mostly-immutable/functional world. I realize query languages in general mutate databases and that dataviewjs can definitely mutate things, but is DQL also immutable?

Cheers and thanks again for sharing this with the community!