When working in PyCharm, the preview mode of the document I am creating in Sphinx shows:
System Message: ERROR/3 (<stdin>, line 9) Unknown directive type "toctree". ..toctree:: :maxdepth: 2 file1 file2
I have included the autodoc
extension in my conf.py file. When I open the /build/index.html file, it works fine however. My question thus is: How can I remove this error from the PyCharm preview mode, so that I can preview my document without having to open the /build/index.html file all the time?
Sphinx is built on top of the Docutils library. The toctree
directive works with Sphinx, but it is not recognized by Docutils.
The PyCharm previewer does not use Sphinx (this is true for the free community edition and for Professional editions as of 2019); it likely uses rst2html.py from Docutils.
This mailing list thread is about the same error: https://web.archive.org/web/20180715103227/https://mail.python.org/pipermail/python-list/2008-June/493826.html