0

Hello i'm trying to create a docstring like this in Python:

    def hello_world_request(self, json):
    """
    foo
    Example JSON:
    
    {
        "helloWorld": [
            {
                "firstWord": "Hello",
                "lastWord": "World",
                "comment": "foo"
            }
        ]
    }

    :param json: json object
    """

Looking at the image below you can see the documentation. Is it possible to have each line in the docstring also show as a separate line in the documentation? So it looks like the docstring of the function.

documentation being compressed example

Kinder9211
  • 105
  • 1
  • 11
  • Did you tried entering another white line between fields? Btw you can check also https://stackoverflow.com/questions/3953692/syntax-for-documenting-json-structure – crissal May 31 '21 at 09:51
  • Adding a newline between the firstWord and lastWord works, however, this feels like a hack and not the intended way. – Kinder9211 May 31 '21 at 10:23

1 Answers1

1

figured it out

   """
    foo
     .. code-block:: json

    {
        "helloWorld": [
            {
                "firstWord": "Hello",
                "lastWord": "World",
                "comment": "foo"
            }
        ]
    }

    :param json: json object
    """
Kinder9211
  • 105
  • 1
  • 11