Disabling individual Sphinx warning messages
Asked Answered
G

2

33

I have many .rst files in my Sphinx tree which are intentionally excluded from any index tree. I get warnings like

 /filename.rst:: WARNING: document isn't included in any toctree

How can I suppress specific warnings in Sphinx?

Gavelkind answered 17/10, 2012 at 9:23 Comment(0)
L
50
  1. Are there .rst files in your Sphinx project whose content you don't want in the output?

    Use the exclude_patterns configuration variable. No output (and no warning messages) will be generated for files matching the specified patterns. See http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-exclude_patterns.

  2. Are there .rst files in your Sphinx project that are not part of any toctree but whose content should be in the output?

    Add :orphan: at the top of each .rst file to suppress the warning message. See http://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html#file-wide-metadata

you can also use https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-suppress_warnings

Linton answered 28/10, 2012 at 13:34 Comment(0)
P
1

I could fix this issue by adding the below config in the conf.py file

suppress_warnings = [
    'toc.not_readable',  # Suppress warnings about excluded toctree entries
]
Poulson answered 30/5, 2024 at 0:41 Comment(2)
Where do you get the list of warning identifiers?Gavelkind
sphinx-doc.org/en/master/usage/configuration.html, search for 'suppress_warnings'.Fromenty

© 2022 - 2025 — McMap. All rights reserved.