Replies: 1 comment
-
|
I've identified why Marimo isn't working correctly in my Obsidian integration. It appears that Marimo runs within a worker thread, which has a separate process object from the main thread. My current approach of modifying the process object in the main thread thus doesn't affect the worker. I've confirmed this by setting a breakpoint immediately before the call to the IS_NODE constant in Pyodide's source code (here). Manually modifying the value at this breakpoint makes everything work perfectly, allowing Marimo to load successfully in Obsidian. My question is: Is there a practical way to programmatically force Pyodide to load in "browser mode" without relying on manual breakpoints? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm currently working on developing an Obsidian plugin that integrates Marimo islands into Obsidian notes. The goal is to have interactive notes powered by Python code, much like mkdocs-marimo, but within Obsidian itself!
If you're curious, you can check out the current plugin code here:
guiferviz/obsidian-marimo
Problem
I'm facing some challenges probably due to my limited web development experience, so please forgive any misconceptions! Obsidian is built using Electron, placing it somewhere between a web app and a Node.js app. It seems Pyodide attempts to load certain Node modules that aren't permitted within Electron's environment.
Attempted Solution
I managed to load Pyodide in Obsidian by following a workaround shared in this Obsidian forum post:
Setting
process.browser = "obsidian";before loading Pyodide, prevents it from loading Node-specific modules. Unfortunately, this solution doesn't seem to work with Marimo, as shown above.Alternatives Considered
I know Marimo supports editing Markdown format, but my idea is to run it inside Obsidian to combine it with other plugins and custom themes. One of my ultimate goals is to ensure compatibility with Obsidian Webpage Export, allowing easy exporting of my entire notes collection, including interactive examples, into a single web page.
Does anyone have suggestions on how to resolve this? I'd love to get Marimo fully integrated, as it's ✨awesome✨, and I'm confident many Obsidian users would greatly enjoy it too.
Thanks in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions