Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 1.83 KB

README.md

File metadata and controls

43 lines (27 loc) · 1.83 KB

TOC Generator for Markdown documents

Bash-only GNU/Linux CLI

The below "Table of Contents" has been generated using tocgen.

Table of Contents

tocgen

Usage

Step 1

Put the placeholder [TOC] followed by 2 spaces and a new-line (viz. press Enter key) wherever you want the Table of Contents to appear in your markdown file.

Step 2

Then simply:

tocgen <path to the markdown file>
# If path is not provided, tocgen searches its working directory for *.md files

It does an in-place edit of the file provided. The injected "Table of Contents" contains a trailing blank level 5 heading. DO NOT delete this blank heading as tocgen uses it to delimit the "Table of Contents" during subsequent updates (see below).

Step 3

Edit your document as necessary - adding, editing and removing headings. When you finish editing, in order to update the "Table of Contents", simply repeat the command given above.

Contribute

Report bugs or discuss ideas and new features. PRs welcome.

Sponsor