【问题标题】:Listing local sections first, linked pages last in TOC在目录中首先列出本地部分,最后列出链接页面
【发布时间】:2016-12-30 19:53:16
【问题描述】:

假设我有以下index.rst

Some global topic
=====================

.. toctree::
  :glob:

  nested/index

Global topic introduction
------------------------

还有nested/index.rst

Some sub-topic
==============

我希望 TOC 是这样的:

  • 一些全球性话题
    • 全球话题介绍
    • 一些子主题

相反,我得到以下信息:

  • 一些全球性话题
    • 一些子主题
    • 全球话题介绍

如何让本地部分先出现,链接页面在后?

【问题讨论】:

标签: python python-sphinx restructuredtext tableofcontents toctree


【解决方案1】:

这不是一个完美的解决方案,但是怎么样

.. contents::
   :local:

.. toctree::       
   :glob:
    nested/index

这会给你:

  • 一些全球性话题
    • 全球话题介绍
  • 一些子主题

【讨论】:

  • 不,这不适合我的文档。我的例子被简化了,实际上我有多层嵌套。我想我只是通过在某些顶级页面的 TOC 中手动列出文档来获得与您类似的结果,并且对此并不满意。
猜你喜欢
  • 1970-01-01
  • 2022-01-03
  • 1970-01-01
  • 2021-07-13
  • 1970-01-01
  • 2012-02-07
  • 1970-01-01
  • 2014-07-10
  • 2012-08-09
相关资源
最近更新 更多