<!-- START doctoc generated TOC please keep comment here to allow auto update -->
**Table of Contents** *generated with [DocToc](https://github.com/ktechhub/doctoc)*
<!---toc start-->
- [DocToc](#doctoc)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Options:](#options)
- [Features](#features)
- [GitHub](#github)
- [License](#license)
- [Contribution](#contribution)
<!---toc end-->
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# DocToc
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://img.shields.io/badge/license-MIT-blue.svg)
[![PyPI version](https://badge.fury.io/py/doctoc.svg)](https://badge.fury.io/py/doctoc)
DocToc is a command-line tool built with Python that automatically generates and updates table of contents (TOC) for Markdown files. It scans through your Markdown file, identifies headers, and creates a TOC with clickable links.
## Prerequisites
Before installing DocToc, ensure you have the following:
- Python 3.6+
- pip (Python package installer)
## Installation
You can install DocToc using pip:
```sh
pip install doctoc
```
Alternatively, you can install it from the source on GitHub:
```sh
git clone https://github.com/ktechhub/doctoc.git
cd doctoc
python setup.py install
```
## Usage
Generate a table of contents for a Markdown file:
```sh
doctoc --help
Usage: doctoc [OPTIONS] MARKDOWN_FILE
Generate or update a table of contents for Markdown files and optionally
check hyperlinks.
Args:
markdown_file (str): Path to the Markdown file to process.
outfile (str, optional): Output file path. If specified, writes the modified content to this file instead of overwriting the original.
check_links (bool): Flag to enable checking the validity of hyperlinks found in the Markdown file.
Options:
-o, --outfile TEXT Specify an output file instead of overwriting.
-cl, --check-links Check validity of hyperlinks.
--help Show this message and exit.
```
### Options:
- `--outfile`: Specify an output file instead of overwriting.
- `--check-links`: Check the validity of hyperlinks within the Markdown file.
Example with options:
```sh
doctoc README.md --check-links
```
Output
```sh
Success: wrote TOC to README.md
Checking hyperlinks...
VALID: [DocToc](https://github.com/ktechhub/doctoc)
VALID: [DocToc](#doctoc)
VALID: [Prerequisites](#prerequisites)
VALID: [Installation](#installation)
VALID: [Usage](#usage)
VALID: [Options:](#options)
VALID: [Features](#features)
VALID: [GitHub](#github)
VALID: [License](#license)
VALID: [GitHub repository](https://github.com/ktechhub/doctoc)
```
```sh
doctoc README.md --outfile README_with_toc.md
```
Output
```sh
Success: wrote TOC to README_with_toc.md
```
```sh
doctoc README.md --outfile README_with_toc.md --check-links
```
## Features
- Automatically generates a TOC based on Markdown headers.
- Supports customization with options to specify output file and check link validity.
- Simple and easy to use with a command-line interface.
## GitHub
For more details, visit the [GitHub repository](https://github.com/ktechhub/doctoc).
## License
This project is licensed under the MIT License - see the LICENSE file for details.
### Contribution
If you want to contribute, kindly see this **[contribution](https://github.com/ktechhub/doctoc/tree/main/contribution.md)**
Raw data
{
"_id": null,
"home_page": "https://github.com/ktechhub/doctoc",
"name": "doctoc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "markdown table of contents",
"author": "Ktechhub",
"author_email": "mm@ktechhub.com",
"download_url": "https://files.pythonhosted.org/packages/50/d4/b01028d8c033fbe009cb5c7765ddfa722adfe4ae1ca2f39fdc15fa0ebf57/doctoc-1.0.0.tar.gz",
"platform": null,
"description": "\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n\n**Table of Contents** *generated with [DocToc](https://github.com/ktechhub/doctoc)*\n\n<!---toc start-->\n\n- [DocToc](#doctoc)\n - [Prerequisites](#prerequisites)\n - [Installation](#installation)\n - [Usage](#usage)\n - [Options:](#options)\n - [Features](#features)\n - [GitHub](#github)\n - [License](#license)\n - [Contribution](#contribution)\n\n<!---toc end-->\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n# DocToc\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://img.shields.io/badge/license-MIT-blue.svg)\n[![PyPI version](https://badge.fury.io/py/doctoc.svg)](https://badge.fury.io/py/doctoc)\n\nDocToc is a command-line tool built with Python that automatically generates and updates table of contents (TOC) for Markdown files. It scans through your Markdown file, identifies headers, and creates a TOC with clickable links.\n\n## Prerequisites\nBefore installing DocToc, ensure you have the following:\n- Python 3.6+\n- pip (Python package installer)\n\n## Installation\nYou can install DocToc using pip:\n\n```sh\npip install doctoc\n```\nAlternatively, you can install it from the source on GitHub:\n\n```sh\ngit clone https://github.com/ktechhub/doctoc.git\ncd doctoc\npython setup.py install\n```\n\n## Usage\nGenerate a table of contents for a Markdown file:\n\n```sh\ndoctoc --help\nUsage: doctoc [OPTIONS] MARKDOWN_FILE\n\n Generate or update a table of contents for Markdown files and optionally\n check hyperlinks.\n\n Args:\n markdown_file (str): Path to the Markdown file to process.\n outfile (str, optional): Output file path. If specified, writes the modified content to this file instead of overwriting the original.\n check_links (bool): Flag to enable checking the validity of hyperlinks found in the Markdown file.\n\nOptions:\n -o, --outfile TEXT Specify an output file instead of overwriting.\n -cl, --check-links Check validity of hyperlinks.\n --help Show this message and exit.\n```\n\n### Options:\n\n- `--outfile`: Specify an output file instead of overwriting.\n- `--check-links`: Check the validity of hyperlinks within the Markdown file.\n\nExample with options:\n```sh\ndoctoc README.md --check-links\n```\nOutput\n```sh\nSuccess: wrote TOC to README.md\nChecking hyperlinks...\nVALID: [DocToc](https://github.com/ktechhub/doctoc)\nVALID: [DocToc](#doctoc)\nVALID: [Prerequisites](#prerequisites)\nVALID: [Installation](#installation)\nVALID: [Usage](#usage)\nVALID: [Options:](#options)\nVALID: [Features](#features)\nVALID: [GitHub](#github)\nVALID: [License](#license)\nVALID: [GitHub repository](https://github.com/ktechhub/doctoc)\n```\n\n```sh\ndoctoc README.md --outfile README_with_toc.md\n```\nOutput\n```sh\nSuccess: wrote TOC to README_with_toc.md\n```\n```sh\ndoctoc README.md --outfile README_with_toc.md --check-links\n```\n\n## Features\n- Automatically generates a TOC based on Markdown headers.\n- Supports customization with options to specify output file and check link validity.\n- Simple and easy to use with a command-line interface.\n\n## GitHub\nFor more details, visit the [GitHub repository](https://github.com/ktechhub/doctoc).\n\n## License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n### Contribution\nIf you want to contribute, kindly see this **[contribution](https://github.com/ktechhub/doctoc/tree/main/contribution.md)**\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Generate table of contents for Markdown files",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/ktechhub/doctoc"
},
"split_keywords": [
"markdown",
"table",
"of",
"contents"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2f17b498cc174485d8ca4aeaa6893c2d912bdaa81738926da1f2da558ba17b2b",
"md5": "971ce9ccf6826e900a43bb4f94392c38",
"sha256": "c916a965e2075774f540079374a262111dadfa9d7d3d0adbbe34d16c6669cfad"
},
"downloads": -1,
"filename": "doctoc-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "971ce9ccf6826e900a43bb4f94392c38",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8225,
"upload_time": "2024-06-22T17:26:17",
"upload_time_iso_8601": "2024-06-22T17:26:17.360197Z",
"url": "https://files.pythonhosted.org/packages/2f/17/b498cc174485d8ca4aeaa6893c2d912bdaa81738926da1f2da558ba17b2b/doctoc-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "50d4b01028d8c033fbe009cb5c7765ddfa722adfe4ae1ca2f39fdc15fa0ebf57",
"md5": "0c71129c605cfbeb83e033e904b6e35b",
"sha256": "0a13183b10a2942b3d4e6f5cc6c250bd7f1729695315e78182be3d21d4886511"
},
"downloads": -1,
"filename": "doctoc-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "0c71129c605cfbeb83e033e904b6e35b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7648,
"upload_time": "2024-06-22T17:26:19",
"upload_time_iso_8601": "2024-06-22T17:26:19.027991Z",
"url": "https://files.pythonhosted.org/packages/50/d4/b01028d8c033fbe009cb5c7765ddfa722adfe4ae1ca2f39fdc15fa0ebf57/doctoc-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-22 17:26:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ktechhub",
"github_project": "doctoc",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "click",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "black",
"specs": []
},
{
"name": "pytest",
"specs": []
}
],
"lcname": "doctoc"
}