Skip to content

Commit

Permalink
Fix css for 'sphinx_copybutton' (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-weigand authored and mgeier committed Jan 9, 2020
1 parent 047ce70 commit aad12aa
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ dist/
nbsphinx.egg-info/
.ipynb_checkpoints/
.python-version
.vscode
doc/_build
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ matrix:
- env: SPHINX="==2.2.0"

# a few Python versions using latest Sphinx release
- python: "3.4"
env: BIBTEX="==0.4.2"
- python: "3.5"
- python: "3.6"
- python: "3.7"
- python: "nightly"
#- python: "pypy3"
# - python: "pypy3"

- name: Python 2.7 + latest Sphinx
python: "2.7"
Expand All @@ -30,6 +28,7 @@ matrix:
- python2 -m pip install sphinxcontrib-bibtex==0.4.2
- python2 -m pip install sphinxcontrib-svg2pdfconverter
- python2 -m pip install ipywidgets
- python2 -m pip install 'sphinx-copybutton<0.2.6'
script: &py2-script
- python2 -m nbsphinx
# We don't execute, because the example notebooks use Python 3
Expand All @@ -54,6 +53,9 @@ matrix:
install: *py2-install
script: *py2-script

allow_failures:
- python: "nightly"

addons:
apt:
packages:
Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Select nbsphinx and, if needed, other Sphinx extensions:
extensions = [
'nbsphinx',
'sphinx_copybutton',
'sphinx.ext.mathjax', # for math equations
'sphinxcontrib.bibtex', # for bibliographic references
'sphinxcontrib.rsvgconverter', # for SVG->PDF conversion in LaTeX output
Expand Down
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pandas
sphinxcontrib-bibtex
sphinxcontrib-svg2pdfconverter
ipywidgets
sphinx-copybutton
28 changes: 24 additions & 4 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
.. raw:: html
<div></div>
<div class="output_javascript"></div>
<script type="text/javascript">
var element = document.currentScript.previousSibling.previousSibling;
{{ output.data['application/javascript'] | indent | indent }}
Expand Down Expand Up @@ -479,8 +479,8 @@
div.nbinput.container div.prompt,
div.nboutput.container div.prompt {
min-width: %(nbsphinx_prompt_width)s;
padding-top: 0.4em;
padding-right: 0.4em;
padding-top: 0.3rem;
padding-right: 0.3rem;
text-align: right;
flex: 0;
}
Expand All @@ -504,7 +504,6 @@
/* input/output area */
div.nbinput.container div.input_area,
div.nboutput.container div.output_area {
padding: 0.4em;
-webkit-flex: 1;
flex: 1;
overflow: auto;
Expand Down Expand Up @@ -578,6 +577,27 @@
.ansi-bold { font-weight: bold; }
.ansi-underline { text-decoration: underline; }
div.nbinput.container div.input_area div[class*=highlight] > pre,
div.nboutput.container div.output_area div[class*=highlight] > pre,
div.nboutput.container div.output_area div[class*=highlight].math,
div.nboutput.container div.output_area.rendered_html,
div.nboutput.container div.output_area > div.output_javascript,
div.nboutput.container div.output_area:not(.rendered_html) > img{
padding: 0.3rem;
}
/* fix copybtn overflow problem in chromium (needed for 'sphinx_copybutton') */
div.nbinput.container div.input_area > div[class^='highlight'],
div.nboutput.container div.output_area > div[class^='highlight']{
overflow-y: hidden;
}
/* hide copybtn icon on prompts (needed for 'sphinx_copybutton') */
.prompt a.copybtn {
display: none;
}
/* Some additional styling taken form the Jupyter notebook CSS */
div.rendered_html table {
border: none;
Expand Down

0 comments on commit aad12aa

Please sign in to comment.