pydata-sphinx-theme icon indicating copy to clipboard operation
pydata-sphinx-theme copied to clipboard

Field list format for different docstring styles

Open williamjamir opened this issue 4 years ago • 1 comments

Hello!

I have a question about the output of a docstring when using different documentation "styles". The image below illustrates the output of a class when using "ReStructured Text style" and "Numpy Style".

image

Shouldn't the style and structure of the output be the same for both cases? If not, is it possible to make the output of a docstring written with "ReStructuredText style" look the same as "Numpy style"? Using for example some other field or CSS?

Docstring used on the image:

"ReStructured Text style"

class CaseDescription:
    """

    Attributes
    ----------
    name : str
        Test 0

    physics : PhysicsDescription
        Test1

    time_options: TimeOptionsDescription
        Test2

    """

"Numpy Style"

class CaseDescription:
    """
    
    :ivar str name:
        Test 0

    :ivar PhysicsDescription physics:
        Test1

    :ivar TimeOptionsDescription time_options:
        Test2

    """

williamjamir avatar Nov 30 '20 00:11 williamjamir

there are many ways to generate documentation from the docstrings. there is the pure rst that you used in your first example and the Napoleon and Numpy styles. The latter create very different HTML outputs and are widely used in the Python community. I think it could be considered as a feature to have different ways of displaying docstring so that developers can select the one that fits best with their documentation.

Could you explain why they should behave the same?

12rambau avatar Jun 23 '22 08:06 12rambau

This issue has been closed because it has been inactive for more than a year. You may reopen this issue if it has been closed in error.

12rambau avatar Sep 12 '22 08:09 12rambau