Skip to content

Commit

Permalink
Apply workaround for floating property fields
Browse files Browse the repository at this point in the history
The RTD theme has an incompatibility issue with autodoc as both use a
"property" CSS class for different purposes.  Add a custom CSS file with
a workaround to fix this issue.

See readthedocs/sphinx_rtd_theme#1247 for more
information.
  • Loading branch information
luator committed Sep 27, 2022
1 parent add3e8c commit bb4b0ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions mpiis_doc_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,14 @@ def build_documentation(
with open(doc_build_dir / "conf.py", "wt") as f:
f.write(out_text)

# copy the custom.css to _static
static_dir = doc_build_dir / "_static"
static_dir.mkdir(exist_ok=True)
shutil.copy(
resource_dir / "sphinx" / "custom.css.in",
static_dir / "custom.css",
)

#
# Copy the license and readme file.
#
Expand Down
7 changes: 6 additions & 1 deletion mpiis_doc_build/resources/sphinx/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ if not on_rtd:
# 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 = ['_static']
html_static_path = ['_static']

# path is relative to html_static_path
html_css_files = [
'custom.css',
]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand Down
4 changes: 4 additions & 0 deletions mpiis_doc_build/resources/sphinx/custom.css.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Workaround for https://github.com/readthedocs/sphinx_rtd_theme/issues/1247 */
dl.py.property {
display: block !important;
}

0 comments on commit bb4b0ca

Please sign in to comment.