Generate a table of contents from the comments of a file
Project description
toc
Generate a table of contents from the comments of a file
What is it?
toc
is a command line utility that generates the table of contents of a file from a special kind of comments.
Think it as a tree
for the contents of a file, instead of a directory.
Why should I use it?
Few reasons that you may consider:
- it can make your files understandable in seconds, even if you haven't touched them for a while
- you can jump directly to the section you need to edit, because you know where it's located
- it makes you reflect about the structure of your file, making it more logical
- for software developers, it makes your code base more readable to others
How does it work?
First, you have to write the comments representing the different sections of a file.
Second, you run toc
on that file to turn those comments into a table of contents.
Comments are structured in this way:
By running toc file.c
, you will read the table of contents of that file
This table of contents of that file can also be embedded in the original file with toc -f file.c
How can I use it?
First, you need Python installed in your system.
Then, you can install toc by running:
pip install tableofcontents
If you are using Arch or Manjaro Linux, you can install toc directly from the AUR.
You should now be able to run toc -h
to display a list of parameter you can use.
See USAGE.md for step-by-step explanations of different features, and a list of languages supported natively (e.g. Markdown, AsciiDoc, reStructuredText) or that need special attention (e.g. CSS)
See https://regex101.com/r/ngzZXN/1 for examples of valid and invalid comments.
How can I contribute?
See CONTRIBUTING.md
What has changed from previous versions?
See CHANGELOG.md
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
Built Distribution
Hashes for tableofcontents-2.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2496925e80dbc8405b9c30a4a0f60d9fd82203ccbf4a5768688bc053bb9f761c |
|
MD5 | 1b18e3fcb3233b3fd3f59f2e16882d97 |
|
BLAKE2b-256 | 8254d42b6545c9e3831e8b89eadb511e28013257b37b42596e1883c607c2db21 |