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

Fix css for 'sphinx_copybutton' #349

Merged
merged 31 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f5a755f
changed css so 'sphinx_copybutton' will look properly
s-weigand Nov 9, 2019
10d9be3
added 'sphinx_copybutton' to the docs
s-weigand Nov 9, 2019
c553235
added sphinx_copybutton to be installed on py2 tests on travis
s-weigand Nov 9, 2019
8aaf442
added vscode config and doc build folder to .gitignore
s-weigand Dec 6, 2019
4a77696
made css rules more restrictive by using only direct child elements
s-weigand Dec 6, 2019
c2bf858
fixed style changes for 'Unsupported Output Types'
s-weigand Dec 6, 2019
57ac71e
set max version for sphinx-copybutton on py27 tests
s-weigand Dec 6, 2019
a39a863
deleted later obsolete comment
s-weigand Dec 18, 2019
c0d28e0
changed padding unit from em to rem, so it stays the same with RTD theme
s-weigand Dec 18, 2019
5b77b76
added class to js rendered divs, so css selections can be more specific
s-weigand Dec 18, 2019
c78d2d1
made style pattern more homogeneous
s-weigand Dec 19, 2019
f5ee0e4
fixed image padding
s-weigand Dec 19, 2019
b523041
removed now obsolete css rule, due to more narrow selection
s-weigand Dec 19, 2019
16c2b7c
ensured copybtn image has no additional padding
s-weigand Dec 19, 2019
b4cc765
hid 'overflow-y' for RTD theme, since it caused problem in chrome
s-weigand Dec 19, 2019
07e1fd9
changed class name 'js-render-output' to 'output_javascript'
s-weigand Dec 19, 2019
2c1f0a6
Added extension name 'sphinx_copybutton' to comments changing the style
s-weigand Dec 20, 2019
fec5fdd
Simplified rule to hide copybtn on prompt
s-weigand Dec 20, 2019
f35ed90
removed obsolete rules
s-weigand Dec 20, 2019
b800599
Moved changed styling rules before jupyter notebook commented block
s-weigand Dec 20, 2019
aac7216
refined comments with 'sphinx_copybutton'
s-weigand Dec 20, 2019
7ee5650
removed now obsolete overflow rule, for RTD theme and copybtn
s-weigand Dec 26, 2019
d1105a6
Removed another obsolete rule concerning ANSI displaying
s-weigand Dec 26, 2019
b0bce0b
droped sphinx_copybutton icon aligne rule for RTD theme
s-weigand Dec 27, 2019
3972dfe
Fixed unwanted change, due to keyboard mishap
s-weigand Dec 29, 2019
9198c02
set default padding for children of input_area and output_area to 0.3rem
s-weigand Jan 2, 2020
c7ae529
re implemented overflow work-around for RTD theme
s-weigand Jan 2, 2020
d77c732
moved overflow work-around to general css rules
s-weigand Jan 3, 2020
7089ed8
Adjusted padding of propts to be same as 'nbinput'/'nboutput' content
s-weigand Jan 8, 2020
4e935c3
removed python 3.4 test, due to ended support and switched test for
s-weigand Jan 8, 2020
146e813
implemented requested changes to travis config
s-weigand Jan 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
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"
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
- python: "3.5"
- python: "3.6"
- python: "3.7"
- python: "nightly"
#- python: "pypy3"
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
# - 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'
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -6,6 +6,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