thlorenz/doctoc

📜 Generates table of contents for markdown files inside local git repository. Links are compatible with anchors generated by github or other sites.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 6 minutes ago
Type:CLI ToolCategory(s):Documentation ToolsDeveloper Tools
Added to GitGenius on September 15th, 2026
Created on May 27th, 2012
Open Issues & Pull Requests: 27 (+0)
GitHub issues: Enabled
Number of forks: 485
Total Stargazers: 4,465 (+0)
Total Subscribers: 59 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 118.5 days
Mean response time: 789.4 days
90th percentile: 2431.6 days
Tracked items: 68

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 13
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 902 days
Stale 30+ days: 13
Stale 90+ days: 9

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • help wanted (6)
  • bug (5)
  • feature request (5)
  • great first issue (1)

Most active issues this week

Detailed Description

DocToc is a command-line tool that generates tables of contents for markdown files inside local git repository, with links compatible with anchors generated by GitHub or other sites.

The tool solves the problem of maintaining accurate, up-to-date tables of contents in markdown documentation. It works by scanning markdown files for headings and automatically generating a linked table of contents that can be inserted into the document. The generated TOC is wrapped in special comment markers that allow DocToc to update the table when the document changes, rather than requiring manual edits each time headings are added or modified.

DocToc suits projects with markdown-heavy documentation that need to keep tables of contents synchronized with document structure. It works on individual files or recursively through directories, processing files with .md, .markdown, and .mdx extensions while ignoring .git and node_modules directories by default. The tool offers several modes useful for different workflows: a dry-run option for CI environments to verify documentation is up to date, a stdout mode for viewing output without modifying files, and an update-only mode that leaves files without existing TOCs untouched, making it compatible with tools like lint-staged. It can be integrated as a git hook to automate TOC updates as part of the commit process, and a Docker image is available for containerized environments.

The project maintains active continuous integration testing. Development activity shows consistent engagement with bug fixes and feature improvements being merged regularly. The tool receives updates addressing user-reported issues and requests for enhanced functionality across its various configuration options and output modes.