gentoc
is a simple command-line tool written in C for generating a Table of Contents (ToC) for markdown files. It processes the markdown headers in the file and generates corresponding ToC entries.
- Parses markdown headers.
- Generates ToC entries in markdown format.
- Converts headers to lowercase and replaces spaces with hyphens for link compatibility.
To use gentoc
, compile the source code and run the executable with a markdown file as an argument.
A Makefile is provided for convenience. Ensure you have make and a C compiler (such as gcc) installed. You can compile the code using:
make
This will create an executable named gentoc
on Linux or gentoc.exe
on Windows.
Once compiled, you can run gentoc
with a markdown file as follows:
./gentoc [file]
For example:
./gentoc example.md
This will output the Table of Contents for example.md
.
Given a markdown file example.md
with the following content:
# Main Title
## Introduction
## Usage
### Installation
### Running the Application
## Contributing
## License
Running ./gentoc example.md
will produce:
- [Introduction](#introduction)
- [Usage](#usage)
- [Installation](#installation)
- [Running the Application](#running-the-application)
- [Contributing](#contributing)
- [License](#license)
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE
file for details.