Creating a viewer for a custom file type--jupyter

I would like to make a view-only mode for Jupyter notebooks on the file system.

Either the notebooks can be opened in their own tab, or embedded like
![[notebook.ipynb]]

much like images or PDFs.

I made a NodeJS prototype that loads a notebook file (which is a special JSON) and crudely renders it to HTML. Is there anyway I can hook this up to my desired use cases of embedding or opening in an a tab on its own? Or, failing that, maybe a code fence solution like

‘’‘ipynb
./relative/path/notebook.ipynb
‘’’

Register a textFileView should open it in a tab

Thanks. Is the data property then the JSON contents of the file? And the idea would be that my implementation of the abstract method setViewData(data, clear) would do my transformation to HTML, walk the workspace tree to the current tab, and call createEl on something?

And when I do Plugin.RegisterView, is the first argument the file extension, and the second my TextFileView subclass?

GitHub - yuleicul/obsidian-ketcher: View or draw chemical structures and reactions using Ketcher. you can see this plugin for a good minimalized reference to build a view.

I’ll follow-up later on your questions.

That example looks like a nice superset of what I want to do, thanks. I think lines 27 and 28 of main.ts answer my questions about registering. And I guess, looking at the creation of the KetcherReact component in setViewData in ketView.tsx suggests that I’m right that this.data is the JSON, and setViewData can use this.containerEl to generate my HTML.

I’ll go work on this when I next have time, and then post back here only if I have problems; else, this is probably closed, thanks.

1 Like