From 5a1282c76158edd1c765779e060cef8f235f2be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20M=C3=B6ller?= Date: Sat, 23 Dec 2023 01:09:57 +0100 Subject: [PATCH] docs: fix word wrap in tables The sphinx-rtd-theme currently disables word wrap in table cells due to a bug: https://github.com/readthedocs/sphinx_rtd_theme/issues/1505 This is fixed by overriding the CSS and enabling word wrapping. --- docs/source/_static/custom.css | 9 +++++++++ docs/source/conf.py | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 docs/source/_static/custom.css diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css new file mode 100644 index 000000000..8952b3e62 --- /dev/null +++ b/docs/source/_static/custom.css @@ -0,0 +1,9 @@ +@import 'css/theme.css'; + +/* Fix white-space wrapping in tables. + * See https://github.com/readthedocs/sphinx_rtd_theme/issues/1505 + * This is included via html_static_path and html_style in conf.py + */ +.wy-table-responsive table td { + white-space: normal; +} diff --git a/docs/source/conf.py b/docs/source/conf.py index 2f406e78d..cb07ae3d1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -96,7 +96,12 @@ def setup(app): # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = [] +html_static_path = ['_static'] + +# Fix white-space wrapping in tables. +# See https://github.com/readthedocs/sphinx_rtd_theme/issues/1505 +# Once fixed, this can be removed and '_static' can be removed from html_static_path. +html_style = 'custom.css' # Configuration of the 'Edit on GitHub' button at the top right. html_context = {