Skip to content

Commit

Permalink
Add some CSS for HTML tables (e.g. Pandas dataframes)
Browse files Browse the repository at this point in the history
Fixes #182.
  • Loading branch information
mgeier committed Nov 4, 2018
1 parent fd8fac4 commit 5a12ee2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
{{ output.data['text/latex'] | indent | indent }}
{%- elif datatype == 'text/html' %}
:class: rendered_html
.. raw:: html
Expand Down Expand Up @@ -556,6 +557,40 @@
.ansi-bold { font-weight: bold; }
.ansi-underline { text-decoration: underline; }
/* Some additional styling taken form the Jupyter notebook CSS */
.rendered_html table {
border: none;
border-collapse: collapse;
border-spacing: 0;
color: black;
font-size: 12px;
table-layout: fixed;
}
.rendered_html thead {
border-bottom: 1px solid black;
vertical-align: bottom;
}
.rendered_html tr,
.rendered_html th,
.rendered_html td {
text-align: right;
vertical-align: middle;
padding: 0.5em 0.5em;
line-height: normal;
white-space: normal;
max-width: none;
border: none;
}
.rendered_html th {
font-weight: bold;
}
.rendered_html tbody tr:nth-child(odd) {
background: #f5f5f5;
}
.rendered_html tbody tr:hover {
background: rgba(66, 165, 245, 0.2);
}
"""

CSS_STRING_READTHEDOCS = """
Expand Down

0 comments on commit 5a12ee2

Please sign in to comment.