sphinx_rtd_theme icon indicating copy to clipboard operation
sphinx_rtd_theme copied to clipboard

Allow specific deactivation of table handling

Open danwos opened this issue 3 years ago • 7 comments

Setting the table class "rtd-exclude-wy-table" deactivates the normal table handling for this table.

So the table gets not wrapped into a "div.wy-table-responsive" container.

Needed by other Sphinx extensions, which care about their tables on their own.

Fixes #1179

danwos avatar Aug 24 '21 10:08 danwos

@nienn : I hope this PR is fine and solves #117 as expected.

I have also added some documentation and a changelog entry. As this is my first PR on this project, please let me know if anything is missing.

Local tests together with Sphinx-Needs are looking great.

danwos avatar Aug 24 '21 14:08 danwos

Thanks for the contribution, we'll see about getting this in version 1.1. I'll block this PR for now, we're still wrapping up a 1.0 release.

agjohnson avatar Aug 24 '21 15:08 agjohnson

@agjohnson Thanks for your feedback and for the overall work on RTD.

The change itself is really small, one line. And it does not have any side-effects to the theme or any code. So really no chance to get this small bugfix into 1.0?

Not having a possibility of deactivating the automatic table handling makes RTD-Theme incompatible with some other sphinx-extensions. I, as an affected extension developer, would be happy to avoid this incompatibility as fast as possible.

The other solution would be to ask my users to use another theme or use the fork, which contains my changes. Something, I really don't like.

danwos avatar Aug 25 '21 06:08 danwos

So really no chance to get this small bugfix into 1.0?

We'll look to getting this in for 1.1, we don't want to keep holding back a 1.0 release.

agjohnson avatar Sep 07 '21 17:09 agjohnson

This issue is extremely critical for us. The fix solves a major problem that is affecting 100s of tables that we have in RTD theme. Any chance to get this in soon?

twodrops avatar Oct 06 '21 02:10 twodrops

@agjohnson I was looking for a way to accomplish the same thing from the sphinx side but could not find it.

Found the following documentation that gives options for setting tables and table cells widths. In the end however, everything gets wrapped in the div.wy-table-responsive and the custom widths get ignored in favor of the css white-space: nowrap:

  • https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#table-directives
  • https://docutils.sourceforge.io/docs/ref/rst/directives.html#table

Also, the js handling the responsive tables is on the theme side and it applies to every table that is not .field-list, .footnote or .citation: https://github.com/readthedocs/sphinx_rtd_theme/blob/3532ffc89bbf89ef7d2ac62d65b3683f588a9673/src/theme.js#L102

Although this is not an ideal solution, I think it's a good option to add.

Maybe instead of .rtd-exclude-wy-table we could use a more semantic class like .unresponsive.


This would also fix: #1246

nienn avatar Oct 12 '21 08:10 nienn

Any updates on this? 1.1 is on the way and this PR is set to blocked Anything I can do here?

danwos avatar Oct 25 '22 07:10 danwos