Skip to content
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

Don't override Pygments background color in code cells #463

Merged
merged 2 commits into from
Aug 25, 2020

Conversation

mgeier
Copy link
Member

@mgeier mgeier commented May 12, 2020

See #447.

I'm very unsure if that's actually a good idea.

Interestingly, most themes force their own background color, so this would only work with a subset of themes (e.g. with the RTD theme).

Apart from this, I'm hesitating because many people use the Pygments style 'sphinx' (because it's the one used by sphinx-quickstart), which has a quite ugly green background.
If we were to merge this PR, many people would suddenly get a green background on their code cells (which they probably don't want).

Any comments/suggestions?

@mgeier
Copy link
Member Author

mgeier commented May 16, 2020

Good news everyone: sphinx-quickstart doesn't use the style 'sphinx' anymore, see sphinx-doc/sphinx#5282 and sphinx-doc/sphinx#5700.

This makes it less of a problem for new users, but people using an old conf.py might still be surprised when their code cells suddenly turn green.

@mgeier
Copy link
Member Author

mgeier commented May 19, 2020

Of all the (about 30) themes mentioned in https://nbsphinx.readthedocs.io/usage.html#HTML-Themes, the Pygments background seems to be only visible on those:

  • bizstyle
  • dask_sphinx_theme
  • sphinx_material
  • sphinx_rtd_theme
  • traditional

I'm not sure whether that's a relevant argument for or against this PR, but I think it is remarkable anyway. I find it interesting that not even all the built-in themes respect the Pygments background.

Note that in the julia theme the syntax highlighting doesn't seem to work at all, and in the sphinx_typlog_theme, the Pygments style seems to be forced (and the pygments_style setting seems to be ignored).

@mgeier
Copy link
Member Author

mgeier commented May 19, 2020

In the bootstrap-astropy theme, the Pygments background is only visible in the very corners (see the black corners):

image

This is a hint that the CSS still isn't quite right.
Any ideas how to fix this?

@DominiqueMakowski
Copy link

About the yellow background argument, yes some users might be surprised, although it is ultimately quite a specific issue to search for and easy to fix. A side effect is that these users will automatically be "notified" of the new possibility of further customizing the look of their converted notebooks ☺️

About the CSS issue, really sorry but that's completely out of my range! I send some positive vibes tho 🤞

@mgeier
Copy link
Member Author

mgeier commented May 24, 2020

I've created PRs to fix the built-in themes (sphinx-doc/sphinx#7718, sphinx-doc/sphinx#7721) and in the alabaster theme (sphinx-doc/alabaster#169).

@mgeier mgeier merged commit b106c23 into spatialaudio:master Aug 25, 2020
@mgeier mgeier deleted the pygments-background branch August 25, 2020 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants