Registry / serialization / mdformat-toc

mdformat-toc

JSON →
library0.5.0pypypi✓ verified 84d ago

A plugin for mdformat that automatically generates a table of contents (TOC) in Markdown documents. Version 0.5.0, requires Python >=3.9. Release cadence is low, maintained as part of the mdformat plugin ecosystem.

pip install mdformat-toc
INSTALL
IMPORT
SIG · MDFORMAT-TOC
M
mdformat-toc
serializationpythonv0.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mdformat_toc
import mdformat_toc
Plugin is auto-discovered by mdformat; explicit import is optional.

Formats a Markdown string and generates a table of contents using the plugin.

import mdformat import os # Create a sample Markdown file md_content = """# Title ## Section 1 Content here. ## Section 2 More content. """ # Format with mdformat, using the toc plugin formatted = mdformat.text(md_content, extensions={"toc"}) print(formatted)
Debug
Known issues
deprecatedPython 3.8 support was dropped in version 0.4.0. Use Python 3.9+.
fix
Upgrade to Python 3.9+
affects: <=0.3.2
gotchaPlugin auto-registration may not work if mdformat-toc is not installed in the same environment as mdformat. Ensure both are installed together.
fix
Install mdformat-toc in the same environment: pip install mdformat mdformat-toc
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'mdformat_toc'
Plugin not installed or not in the current Python environment.
fix
Run `pip install mdformat-toc` to install the plugin.
mdformat.exceptions.ParsingError: ... toc ...
The Markdown content has syntax issues that prevent TOC generation (e.g., incomplete headings).
fix
Ensure all headers are properly formatted (e.g., no empty headings, consistent indentation).
Upgrade
Version history
0.5.0latest on PyPI · released Oct 15, 2025
Audit
Dependencies
mdformatrequiredmdformat-toc is a plugin for mdformat; mdformat must be installed.
Agent activity
6 hits · last 30 days
node
6
Resources
mdformat-toc — pip install mdformat-toc · libregistry