DocToc is a command-line utility that automatically generates and maintains tables of contents inside Markdown documents. It supports Markdown, Markdown Extended, and MDX files and can recursively process complete directory trees. Generated links can match anchor conventions used by GitHub, GitLab, Bitbucket, Node.js, and Ghost. Users can limit heading levels, exclude specific headings, control list formats, and choose where the generated table appears. Dry-run and update-only modes make it useful in continuous integration and staged commit workflows. Existing generated sections can be refreshed without manually editing their contents. DocToc can also run as a pre-commit hook to keep documentation navigation synchronized automatically.
Features
- Automatic Markdown table of contents generation
- Recursive directory processing
- GitHub, GitLab, Bitbucket, Node.js, and Ghost anchors
- Heading depth and exclusion controls
- Dry-run and update-only modes
- Pre-commit hook integration