WARNING: document isn't included in any toctree for included file

后端 未结 4 1166
故里飘歌
故里飘歌 2020-12-25 09:29

I\'m getting the warning:

WARNING: document isn\'t included in any toctree

for files that exist in the document because they\'ve been expli

相关标签:
4条回答
  • 2020-12-25 10:01

    Indentation worked:

      toctree::   
       :maxdepth: 2
           hello <h.rst>
           abc <your.rst>
    
    0 讨论(0)
  • 2020-12-25 10:02

    I had a situation where I couldn't edit the documents I wanted to be brought in as a git submodule. The documents already had their own structure including TOC page written in Markdown and I did want them to be processed by sphinx for consistency of formatting.

    What I found I could do is specify a hidden toctree to make toctree aware of the documents, but not clutter up the toctree or add a bunch of errors to my sphinx build output.

    * :doc:`Additional Book <external/index>`
    
    .. toctree::
       :hidden:
    
       external/documentA.md
       external/documentB.md
    
    0 讨论(0)
  • 2020-12-25 10:06

    If you only want to ..include:: a document in another document, without having it appear in any toctree.

    Add :orphan: to the top of your document to get rid of the warning.

    This is a File-wide metadata option. Read more from the Sphinx documentation.

    0 讨论(0)
  • 2020-12-25 10:20

    Sphinx will complain about this whether the file is included or not.

    However, you can specifically exclude files by using the exclude_patterns config value.

    So for your case you might try to change Sphinx's conf.py file with something like:

    exclude_patterns = ['pages/reference-architecture', 'some/other/file.txt']
    

    You can exclude individual files, directories, or use file globbing patterns to match groups of files this way.

    EDIT: See: Joakim's answer for another option that was added after this answer was created.

    0 讨论(0)
提交回复
热议问题