-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 handling for sphinx-extensions (incl. proposal) #1179
Comments
@agjohnson or @Blendify or @nienn: Would we lucky to support here with an PR. |
I'm 👍 on adding some I would select a more specific class to this specific purpose thought, as the same class should not be used to any other unrelated styling. Maybe |
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 readthedocs#1179
This issue is really getting critical for us. The fix is available from @danwos. Any chance of merging this soon? We are working with a fork of RTD now because of this. |
I will say that wrapping my HTML imported tables with a |
Problem
The rtd theme wrapps all tables in a
div
with classwy-table-responsive
via javascript.Unfortunately some html-tables in sphinx-projects are not coming from "normal" rst-tables, but are created by sphinx-extensions, which provide their own table setup/manipulation.
An example is the Sphinx-Needs extension, and there especially the directives need and needtable.
See also bug report #767 from the past.
Here a table comparison for
needtable
in the themes alabaster and rtd:The first table is the important one, which gets handled by the JS-lib DataTables.
With rtd, head and body are separated and the columns are not aligned.
Reproducible Project
You can take a look into the documentation on rtd. I have activated a branch which is using the rtd theme:
needtable docs with alabaster
needtable docs with rtd
Sphinx-Needs doc sources
Problem source
As I'm the maintainer of Sphinx-Needs, I tried to provide my own css-configuration, which contains rules for RTD only.
This works in some cases, but not in all.
Problem is also that rtd changes the DOM by inserting a div-wrapper with class
wy-table-responsive
.Which may confuse other JS-code.
Proposal / Fix
For sure rtd-theme can not handle all the exceptions needed by other extensions in its code.
But maybe there is a way to exclude certain table-configurations from the default rtd table-handling.
theme.js
is already doing this for classes likecitation
orfootnote
.See:
sphinx_rtd_theme/src/theme.js
Line 102 in 3532ffc
Maybe we can extend this line by a specific class-name
.rtd_exclude
, which can be set by sphinx-extensions to avoid the rtd-specific handling for these tables:There may be some more positions in the code, where such an exception-handling is needed (haven't checked everything yet).
Would this be a proper solution?
I would be happy to create a PR, but first please give me your feedback :)
The text was updated successfully, but these errors were encountered: