Install md_toc via pip:
$ pip3 install md_toc --user
All the necessary dependencies are installed automatically along with the program.
Packages exist for Arch Linux, Debian, Ubuntu and Nix. See
https://repology.org/project/md-toc/versions
https://repology.org/project/python:md-toc/versions
See the ./setup.cfg file.
./setup.cfg