Metadata-Version: 2.1
Name: toc4github
Version: 0.17
Summary: To automatically generate Table of Contents (TOC) for markdown file, especially for README.md of Github.com
Project-URL: homepage, https://github.com/xinlin-z/toc4github
Author-email: xinlin-z <xinlin.zhang@hotmail.com>
License: MIT License
        
        Copyright (c) 2020 xinlin
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: README.md,TOC,github,markdown
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# toc4github

* [Install](#Install)
* [Usage](#Usage)
* [Showcase](#Showcase)

The `toc4github` is a very tiny tool to automatically generate Table of
Contents (TOC) for Markdown file, especially for README.md in Github.com.
It might also be used for other markdown rendering system, but
I never tested! :)

## Install

``` shell
$ pip install toc4github
$ python -m toc4github -h  # inline help
```

## Usage

You should insert a placeholder which is `{toc}` in README.md. The
placeholder ocuppies a whole line. Then:

``` shell
$ python -m toc4github [-d] [-t TITLE] <path/to/README.md>
```

Now, the placeholder is replaced by TOC generated with an optional title,
and your markdown file is updated.

Or, you can call `make_toc` interface in your python code. It returns
the TOC as string in accordance with input, and you can do anything
you want with it.

``` python
# how to import
from toc4github import make_toc
# signature
make_toc(lines: Iterable[str]|str) -> str
```

## Showcase

![toc4github](/showcase.png)

In addition, All my repos' TOC are generated by toc4github.
Have fun ... ^___^

