Skip to content

Add --numbered option for an ordered table of contents - #6

Merged
Gulliby merged 1 commit into
mainfrom
feature/numbered-list
Oct 17, 2026
Merged

Gulliby merged 1 commit into
mainfrom
feature/numbered-list

Conversation

@Gulliby

@Gulliby Gulliby commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Requested by gulliby

Before. Every table-of-contents entry was written as a bullet, so a document whose house style is a numbered contents list had to be renumbered by hand after each run.

After. --numbered writes the entries as an ordered list, numbered per depth among siblings and indented by four spaces per level. It works with generating, --check, --print and --insert; without the flag the output is unchanged. For example:

$ bun run src/cli.ts --print --numbered --min-depth 2 NOTES.md
1. [Installation](#installation)
2. [Usage](#usage)
    1. [Sub](#sub)
    2. [More](#more)
3. [License](#license)

How. src/toc.ts (generateToc and updateToc take a trailing numbered = false) and src/cli.ts (the flag, the usage text, passing the value on). New tests are in tests/numbered.test.ts; two existing help-text assertions got the new [--numbered] text. README gets a "Numbered list" section and an options row. No new dependencies; bun test, typecheck and lint pass.

@Gulliby Gulliby self-assigned this Oct 17, 2026
@Gulliby
Gulliby merged commit 5b00d5c into main Oct 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant