Skip to content

whzhyh/gitbook-plugin-toc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitbook-plugin-toc

This plugin will add table of content to the page and provide navigation function inside a page.

Add <!-- toc --> to the markdown files. When you build the book, it will insert a table of content where you insert <!-- toc -->. To automatically generate a table of content for every page without adding <!-- toc -->, set the auto option to true.

Preview

image

book.json Configuration Examples

Add a custom class to the TOC ul element:

{
	"plugins": ["toc"],
	"pluginsConfig": {
		"toc": {
			"addClass": true,
			"className": "toc"
		}
	}
}

You can add this config to add a HTML ClassName to the TOC ul element

Automatically generate TOC for every page

{
	"plugins": ["toc"],
	"pluginsConfig": {
		"toc": {
			"auto": true
		}
	}
}

Add title to generated TOC

image

{
	"plugins": ["toc"],
	"pluginsConfig": {
		"toc": {
			"title": "Table of Contents",
			"addTitleClass": "toc-title"
		}
	}
}

In this example, addTitleClass is used for the HTML ClassName for the h1 element used for the title.

About

No description, website, or topics provided.

Resources

License

Stars

21 stars

Watchers

4 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors