-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Context
There has been need of making long outputs scroll by default in tutorial notebooks. It is already captured in several relevant issues (that @bsipocz pointed me to):
- ENH: adding in scrollers for long outputs Caltech-IPAC/irsa-tutorials#69
- BUG: vertical scrolling of outputs not working numpy/numpy-tutorials#163
- ENH: Make long cells in the output scrollable NASA-NAVO/navo-workshop#102
The current option that MyST-NB provides is to add a cell-level tag scroll-output or output_scroll but there's no way to add it globally or at a file/document-level, which makes it tedious to chase down all cells emitting long outputs and putting this tag there (an example PR at NAVO).
It will be best to have a global config option for rendering, say nb_outputs_scroll: bool that can be enabled to address above problem by one flag. Similarly, it can be extended as a file-level config.
Proposal
Since we need this feature at IRSA, I am willing to open a PR. I'm thinking to follow another global (and file-level) boolean rendering config option: remove_code_outputs and implement outputs_scroll.
After studying MyST-NB code a bit, it seems to me that I need to:
- Define a config for outputs_scroll at
core/config.pyalong the lines of other render options: https://github.com/executablebooks/MyST-NB/blob/master/myst_nb/core/config.py#L323-L335 - Tweak the logic in
core/render.py, specifically where classes are added to outputs to addtag_output_scrollclass (defined inmystnb.css) ifoutputs_scrollconfig is True. - Update config documentation and tests (if any)
Note: my solution relies on adding the classes that already has scrollable output styles per cell. An alternative can be to inject a custom css on global or document level that targets all cell_output classes together. But I'm not sure where is the logic that I'd need to tweak for it.
Let me know if this sounds like a reasonable plan, I'll create a PR. I'm also open to discuss better ways to implement this.
Tasks and updates
No response