Test article, get the source on github.

Using Kramdown GFM

Basic Usage

You need to put this at the beginning of the page where you want the table of content to be displayed

* TOC
{:toc}

It will then render the markdown and html titles (lines that begins with # or using the <h1></h1> tages)

Using toc.js

Demo display of jekyll-table-of-contents by ghiculescu.

Customize with toc.js

toc.js stands for table of content, it is a js plugin that generates automatically a table of content of a post.

Use with this jekyll template

If you want to customize the theme it is up to you, you can add the toc.js file into the asset > js and add it into the page.html layout with:

<script src="/assets/js/toc.js" ></script>

Then you can use it as it is said on the repository.

Basic Usage

The script requires jQuery. First, reference toc.js in templates where you would like to add the table of content. Then, create an HTML element wherever you want your table of contents to appear:

<div id="toc"></div>

Then you put your post with titles and all like:

## Title
## Mid title 1
This is text on page one
## Mid title 2
This is text for page two
### Sub title 2.a
Some more text

Then at the end of your post, you call the .toc() function using:

<script type="text/javascript">
$(document).ready(function() {
    $('#toc').toc();
});
</script>

How it would look like

image