Skip to content

Commit 6bc74c5

Browse files
bollwyvljorisvandenbossche
authored andcommitted
Add DOM class for autosummary tables, only apply wrapping behavior to their descendent tds (#211)
1 parent 5ad65a4 commit 6bc74c5

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

pydata_sphinx_theme/bootstrap_html_translator.py

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from sphinx.writers.html5 import HTML5Translator
66
from sphinx.util import logging
7+
from sphinx.ext.autosummary import autosummary_table
78

89
logger = logging.getLogger(__name__)
910

@@ -28,6 +29,11 @@ def visit_table(self, node):
2829
self._table_row_index = 0
2930

3031
classes = [cls.strip(" \t\n") for cls in self.settings.table_style.split(",")]
32+
33+
# we're looking at the 'real_table', which is wrapped by an autosummary
34+
if isinstance(node.parent, autosummary_table):
35+
classes += ["autosummary"]
36+
3137
# classes.insert(0, "docutils") # compat
3238
# if 'align' in node:
3339
# classes.append('align-%s' % node['align'])

pydata_sphinx_theme/static/css/index.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/scss/index.scss

+5-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ table.field-list {
8989
* Styling for autosummary tables
9090
*/
9191

92-
// The first column (with the signature) should not wrap
93-
td:first-child {
94-
white-space: nowrap;
92+
.table.autosummary {
93+
// The first column (with the signature) should not wrap
94+
td:first-child {
95+
white-space: nowrap;
96+
}
9597
}
9698

9799
/**

0 commit comments

Comments
 (0)