--- id: mdformat-toc version: "0.5.0" license: MIT license_treatment: permissive maintenance: aging --- # mdformat-toc — Mdformat plugin to generate table of contents License: permissive · Maintenance: aging · Downloads: 105.9K/mo ## What it is and what it does Mdformat-toc extends mdformat, a Markdown formatter, with the ability to automatically generate and update a table of contents. You mark a location in your Markdown file with an HTML comment (), then run mdformat, and the plugin generates a ToC listing the headings in your document at that location. By default, the plugin creates HTML anchors for each heading so ToC links work across different Markdown renderers. You can configure which heading levels to include, disable anchor generation, and choose between GitHub and GitLab slug functions for link generation. The plugin is designed to work with mdformat's standard formatting workflow and requires only mdformat as a runtime dependency. Use it for: - Auto-generate and keep a table of contents synchronized in long Markdown documentation files. - Maintain consistent heading-to-anchor mappings across GitHub and GitLab hosted Markdown. - Integrate ToC generation into CI/CD pipelines that already use mdformat for Markdown formatting. - Generate navigable ToCs in README files without manually updating links when headings change. - Configure heading-level filtering to create ToCs that exclude top-level or deeply nested headings. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Mdformat-toc is an mdformat plugin that automatically generates and maintains a table of contents in Markdown files, with configurable heading levels and anchor generation. Yes, if you use mdformat and need automated table-of-contents generation in Markdown files. The package is straightforward to install, has no security vulnerabilities, and works with current Python versions. The 303-day gap since last release suggests maintenance rather than active development, but the repository is not archived and the plugin remains functional for its intended use. ## Install pip install mdformat-toc uv add mdformat-toc poetry add mdformat-toc ## Installing mdformat-toc Before you install: Low friction install with a single runtime dependency on mdformat. The package is aging (303 days since last release) but the repository remains active and not archived, with support for current Python versions (3.9 through 3.14). License in practice: MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you retain the license notice. Quickstart: pip install mdformat-toc # Add to your Markdown file: # # Then run: mdformat your_file.md Requires mdformat to be installed; mdformat-toc works as a plugin that extends mdformat's formatting capabilities. Verify before relying: - Whether the package is actively maintained or in maintenance-only mode given the 303-day gap since last release. - Real-world compatibility with Markdown renderers other than GitHub and GitLab. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 105.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags markdown table of contents generator, mdformat plugin toc, auto-generate markdown toc, markdown heading index, mdformat documentation helper, markdown anchor generation, toc markdown formatter, markdown-tooling, documentation-automation [View on SkillFed](https://skillfed.io/packages/mdformat-toc) · [View on PyPI](https://pypi.org/project/mdformat-toc/)