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.

3 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.

5 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

1 Like

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

The related issue is here: https://gitlab.com/gitlab-org/gitlab-ce/issues/45388

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.

2 Likes