在 sphinx 文档中启用“待办事项”功能

Enabling the `todo` feature in sphinx docs

我正在尝试使用 todo 功能,我在 sphinx-docs 上发现了一个 link 和以下语法

.. todo::

但它说我需要将 todo_include_todos 设置为 True,默认情况下它是 False,我需要更新哪个文件才能启用?

我找到了另一个 SO post Sphinx todo box not showing 但我认为它没有提到我需要设置配置的文件。

sphinx.ext.todo 是一个 Sphinx 扩展,可以通过将其添加到 conf.py:

的扩展列表中来启用
extensions = [
    'extname',
    'sphinx.ext.todo',
]

启用后,您需要通过将值 todo_include_todos 设置为 True 来配置它,同样在您的 conf.py:

# Display todos by setting to True
todo_include_todos = True

待办事项的主题支持各不相同。

另见 http://www.sphinx-doc.org/en/stable/config.html#confval-extensions

请注意,也可以在命令行上覆盖配置选项,这样可以更轻松地根据目标受众快速公开或隐藏 "to do"。我相信在这种情况下布尔值必须作为 01 传递...

sphinx-build -b html -D todo_include_todos=1 -c docs docs build/html

python -m sphinx -b html -D todo_include_todos=1 -c docs docs build/html