无法让 sphinx 在 toctree 下链接到另一个文档 [英] Can't get sphinx to link under toctree to another document

查看:60
本文介绍了无法让 sphinx 在 toctree 下链接到另一个文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习狮身人面像,但只停留在基本示例上.我在源目录中的 make html 出现以下错误.

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.

我也尝试引用 intro 而不是 intro.rst 似乎都不起作用.index.rstintro.rst 在同一个目录下.我使用 sphinx-quickstart 和所有默认选项制作了这个项目.

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.

推荐答案

您需要在指令的选项与其内容之间留一个空行.您也不需要文件扩展名.改成这样:

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

这篇关于无法让 sphinx 在 toctree 下链接到另一个文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆