无法在Sphinx中获取TOCTREE来显示链接

时间:2012-12-29 07:24:31

标签: python python-sphinx

我是Sphinx的新手。我尝试了教程但是我没能在内容中生成链接。我得到的错误

C:\Users\mhaikalm\sphinxtest\source\index.rst:11: WARNING: toctree contains refe
rence to document 'intro' that doesn't have a title: no link will be generated
C:\Users\mhaikalm\sphinxtest\source\index.rst:11: WARNING: toctree contains refe
rence to document 'zuhdi' that doesn't have a title: no link will be generated
writing additional files... (0 module code pages) genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 3 warnings.

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

我在zuhdi.rst所在的目录中创建了intro.rstindex.rst。如何将标题放在文件中?

为了您的信息,我的index.rst包含以下行:

Contents:

.. toctree::
   :maxdepth: 2

   intro
   zuhdi

我是否必须存在文件才能将链接放在toctree中? intro.rstzuhdi.rst只是一个空文件。

1 个答案:

答案 0 :(得分:22)

您收到此错误是因为intro.rst中没有标题 要解决此问题,请为intro.rst添加标题。假设您希望标题为My Title,则可以通过将以下两行作为intro.rst的第一行添加标题:

My Title
*********

请注意,您必须有足够的*字符才能完全标记您的标题,否则您将收到有关格式错误的标题或其下划线的其他错误

希望这有帮助

相关问题