Skip to content

Support for directive :toc:, to embed a page table of contents #801

Open
@BurdetteLamar

Description

@BurdetteLamar

(@kou suggested this feature request.)

An embedded directive :toc: is replaced by the table of contents (TOC) derived from the down-page headers:

  • If the headers are well-formed (see below), the TOC is structured as nested lists; if not, the TOC is a single flat list.
  • Each TOC entry is a link to its corresponding header; the text for the link is the text from the header.
  • Headers preceding the :toc: directive are not included in the TOC.

The headers are well-formed if:

  • The first-found header is as high-level as any headers that follow it. E.g., if the first-found header is level 2, there are no following level-1 headers (but there may be additional level-2 headers).
  • There are no level "jumps". E.g., a level-2 header followed by a level-4 header.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions