Skip to content

Commit 43fb803

Browse files
committed
ReadTheDocs theme has an annoying bug of text not being wrapped inside table cells. Each row is extended to fit the text as a single line. For a table with multiple columns and long sentences the table may get wide, with long scrollbar underneath and is not convenient to read. This MR makes the text wrap inside table cells. There is an open PR to fix this issue - readthedocs/sphinx_rtd_theme#432.
1 parent d56a44a commit 43fb803

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

docs/_static/theme_overrides.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* override table width restrictions */
2+
@media screen and (min-width: 767px) {
3+
4+
.wy-table-responsive table td {
5+
/* !important prevents the common CSS stylesheets from overriding
6+
this as on RTD they are loaded after this stylesheet */
7+
white-space: normal !important;
8+
}
9+
10+
.wy-table-responsive {
11+
overflow: visible !important;
12+
}
13+
}

docs/conf_common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
# Add any paths that contain custom static files (such as style sheets) here,
186186
# relative to this directory. They are copied after the builtin static files,
187187
# so a file named "default.css" will overwrite the builtin "default.css".
188-
#html_static_path = ['_static']
188+
html_static_path = ['../_static']
189189

190190
# Add any extra paths that contain custom files (such as robots.txt or
191191
# .htaccess) here, relative to this directory. These files are copied
@@ -327,3 +327,8 @@
327327
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
328328

329329
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
330+
331+
# Override RTD CSS theme to introduce the theme corrections
332+
# https://github.com/rtfd/sphinx_rtd_theme/pull/432
333+
def setup(app):
334+
app.add_stylesheet('theme_overrides.css')

0 commit comments

Comments
 (0)