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:

  1. {
  2. "plugins" : [ "simple-page-toc" ]
  3. }

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:

  1. {
  2. "plugins" : [
  3. "simple-page-toc"
  4. ],
  5. "pluginsConfig": {
  6. "simple-page-toc": {
  7. "maxDepth": 3,
  8. "skipFirstH1": true
  9. }
  10. }
  11. }
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