Skip to content

Table of Contents support #189

Open
Open

Description

@GregJohnStewart

Would be great to have [TOC] support to automatically list out the contents of the different headers. Probably would be a good candidate for another extension

Activity

  1. GregJohnStewart commented on Oct 15, 2020

    @GregJohnStewart
    Author

    Sorry, meant to make this a feature request, not a bug

  2. robinst commented on Oct 16, 2020

    @robinst
    Collaborator

    Hey! Yeah sounds like a useful extension. Looks like there's a couple of existing syntaxes, from here: https://alexharv074.github.io/2018/08/28/auto-generating-markdown-tables-of-contents.html

    • {:toc}
    • [[_TOC_]]
    • [toc]

    And this one doesn't seem to need any syntax, so I assume if the extension is used it is inserted at the top of the document: https://commonmark.thephpleague.com/1.5/extensions/table-of-contents/

    Any thoughts about what we should do? Some more research into prior art would be good.

  3. robinst commented on Oct 16, 2020

    @robinst
    Collaborator

    Also, it would probably need to be paired with the heading anchor extension (https://github.com/atlassian/commonmark-java#heading-anchor) to be able to link to headers.

  4. colinodell commented on Jun 26, 2021

    @colinodell

    And this one doesn't seem to need any syntax, so I assume if the extension is used it is inserted at the top of the document

    We support three options:

    • Place the ToC at the very top of the document - no syntax needed (default)
    • Place the ToC just prior to the first heading in the document - no syntax needed
    • Place the ToC anywhere that a given placeholder string (like [TOC]) is found; this placeholder syntax is customizable
  5. ia3andy commented on Jan 23, 2026

    @ia3andy
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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