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?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435

1 Answers1

49
  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

Thomas Grainger
  • 2,271
  • 27
  • 34
mzjn
  • 48,958
  • 13
  • 128
  • 248