Open AleksandarPetrov opened 5 years ago
This would be very helpful. Is there a reason it hasn't been merged?
Can this be merged or a reason given why it's not merged?
This is already available in upstream Sphinx, if you're not stuck with <=1.2.
Thanks for the reply. I'm maybe being silly, but can't see how this is meant to work?
napoleon_custom_sections = [('Section Name', 'Parameters')]
The above in conf.py
adds the section with correct formatting but replaces the name with Parameters. The desired behaviour here is that the formatting is used but the custom name remains.
I'm sorry, I read the diff and thought this is about something similar to this. I'm not exactly sure how this patch accomplishes that and how we can have this in latest Sphinx.
I'm not exactly sure how this patch accomplishes that and how we can have this in latest Sphinx.
In my experience this patch works as advertised.
Just to note though that the required use of
napoleon_use_param = False
Breaks proper formatting of type hints
@mcrav Thanks for the reply. I'm maybe being silly, but can't see how this is meant to work?
napoleon_custom_sections = [('Section Name', 'Parameters')]
The above in
conf.py
adds the section with correct formatting but replaces the name with Parameters. The desired behaviour here is that the formatting is used but the custom name remains.
With sphinx-4.0 and
napoleon_custom_sections = [('Section Name', 'params_type')]
this works as expected (i.e., instead of parameters, the intended section name is preserved and sphinx renders section name accordingly).
@rknegjens In my experience this patch works as advertised.
Yes, and the feature in Sphinx that @McSinyx linked does too. I'm unclear on whether this is true for Sphinx-3.0, but certainly for +4.0.
When using
The
Custom name
section will have the formatting of theParameters
section, but the custom name. This follows the way theExample
section worked (it already takes the custom name).This was requested also in this issue: https://github.com/sphinx-contrib/napoleon/issues/2