简体   繁体   中英

Python auto docstring with sphinx new line

I am wondering how can I have a new line when generating auto documentation using Sphinx. I am not using the default Sphinx docstring format reStructuredText, but I am using the Numpydoc format. I tried using '\\n' yet it makes a line break, and I only need a new line. Here is an example of a Python module ...

""" This is the first sentences 
| this is the second sentence at line 2 ... note that vertical bar 
| this is the second sentence at line 3 ... note that vertical bar 
...... 
def function1 (input):
    """ this function docstring starts here
    | this is not sentence number 2 at the vertical bar is not working 
    | this is not sentence number 3 at the vertical bar is not working 
    | this is not sentence number 4 at the vertical bar is not working 
"""

Simply add a blank line after the first line:

def function1 (input):
    """ this function docstring starts here

    | this is not sentence number 2 at the vertical bar is not working 
    | this is not sentence number 3 at the vertical bar is not working 
    | this is not sentence number 4 at the vertical bar is not working 
    """

Body elements are separated by blank lines. The docstring consists of two body elements: a regular paragraph and a line block .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM