Freeform plugin

Hi! I recently released my first Obsidian plugin, Freeform. Here’s a blog post about it and a video: https://www.youtube.com/watch?v=7LhMavEpNSE&t=6s

It adds a new block type, freeform, in which you can add any JavaScript, including JavaScript that imports ES modules from sites like esm.sh, so you can import modules like Observable Plot and make inline charts in your notes.

It tries to bring a tiny bit of the flavor of Observable to Obsidian (disclosure: I worked there). Probably most useful to folks who are very comfortable with JavaScript.

Since no one seems to have responded to this, I’ll add that I think this is a brilliant plugin and opens up many interesting possibilities for Obsidian. Your examples of plotting, parsing Markdown, and integrating with dataview are super-helpful. A few questions/suggestions…

  1. Can there be an option to not display the code in the “result”? Maybe ```freeform-no-code … or something like that?

  2. I can imagine having several freeform blocks with same functions. To avoid copy and paste, is it possible to load a script file with common functions/code? I think dataview has some mechanism to do this - will try to look.

  3. Is it possible to import from the obsidian API? Like to access normalizedPath? I think this is not possible, but maybe there’s a way.

freeform will be a great way to do things without the overhead of writing a full plugin. Again, thanks for this and the helpful examples!!

For a long time I’ve wanted to do this with dataview queries (mostly DQL), in my reference/help notes for using Dataview. Is there a way to apply your plugin to achieve this?

Not sure what you mean @ShaneNZ, but the blog post @tmcw refers to in the top message of this thread has an example of accessing Dataview. I’ve tried it myself to plot some data in my notes and it worked nicely.

Sorry, on a re-read I realise I wasn’t clear about what I’m trying to achieve. I have a few reference files full of useful DQL queries, things like this:

```dataview
TABLE file.etags
WHERE any(econtains(file.etags, ["#theme","#type"]))
```

What I’d love is for that query to be visible underneath the dataview output from that query, so I can see both at once. And while I’m wishing for ponies here, it’d be really great to be able to edit the query with the output live updating :slight_smile: ) In essence, I want this to work:

image

I know freeform wont work directly support and work like that, but I’m wondering if there is a way (maybe with some Javascript wrapped around the query) to get it working.

PS in writing this post, I’m realising what I really want is this:

```dataview-preview
TABLE file.etags
WHERE any(econtains(file.etags, ["#theme","#type"]))
```

Think I’ll put a feature request into Dataview/Datacore…