From 3fa6f8fb7372e511a8eed691f48b84e45c721257 Mon Sep 17 00:00:00 2001 From: Bjorge Meulemeester <38312921+bgmeulem@users.noreply.github.com> Date: Thu, 27 Mar 2025 13:26:24 +0000 Subject: [PATCH 1/2] Force long output text to scroll --- src/nbsphinx/_static/nbsphinx-code-cells.css_t | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/nbsphinx/_static/nbsphinx-code-cells.css_t b/src/nbsphinx/_static/nbsphinx-code-cells.css_t index c3fd7e35..5724e568 100644 --- a/src/nbsphinx/_static/nbsphinx-code-cells.css_t +++ b/src/nbsphinx/_static/nbsphinx-code-cells.css_t @@ -128,6 +128,11 @@ div.nboutput.container div.output_area { width: 100%; } } +/* scroll long text outputs vertically */ +div.nboutput.container div.output_area:has(pre) { + max-height: 600px; +} + /* input area */ div.nbinput.container div.input_area { From f0cb91e0f607a4319a2423167c1355edbf998c1a Mon Sep 17 00:00:00 2001 From: Bjorge Meulemeester Date: Thu, 27 Mar 2025 15:18:44 +0100 Subject: [PATCH 2/2] Add long output example --- doc/code-cells.ipynb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/code-cells.ipynb b/doc/code-cells.ipynb index ecdf3877..f98c5a70 100644 --- a/doc/code-cells.ipynb +++ b/doc/code-cells.ipynb @@ -132,6 +132,23 @@ "\"I'm the 'normal' output\"" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Very long output (>600px) is scrolled:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for i in range(50):\n", + " print(i)" + ] + }, { "cell_type": "markdown", "metadata": {},