Support for directive :toc:, to embed a page table of contents
Open
Nobody has claimed this yet.
Feature Request
- Dominant language
- Ruby
- Stars
- 930
- Forks
- 465
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 27
Description
(@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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by locating RDoc's header parsing and HTML rendering entry points, then trace how page content is converted to output. Done means :toc: creates links for later headers, uses nested lists for well-formed levels, and falls back to a flat list otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100