jannis-baum / vivify

Bring your Markdown to life
GNU General Public License v3.0
4 stars 2 forks source link

Render Jupyter Notebooks #55

Open jannis-baum opened 7 months ago

jannis-baum commented 7 months ago
jannis-baum commented 2 days ago

There is nbconvert, this is a bit slow though. Faster would be to have a Python server running that gives us the HTMLs, this way we could save some time on the initialization

import nbformat
from nbconvert import HTMLExporter

notebook = nbformat.read('notebook_path', as_version=4)
html_exporter = HTMLExporter(template_name='classic')
(body, resources) = html_exporter.from_notebook_node(notebook)

print(body)
jannis-baum commented 1 day ago

Using Python here is not good; maybe we can reimplement https://github.com/jsvine/notebookjs with pluggable markdown parser & highlighting; then we can plug in Vivify's existing parser & highlighting

jannis-baum commented 1 day ago

@tuurep do you use Notebooks/are you interested in this feature as well?

tuurep commented 1 day ago

I tend to avoid them tbh and write python directly 😄

But sure I'm interested, and actually as a reader I could have use for it

And I can test this if it helps

jannis-baum commented 1 day ago

Sounds good! I was also avoiding them for the longest time haha but recently they have been adding up and I find myself in the browser running Jupyter Lab way too much.

My ultimate goal with this is to have Vivify render Notebooks very quickly and in its style and then make another Vim extension that uses jupytext to open and edit the .ipynb files and run a kernel in the background that we use to execute cells from Vim and then live-update the .ipynb to be displayed by Vivify🤩 Getting excited haha, then we will essentially have the same "edit in Vim, view in the browser" paradigm for Notebooks as for Markdown

tuurep commented 23 hours ago

Actually, really cool :smile: