On Tue, May 11, 2021 at 6:32 AM Louis King wrote: > > Newbe question. I can't add any files to the toctree. > > Using a windows system. Installes Sphinx no problem. > I created a directory on a D: drive > changed to the new directory > used sphinx-quickstart to build structure > used make html to generate an empty ooutput > copy a file wabbitFB.py to the new directory > add wabbitFB to the index.rst > .. toctree:: > :maxdepth: 2 > > wabbitFB > > Running make html again results in a warning: > D:\tstsphinx\index.rst:9: WARNING: toctree contains reference to nonexisting > document 'wabbitFB' > > What am I missing?? This has got to be dumb simple, but I don't see it.
The "toctree" directive can only contain Sphinx source files. By default, Sphinx only supports reStructuredText files (with the suffix .rst), but support for other source files can be added with extensions. You are trying to use a Python file (with the suffix .py). If you want to show the contents of this file in your documentation, you should create a .rst file and in that you can use the "literalinclude" directive (https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-literalinclude). If you want to show the documentation of the functions and classes that are defined in your Python file, you can try the "autodoc" extension (https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html). Or is it something else you want to use your .py file for? cheers, Matthias -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAFesC-e4yzN2m63M_6QSG8ieN8Hd1U%2Bn__6wEH%3DRzc3hRC%3DQqw%40mail.gmail.com.
