无法使Sphinx在toctree下链接到另一个文档

13

我想学习Sphinx,但卡在基础示例上了。在源代码目录中执行make html时,出现以下错误:

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.

我还尝试过引用intro而不是intro.rst,但似乎都不起作用。index.rstintro.rst在同一个目录中。我使用sphinx-quickstart创建了这个项目,并选择了所有默认选项。

1个回答

27

在指令的选项和内容之间需要留出一个空行。此外,您不需要文件扩展名。将其更改为以下内容:

.. toctree::
   :maxdepth: 2

   intro

6
那个该死的空白行,让我花费了6个小时! - markroxor

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接