首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sphinx‘`todo`’忽略Python文档字符串中的`todo`

Sphinx‘`todo`’忽略Python文档字符串中的`todo`
EN

Stack Overflow用户
提问于 2022-10-29 10:44:32
回答 1查看 46关注 0票数 0

我使用的是狮身人面像的todo扩展,但是下面代码中显示的todo被忽略了--知道为什么吗?它可以“查看”放置在index.rst文件中的index.rst,以便启用todo处理。谢谢你的建议,因为我没有主意了!

代码语言:javascript
复制
"""This is a test class definition."""
from typing import TypeVar

TypeTestMe = TypeVar("TypeTestMe", bound="TestMe")

class TestMe(object):
    """Simple object to test sphinx"""
    def __init__(self: TypeTestMe, name: str) -> None:
        """
        Constructor for the object.

        The first line is brief explanation, which may be completed with
        a longer one. For instance to discuss about its methods. The only
        method here is :func:`function1`'s. The main idea is to document
        the class and methods's arguments with

        - **parameters**, **types**, **return** and **return types**::

        :param str: The name of the owner of this object
        :type arg1: string
        :return: None

        .. todo::

        Todo in source code.
        """
EN

回答 1

Stack Overflow用户

发布于 2022-10-29 11:27:32

好的,一堆错误都证明了!

code

  • todo是在autodoc之上构建的,所以如果autodoc没有记录您的代码模块,也不会得到任何todo;如果这是错误

  • ,那么修复您的autodoc配置如果是错误

  • ,则todo块的语法是缩进的,所以< code >h 212g 213

代码语言:javascript
复制
.. todo:: This comment will appear
.. todo::
This comment is ignored because of bad indentation and you get a warning
.. todo::
   This is the correct indentation and this todo will appear.

  1. 最后记得检查您的todo配置是否正确。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74244621

复制
相关文章

相似问题

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