[英]Sphinx autofunction generate python docstring without newlines
I have a simple python package with 1 module containing the following function: 我有一个简单的python包,其中包含以下函数的1个模块:
def sample_addition(num1=1, num2=2):
"""adding 2 numbers as an example
this function will add 2 numbers in case of failre it will raise an exception
@param num1: first number
@type num1: float
@param num2: second number
@type num2: float
@return: addition result
@rtype: float
"""
return num1 + num2
When using .. autofunction:: sample_addition
and make html
it results in: 使用
.. autofunction:: sample_addition
make html
导致:
general.sample_addition(num1=1, num2=2)
adding 2 numbers as an example
this function will add 2 numbers in case of failre it will raise an exception @param num1: first number @type num1: float @param num2: second number @type num2: float @return: addition result @rtype: float
I have installed and used sphinx_epytext
inside the conf.py -> extensions
but it didn't help to convert and show the Epytext properly 我已经安装和使用
sphinx_epytext
里面conf.py -> extensions
,但它无助于正确转换并显示Epytext
Question: 题:
How can i allow it to see the new lines from the docstring? 我怎样才能让它看到docstring中的新行?
Just like markdown and rst, it requires newline to seperate differert paragraphs, you need to add newline between this function...
and @param ...
like this: 就像markdown和rst一样,它需要newline来分隔不同的段落,你需要在
this function...
和@param ...
之间添加换行符@param ...
像这样:
def sample_addition(num1=1, num2=2):
"""adding 2 numbers as an example
this function will add 2 numbers in case of failre it will raise an exception
@param num1: first number
@type num1: float
@param num2: second number
@type num2: float
@return: addition result
@rtype: float
"""
return num1 + num2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.