mProjectsCode / obsidian-js-engine-plugin

https://www.moritzjung.dev/obsidian-js-engine-plugin-docs/
GNU General Public License v3.0
88 stars 5 forks source link

Any interest in figuring out how this could work with Obsidian Publish? #18

Open levity opened 4 months ago

levity commented 4 months ago

Obsidian Publish allows you to upload a publish.js file to run arbitrary JS on your published site, which could be used as a starting point for parsing and executing js-engine code blocks on published pages.

I'm curious to hear how easy or difficult you think this would be, and would be happy to contribute to making it happen. I'm new to the world of Obsidian plugins, so I don't know how feasible it would be to expose the same API (or polyfill/shim it) in a published, in-browser context.

mProjectsCode commented 4 months ago

It is doable. A lot of API won't work in publish, but we could just throw a custom error that says that this API method is not available in publish.

mProjectsCode commented 4 months ago

The approach would be similar to what I did in Meta Bind.

levity commented 1 month ago

I see this note in the Meta Bind docs:

I am currently waiting for the Obsidian Team to deliver on promised improvements to the Obsidian Publish API. Until then, Meta Binds publish support will be broken. Use at your own risk.

Does that mean I should hold off on exploring this for now?

mProjectsCode commented 1 month ago

I think the only thing missing from the Obsidian Publish API for JS Engine are modals. Everything else should be doable with the minimalistic existing APIs.