简体   繁体   English

如何将本地目录包含到 Sphinx 文档中?

[英]How to include a local table of contents into Sphinx doc?

How to include a local table of contents into Sphinx doc?如何将本地目录包含到 Sphinx 文档中?

I tried我试过

.. toc:: 

But that doesn't seem to have any effect: nothing is inserted in the document.但这似乎没有任何效果:文档中没有插入任何内容。

Basically I need links to the sections in the current page to be placed at a certain location of each page.基本上,我需要将当前页面中的部分链接放置在每个页面的特定位置。

Is this possible?这可能吗?

I'm not 100% sure this is what you're looking for, but the .. contents:: directive may help.我不是 100% 确定这就是您要查找的.. contents:: ,但是.. contents::指令可能会有所帮助。 By default, it'll give you the headings for the whole page, wherever you put the directive.默认情况下,无论您将指令放在何处,它都会为您提供整个页面的标题。 With :local: specified, it will generate a local TOC for the headings below where you put the directive (handy for sub-section tocs).指定:local: ,它将为下面放置指令的标题生成本地 TOC(对于子节目录很方便)。

.. contents:: Table of Contents
    :depth: 3

More details here: http://docutils.sourceforge.net/docs/ref/rst/directives.html#table-of-contents更多细节在这里: http : //docutils.sourceforge.net/docs/ref/rst/directives.html#table-of-contents

I had more luck with:我有更多的运气:

.. contents:: Table of Contents
   :depth: 1
   :local:
   :backlinks: none

The backlinks gets rid of the annoying links back from the headings to the toc.反向链接摆脱了从标题到目录的烦人链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM