-
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
process cell tags remove-input and remove-output #543
Conversation
@mgeier thank you for making nbsphinx it is just what I need to keep a large part of my documentation in notebooks. So my use-case is that I have (graphviz) graphs in the documentation that I want to generate from the notebook but I don't want to include the source code in the HTML because it adds nothing in my case (and people can always jump to the notebook if they want). I hope this can fill a gap, but if this is totally different from what you would have in mind for handling these tags, don't hesitate to reject the PR, too. |
Thanks for this PR! I'm open for this feature, but I think there are some details still to be ironed out. Can you please remove the outputs from the example notebook? In your example, the padding after an input cell without output is missing. The implementation is fine, but did you think about re-using the tag-based filtering from I think
Is there a link to some documentation?
I don't see the connection. |
Oh sorry. Yes, I changed the text to #436. I didn't. So I am aware of
Edit: Actually this works! I'll update the PR. P.S.: Our project using nbsphinx and also your insipid theme went public today. Thank you for covering us for our documentation. |
Thanks for the update!
I agree. In fact, I would change the documentation to mention the tags first, and then in the end mention the custom cell metadata just as a legacy feature that still works for compatibility but is not recommended for new notebooks. Can you please answer my remaining questions from #543 (comment)?
That's great to hear! If you have suggestions for improving the theme, please let me know! |
So I think the main ones are
Personally, I don't really see the value. Jupyter seems to be unable to specify common tags, but in the end I see more value with having some sort of standardization and so aligning with Jupyter Book + Hardcoding might be a feature. That said, if you intended the question to express a preference for configuration, I'll add that.
https://jupyterbook.org/interactive/hiding.html#removing-code-cell-content Would you add that link to the documentation? I can do that when I flip the order of the hide methods in the documentation. I think I have the other questions, but I'd appreciate a hint if not. |
The most annoying thing was that Jupyter Notebooks don't need a blank line but nbsphinx generates funny stuff without (seems to be jupyter/nbconvert#917, so not a nbsphinx bug). Other than that I probably haven't used half the customization that is possible. One thing I thought about is whether to put the logo in the topbar instead of the sidebar. That likely is already possible but I took your advice and focus on the content. I really like how nbsphinx and your insipid theme made that possible! |
I don't have a concrete use case myself, but I could imagine that somebody wants different versions of their docs, once with removed cells and another one where all cells are visible. If you look at it from a cost/benefit perspective: It costs basically nothing to expose the configuration options, therefore it doesn't matter if the benefit isn't huge. Having the tags as literal strings littered around the source code is bad anyway, so at least I would make global variables for them. But making them Sphinx configuration options is just as easy, and to me it is quite an obvious thing to do (even if I don't have a use for that myself).
Yeah, that's even more reason to make them configurable in
Sure, standardization would be great, but as you said, this didn't happen (except for Jupyter Book is just another third-party package, it isn't in the position to standardize anything. But if there are no better suggestions, I think it's reasonable to use their settings as our defaults.
Yeah, I guess I did.
Thanks for the link.
I think those were indeed all the questions, but I think this comment hasn't been addressed yet: "In your example, the padding after an input cell without output is missing.
Yeah, the problem is that there are different Markdown implementation with slightly different behavior.
There is no specific setting for putting the logo there, but you can try to use the left_buttons option for that. But I think in general it's a waste of space to put the logo into the topbar. You should think about users with small screens (like smartphones). Putting the logo there will make the topbar actually less useful for them. You could of course add some CSS to avoid showing the logo on small screens, but if the logo is so important to you, you probably also want it to be shown on those small screens, right? What about putting the logo at the top of each page (using the
That's great to hear! |
The PDF output seems to have the same problem, there is no space between cells: https://648-46379698-gh.circle-artifacts.com/0/nbsphinx.pdf#section.6 |
Yes, but so this happens when I use the nbconvert facility, so it would appear to be a bug there. |
It very likely is a bug there, but Either way, I would like it to work correctly in |
I'm afraid my notebook foo isn't enough to implement these tags after all. |
This PR adds removing cell input and output by using the
remove-input
andremove-output
tags.My understanding from #436 is that the behaviour (remove output rather than hide with css) is consistent with Jupyter Book use of the same tags.
This is complimentary to #436 in that it deals with
remove-
tags as opposed tohide-*
.Thank you for looking at this, and making nbsphinx in the first place!