Skip to content
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

Style sheet class 'property' conflicts with autodoc generated html of python properties 'py property' #1247

Open
gschwaer opened this issue Oct 27, 2021 · 2 comments
Labels
Bug A bug Needed: replication Bug replication is required

Comments

@gschwaer
Copy link

gschwaer commented Oct 27, 2021

Problem

I am using sphinx.ext.autodoc to generate documentation for a python project. Python properties can become ordered horizontally instead of vertically, depending on the width of the docstring (see B in the image below).

Autodoc generates html tags with class="py [element_type]" where element_type is class, method, attribute, property, and so on (D).

Unfortunately, the CSS class for the prefix of a class (A) also has class="property", which this theme stylizes (E).

Yes, this problem very much originates from autodoc or sphinx (not sure here). But I doubt they will change the generated class names, because it would break many existing themes.

Reproducible Project

See repo here.

Error Logs/Results

img

Expected Results

Maybe this theme can use a not(.py) classifier in the CSS for .property such that the class = "py property" is not matched. I'm not a frontend person, so I don't know if this is viable or how to achieve it.

Related to sphinx-doc/sphinx#9663

Environment Info

  • Python Version: 3.8.10
  • Sphinx Version: v4.2.0
  • RTD Theme Version: 1.0.0
@gschwaer gschwaer added Bug A bug Needed: replication Bug replication is required labels Oct 27, 2021
@luator
Copy link

luator commented Oct 27, 2021

I just stumbled upon this very issue as well. As an easy workaround until it is fixed, adding the following custom CSS works well for me:

dl.py.property {
    display: block !important;
}

luator added a commit to open-dynamic-robot-initiative/trifinger_simulation that referenced this issue Oct 27, 2021
@gschwaer
Copy link
Author

That is a great workaround. Thank you!

luator added a commit to open-dynamic-robot-initiative/trifinger_simulation that referenced this issue Dec 3, 2021
luator added a commit to open-dynamic-robot-initiative/trifinger_simulation that referenced this issue Dec 3, 2021
luator added a commit to open-dynamic-robot-initiative/trifinger_simulation that referenced this issue Dec 3, 2021
luator added a commit to open-dynamic-robot-initiative/trifinger_simulation that referenced this issue Dec 3, 2021
luator added a commit to machines-in-motion/breathing-cat that referenced this issue Sep 27, 2022
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug Needed: replication Bug replication is required
Projects
None yet
Development

No branches or pull requests

2 participants