-
Notifications
You must be signed in to change notification settings - Fork 91
Add scroll_outputs configuration #683
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
Changes from 8 commits
f8d3495
d458fac
9653984
c19b7d5
fa2d76f
d1a539a
4444dd5
5521f45
b2c740e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -281,65 +281,72 @@ tbody span.pasted-inline img { | |
| * | ||
| * It was before in https://github.com/executablebooks/sphinx-book-theme/blob/eb1b6baf098b27605e8f2b7b2979b17ebf1b9540/src/sphinx_book_theme/assets/styles/extensions/_myst-nb.scss | ||
| */ | ||
|
|
||
| div.cell.tag_output_scroll div.cell_output, div.cell.tag_scroll-output div.cell_output { | ||
| max-height: 24em; | ||
| overflow-y: auto; | ||
| max-width: 100%; | ||
| overflow-x: auto; | ||
| } | ||
|
|
||
| div.cell.tag_output_scroll div.cell_output::-webkit-scrollbar, div.cell.tag_scroll-output div.cell_output::-webkit-scrollbar { | ||
| width: var(--mystnb-scrollbar-width); | ||
| height: var(--mystnb-scrollbar-height); | ||
| } | ||
|
|
||
| div.cell.tag_output_scroll div.cell_output::-webkit-scrollbar-thumb, div.cell.tag_scroll-output div.cell_output::-webkit-scrollbar-thumb { | ||
| background: var(--mystnb-scrollbar-thumb-color); | ||
| border-radius: var(--mystnb-scrollbar-thumb-border-radius); | ||
| } | ||
|
|
||
| div.cell.tag_output_scroll div.cell_output::-webkit-scrollbar-thumb:hover, div.cell.tag_scroll-output div.cell_output::-webkit-scrollbar-thumb:hover { | ||
| background: var(--mystnb-scrollbar-thumb-hover-color); | ||
| } | ||
|
|
||
| @media print { | ||
| div.cell.tag_output_scroll div.cell_output, div.cell.tag_scroll-output div.cell_output { | ||
| max-height: unset; | ||
| overflow-y: visible; | ||
| max-width: unset; | ||
| overflow-x: visible; | ||
| } | ||
| div.cell:is( | ||
| .tag_output_scroll, | ||
| .tag_scroll-output, | ||
| .config_scroll_outputs | ||
| ) | ||
| div.cell_output, | ||
| div.cell.tag_scroll-input div.cell_input { | ||
| max-height: 24em; | ||
| overflow-y: auto; | ||
| max-width: 100%; | ||
| overflow-x: auto; | ||
|
Comment on lines
+284
to
+294
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh! I forgot to mention: this is a little bit tangential to this PR. I realized the style definitions were redundant so I combined input and output styles. And CSS selector was too long so I simplified it with
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All I could do is to trust you and the test suite and downstream test PRs on this 😅 |
||
| } | ||
|
|
||
| div.cell.tag_scroll-input div.cell_input { | ||
| max-height: 24em; | ||
| overflow-y: auto; | ||
| max-width: 100%; | ||
| overflow-x: auto; | ||
| div.cell.config_scroll_outputs div.cell_output:has(img) { | ||
| /* If the output cell has image(s), allow it to take 90% of viewport height | ||
| but still bounded between 24em and 60em */ | ||
| max-height: clamp(24em, 90vh, 60em); | ||
| } | ||
|
|
||
| /* Custom scrollbars */ | ||
| div.cell:is( | ||
| .tag_output_scroll, | ||
| .tag_scroll-output, | ||
| .config_scroll_outputs | ||
| ) | ||
| div.cell_output::-webkit-scrollbar, | ||
| div.cell.tag_scroll-input div.cell_input::-webkit-scrollbar { | ||
| width: var(--mystnb-scrollbar-width); | ||
| height: var(--mystnb-scrollbar-height); | ||
| width: var(--mystnb-scrollbar-width); | ||
| height: var(--mystnb-scrollbar-height); | ||
| } | ||
|
|
||
| div.cell:is( | ||
| .tag_output_scroll, | ||
| .tag_scroll-output, | ||
| .config_scroll_outputs | ||
| ) | ||
| div.cell_output::-webkit-scrollbar-thumb, | ||
| div.cell.tag_scroll-input div.cell_input::-webkit-scrollbar-thumb { | ||
| background: var(--mystnb-scrollbar-thumb-color); | ||
| border-radius: var(--mystnb-scrollbar-thumb-border-radius); | ||
| background: var(--mystnb-scrollbar-thumb-color); | ||
| border-radius: var(--mystnb-scrollbar-thumb-border-radius); | ||
| } | ||
|
|
||
| div.cell:is( | ||
| .tag_output_scroll, | ||
| .tag_scroll-output, | ||
| .config_scroll_outputs | ||
| ) | ||
| div.cell_output::-webkit-scrollbar-thumb:hover, | ||
| div.cell.tag_scroll-input div.cell_input::-webkit-scrollbar-thumb:hover { | ||
| background: var(--mystnb-scrollbar-thumb-hover-color); | ||
| background: var(--mystnb-scrollbar-thumb-hover-color); | ||
| } | ||
|
|
||
| /* In print mode, unset scroll styles */ | ||
| @media print { | ||
| div.cell.tag_scroll-input div.cell_input { | ||
| max-height: unset; | ||
| overflow-y: visible; | ||
| max-width: unset; | ||
| overflow-x: visible; | ||
| } | ||
| div.cell:is( | ||
| .tag_output_scroll, | ||
| .tag_scroll-output, | ||
| .config_scroll_outputs | ||
| ) | ||
| div.cell_output, | ||
| div.cell.tag_scroll-input div.cell_input { | ||
| max-height: unset; | ||
| overflow-y: visible; | ||
| max-width: unset; | ||
| overflow-x: visible; | ||
| } | ||
| } | ||
|
|
||
| /* Font colors for translated ANSI escape sequences | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "356e9205", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# Scroll long outputs" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 2, | ||
| "id": "cd1b32ee", | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "short output\n", | ||
| "short output\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "for i in range(2):\n", | ||
| " print(\"short output\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 1, | ||
| "id": "91a31d3f", | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n", | ||
| "long output\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "for i in range(100):\n", | ||
| " print(\"long output\")" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "myst-nb-py311", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.11.13" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.