#table #content #generator #document #markdown #version-control

bin+lib taboc

A table of contents generator for markdown documents

13 releases

0.2.105 Feb 17, 2025
0.2.104 Feb 17, 2025
0.1.203 Feb 3, 2025

#772 in Development tools

Download history 309/week @ 2025-01-29 317/week @ 2025-02-05 270/week @ 2025-02-12 107/week @ 2025-02-19 24/week @ 2025-02-26

817 downloads per month

MIT license

25KB
488 lines

Taboc

Build IconDocs IconVersion IconLicense Icon

A table of contents generator for markdown documents.

Table of contents

Installation

This project is available on crates.io, meaning the installation is as simple as typing:

cargo install taboc

Then you can use the taboc binary in your shell. Make sure to check out the commands with the -h flag.

Features

Generic options

Related flags:

  • --input - The input file (Default: ./README.md).
  • --no-file-update - Use if you want to just print the table of contents without updating the file.
  • --max-depth - The maximum heading depth to search for (Default: 6).
  • --update-existing - Use to update the existing table of contents.

Version Control Systems

Related flags:

  • --allow-dirty - Checks if the [INPUT] file is:

    • not tracked
    • doesn't have staged changes
    • has staged changes
  • --no-vcs - Disables VCS checks (based on the chosen VCS).

Currently supported VCS:

  • Git (default)
  • Hg
  • Pijul
  • Fossil

[!NOTE] If you try to use this script without a VCS then it's likely that the VCS checks will fail. That's why you should use the --no-vcs flag to explicitly not check for a VCS.

Memmap

Use the operating system's memory mapping for managing the file directly.

This is space efficient, however it's often slower due to less cache locality and also less safe in the case of multiple writers causing UB.

Refer to memmap2::MmapMut#safety.

Dependencies

~3–17MB
~180K SLoC