GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Table of Contents support · Issue #189 · commonmark/commonmark-java

Table of Contents support #189

New issue
Copy link
New issue
Copy link
Open
Open
Table of Contents support#189
Copy link
Labels
enhancementhelp wanted

Description

@GregJohnStewart
GregJohnStewart
opened on Oct 15, 2020
Issue body actions

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

Reacted by SoltauFintel

Activity

  1. GregJohnStewart
    added
    bug
    on Oct 15, 2020
  2. GregJohnStewart commented on Oct 15, 2020

    @GregJohnStewart
    GregJohnStewart
    on Oct 15, 2020
    Author
    More actions

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

  3. robinst
    added
    enhancement
    help wanted
    and removed
    bug
    on Oct 16, 2020
  4. robinst commented on Oct 16, 2020

    @robinst
    robinst
    on Oct 16, 2020
    Collaborator
    More actions

    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.

  5. robinst commented on Oct 16, 2020

    @robinst
    robinst
    on Oct 16, 2020
    Collaborator
    More actions

    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.

  6. colinodell commented on Jun 26, 2021

    @colinodell
    colinodell
    on Jun 26, 2021
    More actions

    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
    Reacted by Robin Stocker and jngross95
    Reacted by Sooxin and jngross95
  7. ia3andy commented on Jan 23, 2026

    @ia3andy
    ia3andy
    on Jan 23, 2026
    Contributor
    More actions

    You could also generate it in the browser like here (and get scroll sync in bonus):
    https://ia3andy.github.io/the-code-site/posts/discover-roq-the-quarkus-way-for-static-site-generation-in-java/

    Here is the script:
    https://github.com/ia3andy/the-code-site/blob/main/web/toc.js

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.