readme-toc - generate a table of contents in markdown documents

readme-toc is a utility that creates a table of contents in markdown documents.

You create a placeholder for where you want the TOC to go and the utility creates the rest:

Starting with this README.md:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# README.md

  <!-- toc -->
  <!-- toc stop -->

# Installation instructions

```shell
npx readme-toc
```

# Another Heading

# Final heading

then running:

1
npx readme-toc

results in the following new `README.md`. This makes reading github docs so much easier.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# README.md

  <!-- toc -->
  * [Installation instructions](#installation-instructions)
  * [Another Heading](#another-heading)
  * [Final heading](#final-heading)

  <!-- toc stop -->

  # Installation instructions

  ```shell
  npx readme-toc
  ```

  # Another Heading

  # Final heading
comments powered by Disqus