mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.6k stars 386 forks source link

sphinx-gallery scripts containing rst #1169

Open maxnoe opened 10 months ago

maxnoe commented 10 months ago

The documentation of sphinx-gallery mentions jupytext and the other way around and makes some mention of converting rst to markdown when converting the scripts to notebooks.

However, there doesn't seem to be the possibility to open the text notebooks using jupytext keeping the rst syntax intact and correctly rendered.

I tried configuring:

preferred_jupytext_formats_read = "py:sphinx"
sphinx_convert_rst2md = false

but opening the scripts in the notebook interface does not render the rst content correctly and then saving them results in broken syntax, e.g. because jupytext inserts empty strings

""

as new cell markers instead of

# %%

It would be really great if jupytext could be used to edit the sphinx-gallery scripts in the notebook interface.