Table Of Contents (TOC) in Markdown (Wiki and general)

Some markdown editors (like stackedit.io) support a [TOC] “command”, which will insert/show a Table Of Contents, based on the headlines of the current document.

It would be good, if the markdown engine used by Gitlab for on-premise installations would support [TOC] as well. Both for Wikis and also for normal “in-code” .md markdown files. Especially for lengthy documents, so that people quickly can see, what’s documented there.

2 Likes

I found https://gitlab.com/gitlab-org/gitlab-ce/issues/2494 and saw, that [[_TOC_]] is supported.

It works - great! :slight_smile:

Nonetheless, it would be great, if [TOC] could be supported as well, to be compatible with Stackedit and others, who use this tag.

8 Likes

small remark / addition.
This seems not to work for Markdown files in the repository (for example readme.md).

My assumption is that this is a wiki specific feature of Markdown in Gitlab.

04

This seems not to work for Markdown files in the repository (for example readme.md).

The related issue is here: Support for TOC in README files (#45388) · Issues · GitLab.org / GitLab FOSS · GitLab

It looks like it depends on the CommonMark migration.

Just for the record I do see that ToC in .md is supported with recently version maybe after https://gitlab.com/gitlab-org/gitlab/-/issues/21901 was resolved.

3 Likes

Sorry what is the status for Readme.md?

I can see TOC menu auto-generated while opening the file separately but not when viewing the whole Project page.
Github has that menu in place.

Thank you 130s.
It’s work.