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

Table cell text does not wrap in ".. list-table::" #1505

Open
jsquyres opened this issue Aug 19, 2023 · 3 comments · May be fixed by #1506
Open

Table cell text does not wrap in ".. list-table::" #1505

jsquyres opened this issue Aug 19, 2023 · 3 comments · May be fixed by #1506
Labels
Bug A bug Needed: replication Bug replication is required

Comments

@jsquyres
Copy link

jsquyres commented Aug 19, 2023

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:

Screenshot 2023-08-19 at 2 44 43 PM

(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:

Screenshot 2023-08-19 at 2 45 53 PM

The HTML difference between the two appears to be that the sphinx_rtd_theme has this set:

.wy-table-responsive table td, .wy-table-responsive table th {
    white-space: nowrap;
    white-space-collapse: collapse;
    text-wrap: nowrap;
}

Reproducible Project

conf.py:

html_theme = 'sphinx_rtd_theme'

index.rst:

Hello world.

.. list-table::
   :header-rows: 1
   :widths: 10 25

   * - Col 1
     - Col 2

   * - Content
     - This is a long sentence that should wrap nicely in the rendered
       table, but just to make sure, we'll make it super, extra,
       incredibly long.

Error Logs/Results

$ rm -rf _build && sphinx-build -M html . _build 
Running Sphinx v6.2.1
making output directory... done
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                        
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                         
generating indices... genindex done
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.

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

  • Python Version: 3.11.4
  • Sphinx Version: 6.2.1
  • RTD Theme Version: same results with 1.3.0rc1 and 1.2.2 (didn't manually test back further). This behavior has been around for a long time; I didn't realize that other Sphinx themes / builders wrapped words in a cell until very recently (which is why I didn't file this issue until now).
@jsquyres jsquyres added Bug A bug Needed: replication Bug replication is required labels Aug 19, 2023
@jsquyres jsquyres linked a pull request Aug 19, 2023 that will close this issue
@jsquyres
Copy link
Author

Filed PR #1506 which potentially fixes the issue.

jsquyres added a commit to jsquyres/ompi that referenced this issue Aug 21, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
jsquyres added a commit to jsquyres/pmix-master that referenced this issue Aug 21, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
jsquyres added a commit to jsquyres/prrte that referenced this issue Aug 21, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here (in conf.py).

The PRRTE docs don't use the RST ".. list-table::" directive much, so
this change won't really have much of an effect here.  However, OMPI
and PMIx were updated with this conf.py change, so we might as well
keep all 3 projects more-or-less in sync.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
jsquyres added a commit to jsquyres/pmix-master that referenced this issue Aug 21, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
jsquyres added a commit to jsquyres/ompi that referenced this issue Aug 21, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
rhc54 pushed a commit to openpmix/openpmix that referenced this issue Aug 21, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
rhc54 pushed a commit to openpmix/prrte that referenced this issue Aug 21, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here (in conf.py).

The PRRTE docs don't use the RST ".. list-table::" directive much, so
this change won't really have much of an effect here.  However, OMPI
and PMIx were updated with this conf.py change, so we might as well
keep all 3 projects more-or-less in sync.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
jsquyres added a commit to jsquyres/ompi that referenced this issue Aug 21, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 8e9a24f)
@jsquyres
Copy link
Author

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, snide/wyrm#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?

rhc54 pushed a commit to rhc54/openpmix that referenced this issue Sep 4, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 9b3bdf8)
rhc54 pushed a commit to rhc54/openpmix that referenced this issue Sep 4, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 9b3bdf8)
rhc54 pushed a commit to rhc54/prrte that referenced this issue Sep 4, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here (in conf.py).

The PRRTE docs don't use the RST ".. list-table::" directive much, so
this change won't really have much of an effect here.  However, OMPI
and PMIx were updated with this conf.py change, so we might as well
keep all 3 projects more-or-less in sync.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 9ef7478)
rhc54 pushed a commit to rhc54/prrte that referenced this issue Sep 4, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here (in conf.py).

The PRRTE docs don't use the RST ".. list-table::" directive much, so
this change won't really have much of an effect here.  However, OMPI
and PMIx were updated with this conf.py change, so we might as well
keep all 3 projects more-or-less in sync.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 9ef7478)
rhc54 pushed a commit to openpmix/openpmix that referenced this issue Sep 4, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 9b3bdf8)
rhc54 pushed a commit to openpmix/openpmix that referenced this issue Sep 4, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 9b3bdf8)
rhc54 pushed a commit to openpmix/prrte that referenced this issue Sep 4, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here (in conf.py).

The PRRTE docs don't use the RST ".. list-table::" directive much, so
this change won't really have much of an effect here.  However, OMPI
and PMIx were updated with this conf.py change, so we might as well
keep all 3 projects more-or-less in sync.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 9ef7478)
rhc54 pushed a commit to openpmix/prrte that referenced this issue Sep 4, 2023
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here (in conf.py).

The PRRTE docs don't use the RST ".. list-table::" directive much, so
this change won't really have much of an effect here.  However, OMPI
and PMIx were updated with this conf.py change, so we might as well
keep all 3 projects more-or-less in sync.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 9ef7478)
@jcphill
Copy link

jcphill commented Sep 22, 2023

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

jkhsjdhjs added a commit to rwth-iat/basyx-python-sdk that referenced this issue Dec 23, 2023
The sphinx-rtd-theme currently disables word wrap in table cells due to
a bug: readthedocs/sphinx_rtd_theme#1505
This is fixed by overriding the CSS and enabling word wrapping.
jkhsjdhjs added a commit to rwth-iat/basyx-python-sdk that referenced this issue Dec 23, 2023
The sphinx-rtd-theme currently disables word wrap in table cells due to
a bug: readthedocs/sphinx_rtd_theme#1505
This is fixed by overriding the CSS and enabling word wrapping.
jkhsjdhjs added a commit to rwth-iat/basyx-python-sdk that referenced this issue Jan 3, 2024
The sphinx-rtd-theme currently disables word wrap in table cells due to
a bug: readthedocs/sphinx_rtd_theme#1505
This is fixed by overriding the CSS and enabling word wrapping.
jkhsjdhjs added a commit to rwth-iat/basyx-python-sdk that referenced this issue Jan 3, 2024
The sphinx-rtd-theme currently disables word wrap in table cells due to
a bug: readthedocs/sphinx_rtd_theme#1505
This is fixed by overriding the CSS and enabling word wrapping.
s-heppner pushed a commit to eclipse-basyx/basyx-python-sdk that referenced this issue Jan 9, 2024
The sphinx-rtd-theme currently disables word wrap in table cells due to
a bug: readthedocs/sphinx_rtd_theme#1505
This is fixed by overriding the CSS and enabling word wrapping.
bosilca pushed a commit to bosilca/ompi that referenced this issue Feb 14, 2024
The sphinx_rtd_theme does not properly handle wrapping long lines in
table cells when rendering to HTML due to a CSS issue (see
readthedocs/sphinx_rtd_theme#1505).

Until the issue is fixed upstream in sphinx_rtd_theme, we can simply
override the CSS here.  This commit overrides the CSS in conf.py and
also touches up some places where we previously tried to work around
the lack of word wrapping.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug Needed: replication Bug replication is required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants