Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use jupyter-sphinx directives for markdown/rST pages #46

Closed
choldgraf opened this issue Mar 5, 2020 · 1 comment · Fixed by #116
Closed

Use jupyter-sphinx directives for markdown/rST pages #46

choldgraf opened this issue Mar 5, 2020 · 1 comment · Fixed by #116

Comments

@choldgraf
Copy link
Member

choldgraf commented Mar 5, 2020

Right now the ipynb parser is the only thing that knows how to deal with outputs of running a cell. However, we could replicate similar behavior if we used machinery from jupyter-sphinx to run code and display outputs. I'm not 100% sure how this should happen, but this issue is to track the topic.

In particular,

if we could have code that did the same execution code that jupyter-sphinx uses (https://github.com/jupyter/jupyter-sphinx/blob/master/jupyter_sphinx/execute.py#L76)
but instead of directly inserting outputs we used the same OutputBundleNode that MyST-NB uses: https://github.com/ExecutableBookProject/MyST-NB/blob/master/myst_nb/parser.py#L136
then we could use the same CellOutputToNode transform that we use here: https://github.com/ExecutableBookProject/MyST-NB/blob/master/myst_nb/transform.py#L31

I think it'd be even better if jupyter-sphinx itself defined the CellOutputToNode object, and then Myst-NB could reuse that for both its markdown and ipynb uses. Maybe @akhmerov has thoughts on that

ping @rossbar who I think was interested in this issue

note: this is separate from the "two-way conversion between ipynb and myst nb markdown...in this case, the markdown will be directly read into Sphinx without being converted to an ipynb file first.

another note: we should consider a future where a jupyter-cache exists as well, as at some point we'l want to leverage that cache to avoid having to run all the code each time if it is in a markdown cell

@akhmerov
Copy link
Contributor

akhmerov commented Mar 5, 2020

I fully support the idea of incorporating this in jupyter-sphinx.

Sorry for lack of activity on my side: my bandwidth will stay saturated for a few weeks. However I'm happy to review/merge/mint a release for jupyter-sphinx.

@chrisjsewell chrisjsewell linked a pull request Apr 1, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants