Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate a Table of Contents (ToC) on a rendered Github Pages README.md?

Is there a way to generate a ToC on a rendered README.md hosted on Github Pages that doesn't require the use of local Jekyll plugins to generate it prior to uploading it to Github Pages?

like image 884
orschiro Avatar asked Jan 17 '19 19:01

orschiro


People also ask

How do I make a table of contents in markdown?

Press CTRL + SHIFT + P. Select Markdown: Create Table of Contents.

How do I add a table to a readme MD in GitHub?

You can create tables by assembling a list of words and dividing them with hyphens - (for the first row), and then separating each column with a pipe | . The final example is not correct because you need at least 3 hyphens as the documentation says. Great answer, thank you.

What is TOC in markdown?

Tutorials, Tips & Tricks. alexs77 August 16, 2017, 9:23am #1. 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.

Should you create tables of contents for your GitHub README?

If you regularly add and delete sections in your README file, it’s even worse because you have to remember to update the table of contents too. The more headings your document has, the worse it gets. It’s not realistic to manually create tables of contents for every GitHub README file. It does work, though. We will focus on that part for right now!

How to recreate table of contents in Markdown for GitHub README?

The table of contents on page 1 is what I wanted to recreate in Markdown for my GitHub README. My requirements were simple: Looks neat and organized. Clicking on the name of a section in the table of contents sends you directly to that section in the content itself.

Why is my GitHub README file so bad?

If you regularly add and delete sections in your README file, it’s even worse because you have to remember to update the table of contents too. The more headings your document has, the worse it gets. It’s not realistic to manually create tables of contents for every GitHub README file.

Can GitHub create a table of content for a wiki?

Update Aug. 2021: GitHub can create automagically table of content of your wiki! See my edited answer below. – VonC Aug 19 '21 at 21:37 GitHub now automatically generates a table of content for Wikis based on the headings.


1 Answers

According to this post, all you have to do is add {:toc} in your markdown page at the place you want a table of contents.

like image 185
Adrian J. Moreno Avatar answered Oct 05 '22 01:10

Adrian J. Moreno