我的python项目中有以下docString:
def challenge():
"""Route for POST a challenge.
For call this route, we need to pass a serialNumber on body form.
If this serialNumber is in the database and corresponds to a tablet we call methods for create challenge
:returns: An HTTP response with a challenge
EXAMPLE::
REQUEST
curl --location --request POST 'xxxx:xxxx/challenge'
--form 'serialNumber="xxxxx"'
RESPONSE
{
"challenge": "xxxx"
}
"""
当我运行make html时,sphinx会给我以下错误:
docstring of src.modules.challenge.router.challenge:15: WARNING: Definition list ends without a blank line; unexpected unindent.
而且格式根本不是我在文档中想要的。我希望我的API的每个路由都以文本块或代码块的形式插入请求/响应的示例。
在EXAMPLE::
和REQUEST
之间添加一个空行。
块(段落(必须用空行与其他块隔开。看见https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-块。