-
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
Hide Cell #303
Comments
Would it make sense for any PR relating to this to use a similar tags to those used for similar effect in Jupyter Book [ hiding cells docs and removing cells docs] to allow some element of portability between publishing workflows? The following tags are used by Jupyter Book as the basis of cell level filtering:
Tag based filtering in
|
@psychemedia Sure, it would make sense to be consistent with existing tools. I guess we could define options like But probably we can manage to come up with a bit more consistent names. I'm very much open for a PR that does "hiding" similar to Jupyter Book for HTML output (with the possibility of un-hiding by clicking on a little symbol). This would of course not work in LaTeX, but I guess this is OK since we already have quite a few features that only work in HTML output. I'm not a fan of the "removing" feature, but if somebody makes a convincing PR, I might merge it nevertheless. I will not accept the "removing" feature before the "hiding" feature is working. |
Re: the names, for sure they need to be consistent with On the other hand,
(In passing, I note that In the R world, Bookdown uses cell level controls in source documents. For example, all or nothing display ( I think these different approaches all need pulling into some sort of table to clarify what each does; they all seem to offer control over similar things but offer that control in different ways:-( |
According to your list above (#303 (comment)) the terms are horribly inconsistent within themselves.
I think originally it had nothing to do with But they seem to have some kind of the "interactive hiding" feature already implemented. I don't see a reason why
Yes, it is quite confusing indeed! |
Hey folks - just a note that I am happy to have discussions around standardizing metadata for cell-level behavior. My reasoning for using tags was precisely to have configuration that was not strictly unique to Jupyter Book (and to leverage a cell-level metadata mechanism that was already natively supported more easily in Jupyter interfaces). |
I'm currently not in a hurry to decide about tag names, because I'm still waiting for a reasonable implementation for hiding cells in HTML pages (with the ability to interactively toggle visibility). But once that happens, it would be nice to have a consistent default set of tags that can be re-used between multiple projects. |
FYI I've implemented this in ipypublish (see here), via selective injection of this JavaScript into documents, using the |
This is also possible in Jupyter Book (see here for example: https://jupyterbook.org/features/hiding.html#Hiding-page-elements-and-displaying-a-button-to-show-them) I've also got a little sphinx extension that collapses admonitions, the javascript to do so is here: and is basically also what you'd need to make cells collapsible |
Thanks @chrisjsewell and @choldgraf for the pointers! To be perfectly blunt, I like the appearance of Jupyter Book much more, but it is of course missing the prompt numbers, which might make things a bit more complicated. Anyway, I'm not planning on implementing any of this myself, I'm looking for volunteers! |
Check out this in case it's helpful: https://github.com/choldgraf/sphinx-togglebutton I made it to try and replicate the Jupyter Book "collapse cell" behavior in an extensible way in Sphinx. Maybe that could do the trick w/ nbsphinx? |
Wow, this looks promising! It should be straightforward to generate the appropriate CSS class names in The task just got much simpler ... are there any volunteers now? |
@mgeier I'm happy to take this up. Are you thinking that it would follow a similar format to jupyterbook? Would this work for getting the ball rolling?
|
All you should need to do is modify the selectors for the toggle buttons so that they map on to nbsphinx HTML structure, as described here: https://sphinx-togglebutton.readthedocs.io/en/latest/#control-the-selector-text-used-to-make-elements-toggle-able |
Thanks! Opened a PR with a demo of toggling input--sphinx toggle is super handy :o |
Hey,
For me hiding the cell's input but not the output did not work.
nbconvert 5.5.0
nbformat 4.4.0
nbsphinx 0.4.2
Always the input AND the output was hidden. When I move the
{%- if cell.metadata.nbsphinx != 'hidden' %}
line into the {% block input -%} it works.
However, in some cases it might make sense to hide both.
Is it possible to introduce a tag like "hide_input", "hide_output" and "hide"?
Please let me know if you are not able to reproduce the hide behaviour I had.
Julian
The text was updated successfully, but these errors were encountered: