Can't get sphinx to link under toctree to another document

我与影子孤独终老i 提交于 2020-08-27 04:13:12

问题


I'm attempting to learn sphinx and am stuck on just the basic examples. I'm being given the following error on a make html in the source directory.

Running Sphinx v1.1.3
loading pickled environment... not yet created
building [html]: targets for 2 source files that are out of date
updating environment: 2 added, 0 changed, 0 removed
reading sources... [100%] intro                                                 
/home/owner/Desktop/doc/index.rst:11: ERROR: Error in "toctree" directive:
invalid option block.

.. toctree::
   :maxdepth: 2
   intro.rst
looking for now-outdated files... none found
pickling environment... done
checking consistency... /home/owner/Desktop/doc/intro.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] intro                                                  
writing additional files... genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 2 warnings.

Build finished. The HTML pages are in _build/html.

I also tried referencing intro instead of intro.rst neither seems to work. index.rst and intro.rst are in the same directory. I made the project with sphinx-quickstart and all default options.


回答1:


You need a blank line between a directive's options and its content. You also don't need the file extension. Change it to this:

.. toctree::
   :maxdepth: 2

   intro


来源:https://stackoverflow.com/questions/12426496/cant-get-sphinx-to-link-under-toctree-to-another-document

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!