Walks a Markdown document and emits a nested table of contents.
Extracted from a larger codebase where it had grown organically.
pip install md-tocfrom md_toc import mdToc
result = mdToc("example")
print(result)- No runtime dependencies outside the standard library.
- Tested on Python 3.9 and newer.
MIT