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

py:property's stacking on a single line on larger screen widths. [replicated] #1301

Open
ArachnidAbby opened this issue Jun 29, 2022 · 10 comments · May be fixed by #1483
Open

py:property's stacking on a single line on larger screen widths. [replicated] #1301

ArachnidAbby opened this issue Jun 29, 2022 · 10 comments · May be fixed by #1483
Labels
Bug A bug Needed: replication Bug replication is required

Comments

@ArachnidAbby
Copy link

Problem

Multiple properties I defined in the docs are all stacking on a single line. I have no idea what could be causing it. Using | to force a new line just adds too much space to be reasonable.

Before you continue reading, thanks in advance for looking at my issue. Sorry if I just messed up my RST, I am fairly new to writing documentation in sphinx.

Reproducible Project

I think this should be the minimum needed to reproduce it. Just note that it doesn't happen on smaller screen widths.

.. py:class:: Entity(add_to_scene_entities=True, \
    name=str, visible=True, enabled=True, ignore=False, \
    eternal=False, ignore_puased=False, ignore_input=False, \
    parent=scene, model=None, color=color.white, texture=None, \
    double_sided=False, shader=Entity.default_shader, \
    collision=False, collider=None, scripts=List[], \
    animations=List[], origin=Vec3(0,0,0), position=Vec3(0,0,0), \
    rotation=Vec3(0,0,0),scale=Vec3(0,0,0), **kwargs)

    .. note::

        Many of the properties in this class also have setters.

        .. code-block:: python

            my_entity = Entity()                # create example Entity
            print(my_entity.flipped_faces)      # flipped_faces is a property
            my_entity.flipped_faces = True      # but also has a setter

    .. py:property:: world_position
        :type: Vec3

        Get individual coordinates with :code:`Entity.world_<x|y|z>`

    .. py:property:: x
        :type: float
        
        x position of the entity
    
    .. py:property:: y
        :type: float
        
        y position of the entity

    .. py:property:: z
        :type: float
        
        z position of the entity
    
    .. py:property:: X
        :type: int
        
        prefix for :code:`int(Entity.x)`
    
    .. py:property:: Y 
        :type: int

        prefix for :code:`int(Entity.y)`

    .. py:property:: Z 
        :type: int

        prefix for :code:`int(Entity.z)`

    .. py:property:: rotation
        :type: Vec3

        Get individual coordinates with :code:`Entity.rotation<x|y|z>`

    .. py:property:: quaternion

Error Logs/Results

No errors but here is a picture of what I see.

Screenshot_20220628_221448

Expected Results

I expected each entry to be on a separate line regardless of the screen width.

Environment Info

  • Python Version: 3.10.5
  • Sphinx Version: 4.4.0
  • RTD Theme Version: 1.0.0
@ArachnidAbby ArachnidAbby added Bug A bug Needed: replication Bug replication is required labels Jun 29, 2022
@KennethNielsen
Copy link

KennethNielsen commented Jul 6, 2022

I have the same issue. As a bonus info I can share that I tried to bisect the problem, by installing older versions of the theme, but as far back as 0.2.0 (which is the oldest I could install) I can replicate the faulty behavior. This suggests to me that the bug is brought on by a change elsewhere, which just now reveals a potential bug in the theme.

Environment info:

  • Python version: 3.10.4
  • Sphinx version: 4.5.0
  • RTD theme version: 1.0.0

EDIT: Addition environment information: I should probably also mention, that for my case the pages that showed this behavior were generated by autodoc from docstring written in the Google style and parsed with Napoleon.

@ArachnidAbby
Copy link
Author

Thanks for replicating it, Is there anyway to avoid this behavior?

@KennethNielsen
Copy link

KennethNielsen commented Aug 12, 2022

@spidertyler2005 I'm not associated with the project and I'm afraid I don't have the bandwidth to try and fix it, so for me unfortunately I will wait until someone from the project notices this bug. But, you can probably remove the "Needed: replication" label, that might help for visibility.

@nocarryr
Copy link

This might be the source of the issue:

.property
display: inline-block
padding-right: 8px
max-width: 100%

I'm seeing the same thing on my doc builds. If you use dev-tools to uncheck display: inline-block everything appears normal.

(It will be on the parent container <dl class="py property">)

@nocarryr
Copy link

@spidertyler2005 @KennethNielsen

Here's a gist that replicates the issue.

When built, the <dl class="py property"> tags are displayed as inline-block (as they do in the above screenshot).

If built with the last line of conf.py uncommented, the display property is overridden by css and they appear as expected.

(you'll have to do a make clean in between builds)

Note:
This is not a fix, it's a hack. Only meant to demonstrate the cause of the issue.

nocarryr added a commit to nocarryr/jvconnected that referenced this issue Sep 9, 2022
Unsure why this is necessary. There should never be a case where
properties are displayed inline (if attributes and methods aren't)

readthedocs/sphinx_rtd_theme#1301
@ArachnidAbby ArachnidAbby changed the title py:property's stacking on a single line on larger screen widths. py:property's stacking on a single line on larger screen widths. [replicated] Oct 15, 2022
@johannes-mueller
Copy link

Having the same issue. Is there a proper fix in sight?

johannes-mueller added a commit to boschresearch/pylife that referenced this issue Feb 6, 2023
workaround readthedocs/sphinx_rtd_theme#1301

Signed-off-by: Johannes Mueller <johannes.mueller4@de.bosch.com>
@westonplatter
Copy link

Ran into this today.

echoing the previous comment, "Is there a proper fix in sight?"

@nocarryr
Copy link

nocarryr commented Jun 4, 2023

@westonplatter @johannes-mueller Can always just use the css override in my last comment.

If it's not going to be fixed by the maintainers, monkeyhacking is always a viable solution. (As of this comment, the style for ".property" still has display: inline-block; when it should just be display: block;

nocarryr added a commit to nocarryr/sphinx_rtd_theme that referenced this issue Jun 4, 2023
:py:`property` blocks get rendered on a single line instead of separate lines
Fixes readthedocs#1301
@nocarryr nocarryr linked a pull request Jun 4, 2023 that will close this issue
maierbn pushed a commit to boschresearch/pylife that referenced this issue Oct 13, 2023
workaround readthedocs/sphinx_rtd_theme#1301

Signed-off-by: Johannes Mueller <johannes.mueller4@de.bosch.com>
Signed-off-by: Benjamin Maier <Benjamin.Maier2@de.bosch.com>
@darkvertex
Copy link

For anybody affected arriving here, a mini guide on monkeypatching this until the PR is hopefully merged someday:

  1. Find your conf.py, ensure it has a html_static_path declaration, for example:
    html_static_path = ['_static']
  2. Add a new line or extend your existing html_css_files declaration:
    html_css_files = ["custom.css"]
  3. Go into this _static folder (or whatever you had it configured to.)
  4. Dump in a custom.css file looking like so:
/*
Fix for horizontal stacking weirdness in the RTD theme with Python properties:
https://github.com/readthedocs/sphinx_rtd_theme/issues/1301
*/
.py.property {
  display: block !important;
}
  1. make clean + make html and you should be looking good! ✨

@whitequark
Copy link

I'm hitting the same issue with sphinx-rtd-theme 2.0.0.

github-merge-queue bot pushed a commit to amaranth-lang/amaranth that referenced this issue Mar 22, 2024
github-merge-queue bot pushed a commit to amaranth-lang/amaranth that referenced this issue Mar 22, 2024
abhilash-kumar-nair added a commit to modelon-community/impact-client-python that referenced this issue Apr 25, 2024
abhilash-kumar-nair added a commit to modelon-community/impact-client-python that referenced this issue Apr 25, 2024
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

Successfully merging a pull request may close this issue.

7 participants