From 5daba66f20692d48793d14d46b9fadae3d21dd21 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Mon, 11 May 2020 21:05:30 +0200 Subject: [PATCH] Don't override Pygments background color in code cells Closes #447. --- src/nbsphinx.py | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/nbsphinx.py b/src/nbsphinx.py index b7bb54c9..760f2721 100644 --- a/src/nbsphinx.py +++ b/src/nbsphinx.py @@ -426,23 +426,32 @@ /* CSS for nbsphinx extension */ /* remove conflicting styling from Sphinx themes */ -div.nbinput.container, -div.nbinput.container div.prompt, -div.nbinput.container div.input_area, -div.nbinput.container div[class*=highlight], -div.nbinput.container div[class*=highlight] pre, -div.nboutput.container, -div.nboutput.container div.prompt, -div.nboutput.container div.output_area, -div.nboutput.container div[class*=highlight], -div.nboutput.container div[class*=highlight] pre { - background: none; +div.nbinput.container div.prompt *, +div.nboutput.container div.prompt *, +div.nbinput.container div.input_area pre, +div.nboutput.container div.output_area pre, +div.nbinput.container div.input_area .highlight, +div.nboutput.container div.output_area .highlight { border: none; - padding: 0 0; + padding: 0; margin: 0; box-shadow: none; } +div.nbinput.container div.prompt *, +div.nboutput.container div.prompt * { + background: none; +} + +div.nboutput.container div.output_area .highlight, +div.nboutput.container div.output_area pre { + background: unset; +} + +div.nboutput.container div.output_area div.highlight { + color: unset; /* override Pygments text color */ +} + /* avoid gaps between output lines */ div.nboutput.container div[class*=highlight] pre { line-height: normal; @@ -541,7 +550,7 @@ div.nbinput.container div.input_area { border: 1px solid #e0e0e0; border-radius: 2px; - background: #f5f5f5; + /*background: #f5f5f5;*/ } /* override MathJax center alignment in output cells */ @@ -607,6 +616,7 @@ div.nboutput.container div.output_area > div.output_javascript, div.nboutput.container div.output_area:not(.rendered_html) > img{ padding: 5px; + margin: 0; } /* fix copybtn overflow problem in chromium (needed for 'sphinx_copybutton') */