gitbook-plugin-simple-page-toc

Create a table of content (TOC) for a page in your Gitbook


Keywords
gitbook-plugin
License
Apache-2.0
Install
npm install gitbook-plugin-simple-page-toc@0.1.2

Documentation

Gitbook Simple Page TOC Plugin npm version

This plugin inserts a table of content (TOC) section into your GitBook page. It is powered by the markdown-toc library.

Usage

Installation

Add the plugin to your book.json:

{
	"plugins" : [ "simple-page-toc" ]
}		

Create TOC

Place a <!-- toc --> code comment somewhere into your text. Generating your GitBook inserts a table of contents immediately after this comment.

Optional configuration

You can add the following configuration params to your book.json:

{
	"plugins" : [ 
		"simple-page-toc" 
	],
	"pluginsConfig": {
		"simple-page-toc": {
			"maxDepth": 3,
			"skipFirstH1": true
   		}
	}
}			
Name Type Default Description
maxDepth Number 3 Use headings whose depth is at most maxdepth.
skipFirstH1 Boolean true Exclude the first h1-level heading in a file.

Changelog

  • 0.1.0 Releases:
    • 0.1.0 First release
    • 0.1.1 Fixed invalid config example in README (thanks at15)
    • 0.1.2 Fixed bug: Titles with hyphen builds with wrong anchor link