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 16 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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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 Down
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# Select nbsphinx and, if needed, other Sphinx extensions:
extensions = [
'nbsphinx',
'sphinx.ext.mathjax', # for math equations
'sphinx_copybutton',
'sphinx.ext.mathjax', # for math equation
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
'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
38 changes: 36 additions & 2 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 @@ -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 @@ -611,6 +610,35 @@
div.rendered_html tbody tr:hover {
background: rgba(66, 165, 245, 0.2);
}

s-weigand marked this conversation as resolved.
Show resolved Hide resolved
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 > img{
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
padding: 0.4rem;
}

div.nboutput.container div.output_area > div[class*=highlight],
div.nboutput.container div.output_area.rendered_html > img{
padding: 0;
mgeier marked this conversation as resolved.
Show resolved Hide resolved
}

/* fix positioning of copybtn icon */
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
a.copybtn {
padding: 0;
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
top: 0.1em;
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
}
a.copybtn > img{
padding: 0;
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
}

/* hide copybtn icon on prompts */
.prompt.highlight-none.notranslate a.copybtn {
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
display: none;
}

"""

CSS_STRING_READTHEDOCS = """
Expand All @@ -622,6 +650,12 @@
margin-bottom: 19px; /* padding has already 5px */
}

/* fix copybtn overflow problem */
div.nbinput.container div.input_area > div[class^='highlight'],
div.nboutput.container div.output_area > div[class^='highlight']{
overflow-y: hidden;
}

/* ... except between code cells! */
.nblast.container + .nbinput.container {
margin-top: -19px;
Expand Down