禁用单个Sphinx警告消息

Mik*_*maa 25 python-sphinx

.rst我的Sphinx树中有很多文件被故意排除在任何索引树之外.我收到警告

 /filename.rst:: WARNING: document isn't included in any toctree
Run Code Online (Sandbox Code Playgroud)

如何在Sphinx中抑制特定警告?

mzj*_*zjn 36

  1. 您的Sphinx项目中是否有.rst文件,其输出中不需要您的内容?

    使用exclude_patterns配置变量.对于与指定模式匹配的文件,不会生成输出(也没有警告消息).请参阅http://sphinx-doc.org/config.html#confval-exclude_patterns.

  2. 您的Sphinx项目中是否有.rst文件不属于任何toctree,但其内容应该在输出中?

    :orphan:在每个.rst文件的顶部添加以禁止显示警告消息.见http://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html#file-wide-metadata