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

Hai*_*uha 17 python python-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.
Run Code Online (Sandbox Code Playgroud)

我创建zuhdi.rstintro.rst在同一目录中index.rst.如何将标题放在文件中?

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

Contents:

.. toctree::
   :maxdepth: 2

   intro
   zuhdi
Run Code Online (Sandbox Code Playgroud)

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

ins*_*get 26

您收到此错误,因为您没有标题intro.rst.
要解决此问题,请添加标题intro.rst.假设你想要你的标题My Title,那么可以通过将以下两行作为第一行来添加标题intro.rst:

My Title
*********
Run Code Online (Sandbox Code Playgroud)

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

希望这可以帮助

  • 我的标题 ======= 也可以 (2认同)
  • 奇怪的是,H1 输出的简单“#”未被识别为标题。 (2认同)