Open levity opened 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.
The approach would be similar to what I did in Meta Bind.
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?
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.
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.