我的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的每个路由都以文本块或代码块的形式插入一个请求/响应示例。
发布于 2021-04-23 16:54:11
在EXAMPLE::和REQUEST之间添加一个空行。
块(段落)必须用空行与其他块分开。参见https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks。
https://stackoverflow.com/questions/67225702
复制相似问题