Python 带有 sphinx 新行的自动文档字符串

Python auto docstring with sphinx new line

我想知道如何在使用 Sphinx 生成自动文档时换行。我没有使用默认的 Sphinx 文档字符串格式 reStructuredText,但我使用的是 Numpydoc 格式。我尝试使用 '\n' 但它会换行,我只需要换行。这是一个 Python 模块的例子...

""" 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 
"""

只需在第一行后加一个空行即可:

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 
    """

正文元素由空行分隔。文档字符串由两个主体元素组成:常规 paragraph and a line block.