Skip to content

Commit

Permalink
Allow specific deactivation of table handling
Browse files Browse the repository at this point in the history
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
  • Loading branch information
danwos committed Aug 24, 2021
1 parent 73d1707 commit 1188aee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Fixes
* Wrap inline literals (#1050)
* Fix aria labels (#1056)
* Don't toggle navigation terminal nodes (#1049)
* Allow deactivation of table handling for selected tables (#1179)

Other Changes
-------------
Expand Down
13 changes: 13 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,16 @@ To release a new version of the theme, core team will take the following steps:

.. _PEP440: https://www.python.org/dev/peps/pep-0440/
.. _semantic versioning: http://semver.org/


Table handling
==============
The theme wraps tables into a ``div.wy-table-responsive`` container, to easily make tables responsive.

If this behavior is not needed for some specific tables, the class name ``rtd-exclude-wy-table`` must be set
for the table. This may be important especially for other Sphinx extensions, which create and configure tables
for their use case on their own.




2 changes: 1 addition & 1 deletion sphinx_rtd_theme/static/js/theme.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function ThemeNav () {
})

// Make tables responsive
$("table.docutils:not(.field-list,.footnote,.citation)")
$("table.docutils:not(.field-list,.footnote,.citation,.rtd-exclude-wy-table)")
.wrap("<div class='wy-table-responsive'></div>");

// Add extra class to responsive tables that contain
Expand Down

0 comments on commit 1188aee

Please # to comment.