Search code examples
gitlabwiki

Is there a way to display all sub wikis in an index page in gitlab?


So in gitlab you can use [[_TOC_]] to display a table of contents for the current page - which works on headings.

But I want to have a heirachy in my wiki like:

<home-url>/Project1
<home-url>/Project1/Tools
<home-url>/Project1/Debugging
<home-url>/Project1/Debugging/GDB
<home-url>/Project1/Debugging/MSVS

Such that in the Project1 page I get an index (links) to each section similar to the table of contents layyout - e.g.:

 - Tools
 - Debugging
    - GDB
    - MSVS

I can do this manually, but that's a pain to maintain. Is there some automatic tool to do this for me like TOC?


Solution

  • The TOC support steams from issue 2494, and was implemented in issue 21901, which gave us the Markdown [[_TOC_]] syntax.

    Even the current request to support [TOC] instead (issue 14193) does not mention any layout option to include a hierarchical display.

    As mentioned in the first issue:

    If you need more control, you can open a new issue at https://gitlab.com/gitlab-org/gitlab/issues and upvote it.

    For example: issue 215988: "Add Gollum depth level support for Wikis Table of Contents [[_TOC_]]"

    Having the ability to limit a [[TOC]] depth is useful to show a more synthetic view of a page while keeping its deeply nested structure.


    See also GitLab 15.3 "Visualize table of contents in the WYSIWYG wiki editor".