Miss any of our Open RFC calls?Watch the recordings here! »

@minipx/gatsby-remark-toc

1.1.0 • Public • Published

Gatsby

gatsby-remark-toc

⚛️ 📄 :rocket:

Adds a table of contents to Markdown files using mdast-util-toc

Current TravisCI build status. Current npm package version. Downloads per month on npm.

🚀 Install

npm install gatsby-remark-toc --save

🎓 How to use

// in your gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-transformer-remark',
    options: {
      plugins: [
        {
          resolve: 'gatsby-remark-toc',
          options: {
            header: 'Table of Contents', // the custom header text
            include: [
              'content/**/*.md' // an include glob to match against
            ]
          }
        }
      ]
    }
  }
];

additionally, you can pass custom options directly to mdast-util-toc like so:

// in your gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-transformer-remark',
    options: {
      plugins: [
        {
          resolve: 'gatsby-remark-toc',
          options: {
            header: 'Table of Contents', // the custom header text
            include: [
              'content/**/*.md' // an include glob to match against
            ],
            mdastUtilTocOptions: {
              maxDepth: 2
            }
          }
        }
      ]
    }
  }
];

Keywords

none

Install

npm i @minipx/gatsby-remark-toc

DownloadsWeekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

154 kB

Total Files

6

Last publish

Collaborators

  • avatar