首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >意外取消缩进的python-sphinx

意外取消缩进的python-sphinx
EN

Stack Overflow用户
提问于 2021-04-23 15:27:11
回答 1查看 127关注 0票数 0

我的python项目中有以下docString:

代码语言:javascript
复制
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会给我以下错误:

代码语言:javascript
复制
docstring of src.modules.challenge.router.challenge:15: WARNING: Definition list ends without a blank line; unexpected unindent.

而且格式化并不是我在文档中想要的。我希望API的每个路由都以文本块或代码块的形式插入一个请求/响应示例。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-04-23 16:54:11

EXAMPLE::REQUEST之间添加一个空行。

块(段落)必须用空行与其他块分开。参见https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67225702

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档