无法让狮身人面像在toctree下链接到另一个文档上

问题描述 投票:6回答:1

我正在尝试学习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 和所有默认选项。

python python-sphinx restructuredtext toctree
1个回答
15
投票

你需要在指令的选项和内容之间空一行。你也不需要文件的扩展名。改成这样。

.. toctree::
   :maxdepth: 2

   intro
© www.soinside.com 2019 - 2024. All rights reserved.