[英]Python auto docstring with sphinx new line
I am wondering how can I have a new line when generating auto documentation using Sphinx.我想知道在使用 Sphinx 生成自动文档时如何换行。 I am not using the default Sphinx docstring format reStructuredText, but I am using the Numpydoc format.我没有使用默认的 Sphinx 文档字符串格式 reStructuredText,但我使用的是 Numpydoc 格式。 I tried using '\\n' yet it makes a line break, and I only need a new line.我尝试使用 '\\n' 但它会换行,我只需要一个新行。 Here is an example of a Python module ...这是 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
"""
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 .文档字符串由两个正文元素组成:一个常规段落和一个行块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.