This python module parses your Markdown file and generates a Table of Content(TOC) for that file. It should be noted that this is still in development and may not always function as expected.
The TOC below was completely generated using this module.
- Features of this module
- Code Generated using tocinator
- Rendered Code
- Installation
- How to use this module
- General Layout
- Generate Markdown-ready code.
- Generated TOC has links to the actual headings and subheading. Which means you can just paste the generated code in your README file and click on any of the links to go to the desired heading.
Below is an example of TOC generated using tocinator. The README used in the below snippets is from my other repository. Do check it out if you code in C, it might be of your interest.
With pip
$ pip3 install tocinator
Without pip
- Clone this repository.
$ git clone [email protected]:Coder-RG/tocinator
- Change directory to cloned repository.
$ cd tocinator
- Run the file at command line:
$ python3 src/tocinator/tocinator.py <input-file> <output-file>
- Use
##
for headings - Use
###
for subheadings.
Example 1: (installed with pip)
$ python3 -m tocinator README.md OUT.md
Example 2: (installed without pip)
$ python3 src/tocinator/tocinator.py README.md OUT.md
If the .md file is in another folder, then use absolute path.
$ python3 src/tocinator/tocinator.py <path-to-folder>/README.md <path-to-folder>/TEST.md
Example 3: (installed without pip)
$ python3 src/tocinator/tocinator.py /home/username/project/README.md /home/username/project/OUT.md
#
and####
are not used in the parsing yet and therefore won't be displayed in the TOC.- Only use alphanumeric for heading and subheadings. Otherwise, the links won't work.
Code is rendered using grip module. Do check out grip if you want to render your markdown files in your browser.