/pymdtoc

Add table of contents to markdown files

Primary LanguagePythonMIT LicenseMIT

Table of contents

mdTOC

Create Table of contents for markdown files

Installation

pip install pymdtoc

Usage

Generate TOC

mdtoc generate filename.md

Generate and update file

mdtoc inplace filname.md

Via python

from pymdtoc import TOC
toc = TOC(file="filename.md")
print(toc.toc)
print(toc.content)

Optional arguments

  • toc_heading - Table of contents heading (str)
  • anchor_function - Ability to provide custom anchor tag generator