Skip to content

Will create a Table of Content for your Markdown(.md) files.

License

Notifications You must be signed in to change notification settings

Coder-RG/tocinator

Repository files navigation

TOCinator

MIT license Py version GitHub tag

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.

Table of Content

  1. Features of this module
  2. Code Generated using tocinator
  3. Rendered Code
  4. Installation
  5. How to use this module
    1. What not to do
  6. General Layout

Features of this module

  1. Generate Markdown-ready code.
  2. 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.

Code Generated using tocinator

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. Code

Rendered Code

Render

Installation

With pip

$ pip3 install tocinator

Without pip

  1. Clone this repository.
$ git clone [email protected]:Coder-RG/tocinator
  1. Change directory to cloned repository.
$ cd tocinator
  1. Run the file at command line:
$ python3 src/tocinator/tocinator.py <input-file> <output-file>

How to use this module

  1. Use ## for headings
  2. 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

What not to do

  1. # and #### are not used in the parsing yet and therefore won't be displayed in the TOC.
  2. Only use alphanumeric for heading and subheadings. Otherwise, the links won't work.

General Layout

Code

Render

Code is rendered using grip module. Do check out grip if you want to render your markdown files in your browser.

About

Will create a Table of Content for your Markdown(.md) files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages