-
Notifications
You must be signed in to change notification settings - Fork 130
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
Support/ideas for a gallery #254
Comments
Thanks for the suggestion! I haven't really thought about this yet. My main interest is using notebooks as Sphinx source files and preserving as many features as possible between the notebook view and the HTML and LaTeX output of Sphinx. I could imagine a gallery-like thing that acts as kind of an overview of the following (group of) notebooks. This should probably internally have something like a I wouldn't rely on the internal reST representation though, because at some point I would like to get rid of it, see #36. It's better to use the in-memory
Yes, that should be possible, but only until #36 is done: import nbsphinx
rst, res = nbsphinx.Exporter().from_filename('my-notebook.ipynb')
print(rst) You can also check out the But again, you shouldn't rely on the intermediate reST representation.
There isn't really a "hook". The cell outputs are stored in the Here they are written to files: Lines 836 to 841 in 27a38ca
The file names contain the name of the notebook (with slashes and spaces replaced by underscores), followed by the cell number and the output number (because there might be more than one output per cell). The base name is specified here: Line 811 in 27a38ca
Note that the order in which Sphinx source files are parsed is kinda arbitrary. You would have to store a placeholder in the document where the gallery should be and then, when all source files are processed, you can create the actual content of the gallery. But this is in fact very similar to the I think the Sphinx extension tutorial also describes a similar situation: http://www.sphinx-doc.org/en/master/extdev/tutorial.html.
Not really. Yes.
Definitely, this would be great! |
Just to be sure: you know https://sphinx-nbexamples.readthedocs.io/en/dev/ https://github.com/Chilipp/sphinx-nbexamples Maybe that already does what you want? I haven't really looked into that yet ... |
@maartenbreddels Just a little heads up: I'm currently working on a gallery feature for I still need to figure out a few things, but then I'll make a PR soon-ish. |
I've just made a WIP PR: #392 |
#392 is now ready for review! |
Awesome work! |
I'm thinking/working on getting a gallery but for ipywidgets (ipyvolume, bqplot, ipyleaflet), ala sphinx-gallery in sphinx-gallery/sphinx-gallery#422
Sphinx-gallery however, is script oriented. All examples are in scripts, and multiple sections are separated by special markers.
Since I'd like it to work with a notebook, and nbsphinx already does the notebook -> rst transformation, I wonder if you though about supporting this, or how to build on top of this.
I am not interested in creating a new package, but more for improving existing packages and at the most make a really thin layer to combine it all.
Maybe an idea would be to have a special directive, that takes as argument a glob pattern of notebook files, these will be passed to nbsphinx, and (somehow) the output images are used to create a gallery possibly leveraging some sphinx-gallery code.
Concrete questions
The text was updated successfully, but these errors were encountered: