1

我想知道在使用 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 
"""
4

1 回答 1

1

只需在第一行之后添加一个空行:

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

正文元素由空行分隔。文档字符串由两个正文元素组成:一个常规段落和一个行块

于 2018-08-14T15:28:09.050 回答