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

Weird formatting of events list from evented class docs #480

Open
jni opened this issue Jul 17, 2024 · 1 comment
Open

Weird formatting of events list from evented class docs #480

jni opened this issue Jul 17, 2024 · 1 comment

Comments

@jni
Copy link
Member

jni commented Jul 17, 2024

See e.g. layerlist:
https://napari.org/0.5.0/api/napari.components.LayerList.html#napari.components.LayerList

Note the double parentheses:

Screenshot 2024-07-17 at 2 52 21 PM

And the eventedlist:
https://napari.org/0.5.0/api/napari.utils.events.EventedList.html#napari.utils.events.EventedList

Now the parentheses are moved and the first word is in bold:

Screenshot 2024-07-17 at 2 53 22 PM

I haven't yet investigated whether this is a bug in the theme or the docs though.

@melissawm
Copy link
Member

OK I had a look at this, and this is basically a limitation of Napoleon and how it handles these custom sections. There are three ways of presenting the custom sections: general, params_style and returns_style. We have been using params_style (returns_style would be the same) and this style expects parameters to be defined as

param : type
     Long description

It will automatically create the parenthesis around the type for each parameter, which is what we observe. But then, for the custom Events section, we are manually adding parenthesis to each event type:

https://github.com/napari/napari/blob/bed967f81fcef2b86bd83d5c1b741d98cc2d91fe/napari/utils/events/containers/_evented_list.py#L66

That's why we get double parenthesis.

We can either remove the manual parenthesis from the docstrings (although that may make it weird, too):

Image

Or we can change the custom section to be a "general" section, which will show similar to Methods and Attributes:

Image

In any case, this is not a theme issue so I'll move it over to napari/docs.

@melissawm melissawm transferred this issue from napari/napari-sphinx-theme Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Prioritized
Development

No branches or pull requests

2 participants