-
Notifications
You must be signed in to change notification settings - Fork 132
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
theme-specific border for input blocks #733
Comments
I guess they could, but it seems no other theme actually does this.
The insipid theme doesn't have borders around code blocks, see https://insipid-sphinx-theme.readthedocs.io/en/0.4.1/showcase/code-blocks.html The borders are part of the Jupyter look-and-feel.
Are there also problems with margin/padding? |
I didn't see any problems with padding/margins in other themes (besides sphinx-immaterial). I suppose we could add a CSS rule in sphinx-immaterial. I wasn't aware this border matches a standard Jupyter notebook style. I'll close this, leaving the color choice in #734. |
I just found out the extra padding is added by nbsphinx CSS: nbsphinx/src/nbsphinx/_static/nbsphinx-code-cells.css_t Lines 191 to 199 in a619a50
I think this would require an exception added to avoid the extra padding for input blocks in sphinx-immaterial: div.nbinput.container div.input_area div[class*=highlight] > pre:not(:has(code)) But maybe that needs to go in the theme CSS as it isn't specific enough for sphinx-immaterial. Note, among the various and numerous money-patches to sphinx, the sphinx-immaterial theme encapsulates the We could also try a new rule that uses sphinx-immaterial specific CSS class ( /* exclude input block padding in sphinx-immaterial */
.md-typeset div.nbinput.container div.input_area div[class*=highlight] > pre {
padding: 0;
} but this seems to negatively impact the sphinx-material theme as well. Although, the current rule in nbsphinx overrides the padding in sphinx-material CSS... The first idea (with /* exclude input block padding in sphinx-immaterial */
.md-typeset div.nbinput.container div.input_area div[class*=highlight] > pre:has(code) {
padding: 0;
} |
Looks like Firefox only supports the |
nbsphinx/src/nbsphinx/_static/nbsphinx-code-cells.css_t
Lines 128 to 133 in a619a50
This adds a border around the div containing the input code-block. However, it does not work as desired with all sphinx themes (or possibly with user-defined extra CSS) as the CSS for typical code-blocks could have additional padding/margins around the actual div for the code-block.
Observe the weird border (that doesn't match the theme's color palette) in the sphinx-immaterial theme:
It looks fine with the insipid theme, but I think that could be added to the theme CSS instead of nbsphinx CSS.
See also screenshots in #734 for an example of how this border looks odd with the furo theme.
The text was updated successfully, but these errors were encountered: