udus122 / dataview-publisher

Output markdown from your Dataview queries and keep them up to date. You can also be able to publish them.
MIT License
25 stars 0 forks source link

Support for custom dv.view Javascript file #47

Open jlharri opened 2 months ago

jlharri commented 2 months ago

Thanks

First, thanks for this useful plugin. Frankly, this functionality should be built into Obsidian for all rendered code blocks. The fact that it's not reveals the mindset of the Publish developers: content only.

Overview

The request is to support custom JS files that are involve via dv.view(). I have my JS file return markdown, but dv.view is not passing that up the call stack to your plugin. Do you know a workaround?

udus122 commented 1 month ago

dv.view is designed to directly manipulate the DOM without generating markdown or HTML.

Therefore, to support dv.view, it is necessary to override it with a function that outputs HTML equivalent to the DOM generated by dv.view.

This is a bit of a challenge. At least, it is not possible using the current format that uses eval.

I am currently considering ways to run DataviewJS other than eval. At that time, we will try to see if we can implement the same functionality.

Thank you!