Skip to content

chore: replace markdown-toc with markdown-toc-gen - #270

Merged
arb merged 3 commits into
masterfrom
replace-markdown-toc-with-markdown-toc-gen
May 4, 2026
Merged

chore: replace markdown-toc with markdown-toc-gen#270
arb merged 3 commits into
masterfrom
replace-markdown-toc-with-markdown-toc-gen

Conversation

@arb

@arb arb commented May 4, 2026

Copy link
Copy Markdown
Owner

Closes #267.

markdown-toc@1.x is unmaintained and emits three deprecation warnings on install (coffee-script, gulp-header, lodash.template). Replace with markdown-toc-gen, which uses the same <!-- toc --> markers.

Dep impact: -48 packages unique to markdown-toc, +3 net-new (markdown-toc-gen, jest-get-type, diff-sequences).

utils/generate-toc.js is deleted: it only existed to override markdown-toc's slug algorithm (to match GFM) and force hyphen bullets. markdown-toc-gen defaults to both, so the wrapper became pure indirection. package.json invokes the CLI directly now; the version hook is unchanged.

The regenerated TOC also picks up the existing ## 16.x breaking changes heading, which had been added to the README without a npm run toc run and was missing from the old TOC.

Verified: every previously-existing TOC entry is byte-identical to what the old wrapper produced (slug equivalence confirmed); npm run toc is idempotent; clean npm install drops the three named warnings; npm test (62/62, 100% cov), npx eslint ., and the version hook all pass.

@codecov-commenter

codecov-commenter commented May 4, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7f38988) to head (3d122c7).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #270   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          263       263           
=========================================
  Hits           263       263           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arb
arb force-pushed the replace-markdown-toc-with-markdown-toc-gen branch from 8e78c34 to c6ec392 Compare May 4, 2026 13:19
arb and others added 2 commits May 4, 2026 09:24
`markdown-toc@1.x` is unmaintained and emits three deprecation
warnings on `npm install` (`coffee-script`, `gulp-header`,
`lodash.template`). Swap to `markdown-toc-gen`, which uses the
same `<!-- toc -->` / `<!-- tocstop -->` markers and ships a
GFM-spec slug algorithm by default.

Dep impact: -48 packages unique to `markdown-toc`, +3 net-new
(`markdown-toc-gen`, `jest-get-type`, `diff-sequences`); the rest
of its tree is already pulled in by `eslint`/`expect`/etc.

The `toc` npm script now invokes the CLI directly. The `version`
hook (`npm run toc && git add README.md`) is unchanged.

Refs #267

Co-authored-by: Cursor <cursoragent@cursor.com>
The wrapper existed only to pass two options that markdown-toc's
CLI couldn't accept: a custom `slugify` callback (to produce
GFM-style anchors that matched GitHub's renderer) and
`bullets: '-'`. `markdown-toc-gen` makes both defaults, so the
wrapper is now pure indirection over the CLI.

Refs #267

Co-authored-by: Cursor <cursoragent@cursor.com>
@arb
arb force-pushed the replace-markdown-toc-with-markdown-toc-gen branch from c6ec392 to 09e0936 Compare May 4, 2026 13:32
Run `npm run toc` against the new `markdown-toc-gen` tool to refresh the
TOC against the current README headings.

Closes #267

Co-authored-by: Cursor <cursoragent@cursor.com>
@arb
arb force-pushed the replace-markdown-toc-with-markdown-toc-gen branch from 372f39a to 3d122c7 Compare May 4, 2026 13:38
@arb
arb marked this pull request as ready for review May 4, 2026 13:39
@arb
arb merged commit a100702 into master May 4, 2026
9 checks passed
@arb
arb deleted the replace-markdown-toc-with-markdown-toc-gen branch May 4, 2026 13:40
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.

Replace markdown-toc with markdown-toc-gen

2 participants