Open jsquyres opened 1 year ago
Filed PR #1506 which potentially fixes the issue.
I noted on PR #1506:
I am not an expert in front-end dev things, but it looks like theme.css might actually be generated, and the source of the wy-table-responsive CSS stanzas comes from https://github.com/snide/wyrm/blob/master/sass/wyrm_core/_table.sass#L144-L151
Unfortunately, it looks like wyrm_core
hasn't changed since early 2015. Indeed, https://github.com/snide/wyrm/pull/13 is a PR about sphinx_rtd_theme
, but it has sat there unmodified and un-merged since 2018. I'm guessing that filing a PR over there to change the upstream source is unlikely to get merged.
What's the best way to get word wrapping enabled in sphinx_rtd_theme
tables?
I think you can remove the "Needed: replication" label since the issue is visible at https://sphinx-rtd-theme.readthedocs.io/en/latest/demo/lists_tables.html#list-tables
For anyone else who finds this in the future (like me), here's a tutorial on how to fix this so you don't have to look through all these linked commits:
The CSS code that fixes this and needs to be embedded is:
.wy-table-responsive table td, .wy-table-responsive table th {
white-space: normal;
}
(One project uses table.reece-wrap
instead of table
, but that's just because they explicitly marked the tables with :class: reece-wrap
, so this won't generally work).
To include this CSS code, some projects set a custom CSS file as the html_style
like html_style = 'custom.css'
in conf.py
. This file needs to include @import 'css/theme.css';
in the beginning to use the theme and only override parts of it.
However, what I think is even better is to use html_css_files = ["custom.css"]
. This explicitly loads CSS files additionally to the theme and allows overriding specific components and therefore doesn't require any @import 'css/theme.css'
.
Problem
When using the
sphinx_rtd_theme
, text does not wrap in RST.. list-table::
cells like it does with the default Sphinx HTML theme. For example, the default Sphinx HTML builder theme renders like this:(FWIW: the LaTeX and text Sphinx builders also render with wrapped text in the cell)
But the
sphinx_rtd_theme
renders the same RST like this:The HTML difference between the two appears to be that the
sphinx_rtd_theme
has this set:Reproducible Project
conf.py
:index.rst
:Error Logs/Results
Expected Results
I expect the words to wrap in the cell, like they do with the default Sphinx HTML builder theme, and with other Sphinx builders.
Environment Info