rdoc icon indicating copy to clipboard operation
rdoc copied to clipboard

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

Open BurdetteLamar opened this issue 4 years ago • 0 comments

(@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.

BurdetteLamar avatar Mar 23 '21 19:03 BurdetteLamar