# Generate TOC for Markdown files

The script will generate a TOC for a Markdown file, based on the headers in the file.

It generates and prints the TOC to the console, and optionally also inserts it into the original file.
For the latter, it will first create a backup copy of the file and then replace any section named "# Contents" with the new table of contents.


## Prerequisites

- Python 3.8 or higher

## Usage

```bash
$ python generateTOC.py <document path>
```

## Command Line Options

```
usage: generateTOC.py [-h] [--add-content] [--indent <indent>] document

positional arguments:
  document              document to parse

options:
  -h, --help            show this help message and exit
  --add-content, -a     add TOC to "# Content" section in the document (default: False)
  --indent <indent>, -i <indent>
                        indent spaces for each level (default: 4)
```