https://github.com/kevingimbel/mktoc
🦀 Markdown Table of Content generator
https://github.com/kevingimbel/mktoc
cli command-line command-line-tool generator markdown rust rust-library table-of-contents toc
Last synced: 6 months ago
JSON representation
🦀 Markdown Table of Content generator
- Host: GitHub
- URL: https://github.com/kevingimbel/mktoc
- Owner: KevinGimbel
- License: mit
- Created: 2019-11-15T20:44:43.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-11-15T08:41:47.000Z (over 2 years ago)
- Last Synced: 2025-08-30T08:53:14.948Z (10 months ago)
- Topics: cli, command-line, command-line-tool, generator, markdown, rust, rust-library, table-of-contents, toc
- Language: Rust
- Homepage: https://kevingimbel.de/oss
- Size: 1.93 MB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `mktoc`

Graphic design is my passion ✨



# Table of Contents
- [About](#about)
- [Installation](#installation)
- [Cargo](#cargo)
- [Binary](#binary)
- [Hermit](#hermit)
- [Nix](#nix)
- [Run on demand ](#run-on-demand)
- [Install (nixos / nix-darwin)](#install-nixos--nix-darwin)
- [Usage](#usage)
- [Update Markdown file](#update-markdown-file)
- [Inline config](#inline-config)
- [`min_depth`](#min_depth)
- [`max_depth`](#max_depth)
- [`wrap_in_details`](#wrap_in_details)
- [Command line](#command-line)
- [Environment configuration](#environment-configuration)
- [Auto-run with VSCode](#auto-run-with-vscode)
- [Performance](#performance)
- [Contributing](#contributing)
- [Where to start?](#where-to-start)
- [Tooling](#tooling)
- [Install dev build](#install-dev-build)
- [License](#license)
## About
[⬆️ Back to Top](#table-of-contents)
`mktoc` parses markdown files and generates a Table Of Content linking all headlines up to heading level 6 deep, or as specified by command line arguments, environment variables, or inline JSON config (see [Usage](#usage)).
## Installation
[⬆️ Back to Top](#table-of-contents)
`mktoc` can be installed using Cargo, the Rust package manager.
### Cargo
**Installation**
```sh
$ cargo install mktoc
```
**Update**
```sh
$ cargo install --force mktoc
```
### Binary
Binaries for Linux and MacOS can be downloaded from the [release page](https://github.com/KevinGimbel/mktoc/releases/latest).
Windows Binaries are not yet build automatically, see [#7](https://github.com/KevinGimbel/mktoc/issues/7).
### Hermit
`mktoc` is available in [hermit](https://github.com/cashapp/hermit) so it can be installed on a per-project basis without the need to install it globally.
```sh
$ hermit init
$ hermit install mktoc
```
This installs `mktoc` to the local bin directory at `bin/mktoc` inside the project.
### Nix
`mktoc` is available in [nixpkgs](https://search.nixos.org/packages?channel=unstable&show=mktoc&query=mktoc) since version 25.11.
#### Run on demand
```sh
nix run 'github:nixos/nixpkgs/nixpkgs-unstable#mktoc'
```
#### Install (nixos / nix-darwin)
```nix
environment.systemPackages = [
pkgs.mktoc
];
```
## Usage
### Update Markdown file
[⬆️ Back to Top](#table-of-contents)
Add the following HTML comment into the Markdown file where the Table of Contents should be rendered.
```html
```
Everything between those comments will be replaced!
#### Inline config
[⬆️ Back to Top](#table-of-contents)
Starting with version 3.0.0 it's possible to set values in-line which is great when collaborating with teams who may have individual settings.
```html