mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] doc: css: allow word-wrapping in grid table cells
@ 2023-05-02  7:55 Roland Hieber
  2023-05-05 14:56 ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Hieber @ 2023-05-02  7:55 UTC (permalink / raw)
  To: ptxdist; +Cc: Roland Hieber

By default, spinx_rtd_theme sets the CSS attribute "white-space: nowrap"
on table cells, which has the effect, that table contents never
word-wrap and the table gets scrollable. This is unfortunate if table
cells contain a large amount of text.

Issue #1246 of sphinx_rtd_theme addresses this situation, but the
general fix is not that easy. Until this issue is fixed upstream,
introduce a custom CSS class named "word-wrap" that reverts the
behaviour of table cells back to do word wrapping when the content of
the cell is wider than the available width.

With this change, the following example should produce a table as wide
as the content area with word-wrapped text in the second row:

  .. table::
     :class: word-wrap

     +--------------------------------+-----------------------------+
     | Column 1                       | Column 2                    |
     +================================+=============================+
     | Lorem ipsum dolor sit amet,    | Duis aute irure dolor in    |
     | adipisicing elit, sed do eius  | voluptate velit esse cillum |
     | incididunt ut labore et dolor  | fugiat nulla pariatur.      |
     | aliqua. Ut enim ad minim veni  | Excepteur sint occaecat     |
     | nostrud exercitation ullamco   | proident, sunt in culpa     |
     | nisi ut aliquip ex ea commodi. | deserunt mollit anim id.    |
     +--------------------------------+-----------------------------+
     | Third Row                      | Third Row continued         |
     +--------------------------------+-----------------------------+

Link: https://github.com/readthedocs/sphinx_rtd_theme/issues/1246
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 doc/_static/css/custom.css | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/_static/css/custom.css b/doc/_static/css/custom.css
index 0efa6f92cac5..258e8f70ebfb 100644
--- a/doc/_static/css/custom.css
+++ b/doc/_static/css/custom.css
@@ -109,3 +109,8 @@ nav.wy-nav-side #menu-resize .fa:not(:first-child) {
 .note .admonition-title {
 		background-color: #83983e !important;
 }
+
+.wy-table-responsive table.word-wrap td,
+.wy-table-responsive table.word-wrap th {
+    white-space: normal;
+}
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-05 14:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02  7:55 [ptxdist] [PATCH] doc: css: allow word-wrapping in grid table cells Roland Hieber
2023-05-05 14:56 ` [ptxdist] [APPLIED] " Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox