gitlabwikigitlab-wiki

How can I create a table of content in GitLab wiki?


I am a big fan of the __TOC__ that creates a table of content on a Wikimedia page.

Whenever you write things like this on a Wikimedia page:

This is a page for my project

## Credits ##

bla bla

## License ##

bla bla

__TOC_ automagically creates a table of content that allows you to navigate through inner links of the page.

I noticed that this is somehow possible in GitHub wiki pages: How do I create some kind of table of content in GitHub wiki? by using different tricks.

However, I miss this feature in GitLab wiki pages. Does it provide such functionality?


Solution

  • So this exists! I finally found a Merge Request in in the GitLab Community Edition: Replace Gollum [[_TOC_]] tag with result of TableOfContentsFilter

    As its name describes, to have a table of contents you need to write the following:

    [[_TOC_]]
    

    All together, you can write something like:

    This is a page for my project
    
    [[_TOC_]]
    
    ## Credits
    
    bla bla
    
    ## License
    
    bla bla
    

    and will show like this:

    enter image description here

    This is available from the GitLab 8.6 release as described in its milestone.