Skip to main content

Generates a table of contents for a markdown document in markdown.

Project description

MD TOC

A tool to create tables of contents from markdown files, in markdown format.

Introduction

MD TOC is a tool written in python that adheres to the old unix-philosophy of doing one thing and one thing well. It reads a given markdown file (or standard input) and produces a table of contents, with or without links, for the given markdown document, in markdown format, based on any headings that may exist in the document, as well as their level. The list items within the table of contents are indented depending on the heading level. How much each level is indented is also determined by the min-heading-indent option.

Usage Information

    ./mdtoc.py -h
usage: MD TOC [-h] [-m {1,2,3,4,5,6}] [-M {0,1,2,3,4,5,6}] [-n] [-o OUTPUT]
              [-s SEPARATOR] [-w WHITESPACE] [-x LEVEL]
              [input]

Generate a table of contents for a markdown document

positional arguments:
  input                 The markdown file to read.

optional arguments:
  -h, --help            show this help message and exit
  -m {1,2,3,4,5,6}, --min-indent {1,2,3,4,5,6}
                        Specify the minimum level of heading for which the
                        list items will be indented. Headings at or below this
                        level will not be indented and the rest of the heading
                        levels will be adjusted accordingly. The default is 1.
  -M {0,1,2,3,4,5,6}, --max-indent {0,1,2,3,4,5,6}
                        Specify the maximum level of heading for which the
                        list items will be indented. Headings above this level
                        will not be indented any further; Thus, specifying 0
                        flattens the list. The default is 6.
  -n, --no-links        Do not link the sections of the document to their list
                        items in the table of contents.
  -o OUTPUT, --output OUTPUT
                        The markdown file to write the table of contents to.
                        The default is standard output.
  -s SEPARATOR, --separator SEPARATOR
                        Specifies a string to be used as the separator between
                        the '*' character and the succeeding list item
                        (default: ' ').
  -w WHITESPACE, --whitespace WHITESPACE
                        Specify the characters used as whitespace before each
                        item. This is repeated or omitted depending on the
                        indentation level of each item. (default: ' ')
  -x LEVEL, --exclude LEVEL
                        Specify specific levels of heading to exclude from the
                        table of contents. This option can be repeated to
                        exclude multiple levels.

Submit any bugs to https://github.com/mcb2003/md-toc-creater/issues/new

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

md_toc_creator-1.4-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file md_toc_creator-1.4-py3-none-any.whl.

File metadata

  • Download URL: md_toc_creator-1.4-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for md_toc_creator-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6c607e6352b8e7e1d0e4f49a3bb59acd3a71135950a5aa589c1b01e8e0676f6d
MD5 f92d26b4a0a0542102da504f22ef425b
BLAKE2b-256 f0cf8bed3eb57aaac17bbeb4cd0f78ca8e49c9834ec2c9c302e4ff23ec5e8e73

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