-
Notifications
You must be signed in to change notification settings - Fork 131
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
[WIP] allow toggling inputs and outputs #436
base: master
Are you sure you want to change the base?
Conversation
Thanks for this PR! What I really like about it, is that the inclusion of the I think the same flexibility should be used for selecting the relevant notebook tags. I think there are 3 categories of tags:
On top of those 3 categories, there could be an option to choose whether the toggleable parts are initially visible or not. Or do you think they should always be initially hidden? Or should they be initially hidden by default, but with an additional tag this can be changed to initially visible? I think it would be great to make those 4 (or 3) sets of tags configurable (each accepting either a single string or multiple strings). Those options should of course have reasonable defaults.
I think it would make sense to keep the CSS class name used by We could probably make the CSS class(es) configurable as well, but I think this might be overkill?
It would sure be a possibility. Feel free to add options there. However, I can think of another way to implement this: You could insert the CSS classes directly into the RST source like this:
Those I'm not sure which approach would be simpler in the end.
I don't understand how this is supposed to work, can you please elaborate? Finally, there is one thing I'm wondering about: |
Thanks for your quick feedback. I'll take a closer look Monday--but wanted to quickly follow-up :).
This really stood out to me while looking through possible implementations, too. I think the most remarkable thing is that it's basically a question of how to put a CSS class in the right spot. If users could add CSS classes to parts of a code cell (eg input, output, whole cell), nbsphinx could push this feature to "userland"! For example, if users can add CSS classes, nbsphinx gets this feature below for free...
Since sphinx-togglebutton has a class to show the toggled section by default! In a sense then, the ability for users to add CSS classes in 3 code cell spots would make up an interface for extensions, like sphinx-togglebutton, which tells...
This is what I was stewing on with the comment below :).
But I realize nbsphinx has the broader jupyter notebook metadata ecosystem to be mindful of. I'm definitely on board with helping out on an implementation that uses a more general interface, or is sphinx-togglebutton specific. As a concrete example, suppose that nbphinx added tags (or some other metadata field) as classes on both the .nbinput and .nboutput containers (not saying this is the best idea!), and set this in conf.py.
Then users adding the tags |
cc @choldgraf, since he mentioned
And I'm wondering now if he was thinking about how it would look if nbsphinx added CSS classes to parts of the cell, based on something in metadata (eg how jupyterbook adds |
@machow quick thoughts from Jupyter Book - I think the tags work nicely, but it's still very early days there. Jupyter doesn't have a strong "tagging" culture yet, I think because only until recently the UIs didn't make it easy to tag things. In Jupyter Book, we are recommending that people use Directives for controlling things like "toggle this content" with the book content, and they use tags to trigger the same behavior just for code cells (since that's the only way I know of to attach metadata/triggers to a code cell) |
I'm not sure if I understand. I think it would make more sense to have configurable lists of tags that |
Following. I think this would be super useful. Please have an option to add custom tags list too. |
@machow Any news on this? |
I would also really welcome this addition to |
This (WIP) PR addresses #303.
I took a quick look over nbsphinx, and wanted to highlight some challenges and decisions involved. (I'll clean up / flesh out the doc notebook before wrapping up).
Changes
Example
Hidden:
Toggled:
Questions
(As a general note, a generic metadata option to specify classes to set on either output or input containers would also allow toggling.)