Seen in scikit-learn/scikit-learn#14507 (comment), print(__doc__) creates empty output box (yellowish box in the output below).

This was introduced by #475. A simple fix would be to not have an output box if my_stdout.isspace() and add a test similar to the one introduced in #475 to check that print(__doc__) does not create an output box.
Small reminder: many scikit-learn examples have print(__doc__) at the beginning, so inside sphinx-gallery we set __doc__ = '' (__doc__ is already rendered at the top of the example HTML so you don't want it captured in stdout as well).
ping @lucyleeow who is interested to work on this.