Public: anyone can read this; the crew can change it.

docs/README.md: generate its list of pages from the pages' front matter (child of #14248) #14382

opened this

Merged 13d 18h ago, live in production

docs/README.md now builds its list of pages from the pages' own front matter, the way the features index does. I did not run the whole suite.

Notes

opened this

docs/README.md now builds its list of pages from the pages' own front matter, the way the features index does. I did not run the whole suite. fast.ts named 2,309 test files, so I ran 88 tests in 18 files covering docs, the guide, feature front matter, the features index script and the README cap; one failed and I fixed it. tsc and gate.ts --fix came back clean. I re-ran only test/docs-index.test.ts and test/guide.test.ts (16 pass) after the last edit.

What changed

  • Front matter: each page declares its rows with docs: <heading> | <link words> | <sentence>, plus an optional | #anchor. All 25 hand-typed rows moved into the front matter of the pages they link, so the list reads the same as before except for ordering.
  • README: the body is now one <!-- pages --> line under each heading. A short note near the top says how to add a page.
  • Where it runs: src/view/docs_index.ts builds the rows, and src/view/docs.ts applies it when README.md is read. It scans docs/.md, docs/designs/.md and docs/features/*.md.
  • Tests: test/docs-index.test.ts covers the parser, the sorted rendering under each topic, and a head with no typed row. It also checks that every page that asks for a row shows up in the README as served.

What I chose not to do

  • Ordering: rows are sorted by link words rather than keeping the old hand order, so a page needs no ordering key.
  • Operations log row: it stays typed in the head, because it links a .log file and not a page.
  • Guide paragraph: the "Start here" paragraph stays as it was, since its order is the guide's own.
  • Pages with no row: top-level pages that were never in the README, such as FEED.md, gained nothing. The test refuses a page whose row is missing, not a page with no row at all.

Try it: open /docs for the rendered list. To add a page, put docs: Develop it | My page | what it says. at the top of the file.

Closes #14353

commented

docs/README.md now builds its list of pages from the pages' own front matter, the way the features index does. I did not run the whole suite. fast.ts named 2,309 test files, so I ran 88 tests in 18 files covering docs, the guide, feature front matter, the features index script and the README cap; one failed and I fixed it. tsc and gate.ts --fix came back clean. I re-ran only test/docs-index.test.ts and test/guide.test.ts (16 pass) after the last edit.

What changed

  • Front matter: each page declares its rows with docs: <heading> | <link words> | <sentence>, plus an optional | #anchor. All 25 hand-typed rows moved into the front matter of the pages they link, so the list reads the same as before except for ordering.
  • README: the body is now one <!-- pages --> line under each heading. A short note near the top says how to add a page.
  • Where it runs: src/view/docs_index.ts builds the rows, and src/view/docs.ts applies it when README.md is read. It scans docs/.md, docs/designs/.md and docs/features/*.md.
  • Tests: test/docs-index.test.ts covers the parser, the sorted rendering under each topic, and a head with no typed row. It also checks that every page that asks for a row shows up in the README as served.

What I chose not to do

  • Ordering: rows are sorted by link words rather than keeping the old hand order, so a page needs no ordering key.
  • Operations log row: it stays typed in the head, because it links a .log file and not a page.
  • Guide paragraph: the "Start here" paragraph stays as it was, since its order is the guide's own.
  • Pages with no row: top-level pages that were never in the README, such as FEED.md, gained nothing. The test refuses a page whose row is missing, not a page with no row at all.

Try it: open /docs for the rendered list. To add a page, put docs: Develop it | My page | what it says. at the top of the file.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs