DEV Community

Ninan Kara
Ninan Kara

Posted on

Day 3: Auto Generate TOC Github Markdown

Intro

After hiatus, I decided to continue my random note of my programming experience. Recently I am exploring markdown for filling wiki document in Github. I am used to write in Gitlab, and recently move to Github. I found something interesting when generating the table contents in the md document.

Tools Used

I am using:

  • VS Code
  • Github

Auto Generate TOC

Honestly I don't know anything about this auto feature. I just have habit to create TOC in every wiki document. I didn't find this feature in Gitlab. So I am curious whether this is Github feature, or VS Code feature.

Following is the step I did to generate the TOC.

  1. Create Wiki page document for my Github project. Click the wiki tab in the project repository.
  2. Clone the wiki repository to your local repository.
  3. Create heading with # for h1, ## for h2, and so on.
  4. Move to the beginning of the markdown document.
  5. Type Table of Contents with h1 format. Enter.
  6. Type - to start the list. And type the first section with internal link, - [Example](#example)
  7. Click Enter.
  8. Save your document.

Voila!! Your TOC will be generated automatically based on heading level you've created.

Table of Content Github Wiki

See the up to date part? If you update the structure, it will be updated automatically too once you save the document.
I don't know about others, but I really like this auto feature :D

Top comments (0)