Add a table of contents to DIRECTORY.md - #15198
Merged
cclauss merged 2 commits intoSep 6, 2026
Merged
Conversation
Generate a linked table of contents of the top-level sections at the top of DIRECTORY.md so readers can jump straight to a category, as suggested in TheAlgorithms#13239 / TheAlgorithms#13111. The list is built in scripts/build_directory_md.py (with a new md_anchor helper + doctests) so DIRECTORY.md stays fully auto-generated.
11 tasks
Member
|
This is great, but can you make the table of contents a numbered list so we can see at a glance how many algorithm folders we have? Also, can you please add a similar link, but without the pound sign, to each section title? When I am scrolling through the sections and I see one that I want to explore, I can click the section title and jump right to the algorithm directory. |
…ries - Table of Contents is now a numbered list, so the final number shows the total count of algorithm folders at a glance. - Each top-level section heading links to its algorithm directory (e.g. ## [Sorts](sorts)), so clicking a section title jumps straight to the folder.
Contributor
Author
|
Thanks @cclauss — both done in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change:
Adds a linked Table of Contents of the top-level sections to the top of
DIRECTORY.md, so readers can jump straight to a category (Sorts, Graphs, Ciphers, …) instead of scrolling.This is the auto-generated version of the idea in #13239 — rather than hand-editing
DIRECTORY.md(which is overwritten by the directory writer), the ToC is produced byscripts/build_directory_md.py, so it stays in sync automatically. Thanks @cclauss for pointing to the right place.Details:
md_anchor()helper turns a section heading into a GitHub-style anchor slug, with doctests.print_directory_md()first emits## Table of Contentswith one* [Section](#anchor)link per top-level section (order preserved), then the existing listing — no lines removed, purely additive.DIRECTORY.mdregenerated to match.Closes #13111
Checklist:
scripts/build_directory_md.pyand its generated outputDIRECTORY.md.)