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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file markdown_toc_cli-0.1.1.tar.gz.

File metadata

  • Download URL: markdown_toc_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for markdown_toc_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 53bbf5420c80449c5c6ab0a59b17b7c7c5398d9a6f0cbc9f14901f4edb496c39
MD5 e82fd937c925aeff27114b2ed7ea8353
BLAKE2b-256 a68f6d7681fd62f76bf9d32caf329c627f23e30b88ba1c4aa7fe61fc5c86b70d

See more details on using hashes here.

File details

Details for the file markdown_toc_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: markdown_toc_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for markdown_toc_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d37da5b66e913e2f8c3b0e2945d22a67b69ade9d640c86f2cb021bdc8cc43470
MD5 1d6ba2990d9084ed02d00481cf64953f
BLAKE2b-256 09c0839855ed394909c5744a02eac9f16b6a54f039d5faa338f63243f1b71385

See more details on using hashes here.

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