jupyter-sphinx
jupyter-sphinx copied to clipboard
Allow to hide script output but not plots?
The :hideoutput: flag hides both plots and script outputs. It would be nice to be able to hide only script outputs but not plots, or vice-versa. Some typical plot commands implemented in libraries return something from their plot methods, so you get the situation where calling something.plot() inside your jupyter-execute directive gives you both the plot (great) but also some ugly return text under the plot like <Figure size 432x288 with 2 Axes>.
Here is an example from my own project:

I'd like the ({finesse.detectors.powerdetector.PowerDetector: ...) stuff to be hidden.
Perhaps the :hideoutput: flag could support some options like "all" (default), "plots", "stdout", "stderr" (and support any combination of those)?
Thanks for the suggestion.
In the meantime you can suppress the output by ending the last line with a semicolon—that's the standard jupyter behavior.
For now this is blocked by #107
Thanks for the semicolon hint.
What is blocking about #107? Seems like this could be as simple as a few if/else statements?
Overall it makes sense to treat output differently in different formats (html/pdf specifically). Right now this is impossible, and #107 is a step in that direction. Because it overhauls the logic of how the outputs are treated, it would likely make more sense to review your proposal after #107 is merged.
As an extra remark: one danger for this package is feature creep—jupyter-execute directive already has a lot of options, and I think caution in adding more is a good idea.