我正在使用Sphinx的todo
扩展,但下面代码中显示的todo
被忽略了——有什么想法吗?它确实";参见";将todo
放入index.rst
文件中,以便启用todo
处理。谢谢你的建议,因为我没有主意了!
"""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.
"""
好吧,结果是一大堆错误!
todo
注释只从文档字符串中提取,所以不用麻烦将它们放入代码中的随机注释中todo
是在autodoc
之上构建的,所以如果autodoc
没有记录您的代码模块,您也不会得到任何todo
;如果出现以下错误,请修复您的autodoc配置todo
块的语法是区分缩进的,因此
.. 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.
- 最后记得检查您的
todo
配置是否正确