Skip to main content

Generate or insert a table of contents for a Markdown file.

Project description

GitHub PyPI version PyPI pyversions GitHub Workflow Status

markdown-toc-cli

Insert a table-of-contents into a Markdown file.

Heavily inspired from this project: https://github.com/hukkin/mdformat-toc

I'd recommend using that unless you don't want to run the built-in mdformat formatting. Then this tool might be suitable for a standalone version.

Installation

pip install markdown-toc-cli

Usage

Add a comment like this to the Markdown file:

<!-- markdown-toc-cli --prefix='- ' --indentation='  ' --minlevel=1 --maxlevel=6 -->

All arguments are optional, with the defaults values shown above (compatible with GitHub flavored markdown).

Then run the tool:

markdown-toc-cli README.md

pre-commit Hook

Example usage of this as a pre-commit hook:

- repo: https://github.com/noahp/markdown-toc-cli
  rev: 0.1.1
  hooks:
  - id: markdown-toc-cli

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markdown_toc_cli-0.1.1.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

markdown_toc_cli-0.1.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page