如何在Sphinx TOC中包含`genindex‘? [英] How can i include the `genindex` in a Sphinx TOC?

查看:19
本文介绍了如何在Sphinx TOC中包含`genindex‘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sphinx在构建文档时生成名为genindex的索引,因此forbids to use that name for a document。现在,我如何在目录中包含指向该索引的链接?

我试过了:

.. toctree::
   :maxdepth: 2

   genindex
   api


Indices and tables
==================

* :ref:`genindex`

虽然最后一行确实在文档中创建了指向该索引的链接,但内部版本在创建目录时不知道引用:

WARNING: toctree contains reference to nonexisting document 'genindex'

推荐答案

创建包含以下内容的文件genindex.rst

Index
=====

index.rst添加:

.. toctree::
   :hidden:

   genindex

如果您还希望站点上的链接和文本"索引"不仅位于左侧导航中,则删除:hidden:

这篇关于如何在Sphinx TOC中包含`genindex‘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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