Skip to main content

Generate a Table of Content from Markdown files.

Project description

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 git@github.com: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.

Project details


Download files

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

Source Distribution

tocinator-1.0.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tocinator-1.0.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file tocinator-1.0.2.tar.gz.

File metadata

  • Download URL: tocinator-1.0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for tocinator-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3bc396a83c4bf5abbcc44f05d35678ae0a614d17abdba792273ad3dad2f2587f
MD5 eb0b0ea4f28efc5831ed74b2903b6836
BLAKE2b-256 be393b063dfe41e7a1aa8bfcab79f20ce4d66849f0801cb6f5e1d4ad88011f82

See more details on using hashes here.

File details

Details for the file tocinator-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: tocinator-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for tocinator-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a54801735e2185e8456ccca3857f72a23a32c9a0d8101a532ee94594296c89e
MD5 dd22c50888bd15b4360ee3a63c53ac82
BLAKE2b-256 12530556b988037ec2db8477dfb12e8afddb9b50402f8b367373b195ec3d22e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page