-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add options for inputs, outputs and prompts to be excluded #185
base: master
Are you sure you want to change the base?
Conversation
Added nbsphinx options
"self.state.document.settings.env.config.nbsphinx_exclude_output_prompt" instead of a extra global variable
Thanks for this PR! Is Is |
Matthias, no particular reason. I had taken up the several options that were available that I wanted to use/test out (Apparently I didn't implement 'exclude_raw'). |
For my particular case, I only use the In all other cases (hiding entire code or markdown cells or hiding input) if I ever wanted to do this, it would be on a per-cell basis by creating tags, and using the new tag based element filtering feature of nbconvert. Unless anyone can point to a use-case that requires other options, I think it best to go with just the 3 options mentioned above. Should I just add another commit to remove unwanted options, I would you prefer that I rebased and squashed to remove them from the history? |
That means the "hide_cell" option is not a function of nbsphinx - nbconvert/sphinx is doing the job? I had implemented it via the templates. |
@rddaz2013 I take it that your preferred option is to hide individual input cells, based on metadata created by the Jupyter nbextension In my view, hiding individual inputs and outputs would be better done with nbconvert's new feature, tag based element filtering. This would avoid the need for any custom templates, doesn't require any extensions and the same approach can be used in other contexts, e.g. using nbconvert to directly generate html. |
@DavidPowell I agree, can you please just add the options you need? If somebody else needs more, we can add them later.
Normally I would prefer a rebase+squash, but in this case I think it would be good to keep @keluc's commits, because he first took the initiative. |
…ions, since no clear use case has been shown to date.
Unwanted options have been removed. As I didn't get any feedback from @rddaz2013 on what he means by hiding cells, nothing has been done on that front. |
|
From what I can see here, |
I've taken a further look, because in the standalone use of nbconvert it all seems to work (exclude_input_prompt etc.), but in this context this doesn't always work.
To me, the reason why we can't use the options of nbconvert to it's full potential has to do with this approach (NbInput.run and NbOutput.run). The following resolves both issues (latex issue still to test)
and
|
@tshead2 Thanks for your input! It's really helpful that you show an actual example of what you want to achieve. I don't really see a problem in showing the prompts, though. You are telling your readers that you are using notebooks (and you even urge them to play around with them), so I don't see why it should be helpful to try to hide the fact that your code snippets are actually Jupyter notebook cells. Having said that, you can actually hide the prompts in the HTML output by using:
Since that only does some CSS manipulations, it doesn't have any impact on the LaTeX output. [UPDATE (April 2020): Please don't use |
@mgeier - Happy to butt-in! When it comes to running notebooks, I appreciate the prompts for keeping track of the order in which I've (re)run cells. For documentation, where the order is always linear, they may be confusing for non-notebook users, provide no useful information for notebook experts, consume space, and add visual noise. Anyway, that's good news about While I'm at it, I'll also put in a good word for occasionally hiding cell inputs. I sometimes need to generate a plot to illustrate an idea, and I want the reader's focus to be on the plot, not the code used to create it. Cheers, |
The most reliable source is the source. All options are (and future options will be) visible in the Lines 1438 to 1448 in 20621a3
All of these options (unless I missed some) are also mentioned in the file Lines 22 to 82 in 20621a3
Most of the options are also mentioned in the documentation notebooks, but for some of them I was too lazy to mention them. If you want to help out, please make a PR (or multiple) with improvements! |
Needed feature, any plans to merge? |
Resolves #131. Code was contributed by @keluc.
Currently no changes have been made to the docs to reflect the additional options.