docs(reference): the generated index - #206
Merged
Merged
Conversation
Nine appendices and no way to look anything up. The index is generated from the same introspection the appendices are, crossed with the book's own Markdown: every name the program can utter — configuration sections and keys, CLI flags, scene types, overlays, display modes, generators, effects, live-tune targets — against the sections that discuss it. Locators come from scanning the committed chapters for each name in a code span or a heading and taking the section it sits in, so the index cannot name a term the program does not have or point at a section the book does not have. Ordered so the section *written about* a term leads, then prose before the tables: "where is dither explained" answers with the section that explains dithering, not with its row in Appendix A. Section titles are entries too — "Companding", "The Audio Slot" — which is what lets a reader look a thing up before they know its key. A key is listed bare, and again qualified with its section only where two sections share the name, which is the rule the Notation section states. Each locator carries its chapter, because three sections here are called some case of "MIDI" and a bare title left the reader with `midi`, MIDI, `midi` and no way to tell them apart. No `number` in its front matter, so it renders after Appendix J as a plain heading instead of claiming a letter. It reuses the fields-table machinery whole; the one template change is that the identity column no longer justifies, since a section title set into 1.5in and stretched to the margins is three words with two rivers through it.
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.
Seventh of eight in the reference-guide review stack. Branches off
main(#205 is merged). Documentation and tooling only — no hardware, no runtime
code touched.
The problem
Ten appendices, a hundred and ninety pages, and no way to look anything up.
The contents page lists sections; it does not list names. A reader who
remembers
dither_strengthbut not which chapter discusses it has to guess.What lands
scripts/gen_reference_appendices.pygains a second half. It already readsintrospectfor the appendices; it now reads it again the other way round andcrosses it with the book's own committed Markdown, writing
docs/reference/30-index.md— 503 entries over about twenty pages.Terms are every name the program can utter: configuration sections and
keys, command-line flags, scene types, overlays, display modes, generators,
effects and live-tune targets. A key is listed bare, and again qualified with
its section only where two sections share the name —
[color].ditherand[audio].ditherare two different settings,[dsp].agcis not ambiguous withanything. That is the rule the book's own Notation section already states.
Section titles are entries too. "Companding", "The Audio Slot", "Why Cuts
Do Not Tear" — so the concept can be looked up by a reader who does not yet
know which key it belongs to. A title that is nothing but a name is skipped,
since the name is already an entry.
Locators come from scanning the chapters for each term inside a code span
or a heading, and taking the innermost enclosing
##/###— whose anchor#205 defined. Fenced code blocks are excluded (an example config names half
the program), as are values-not-terms (
auto,true,random) and tokensunder three characters. Three locators per term, ordered so the section
written about the term leads and the prose chapters come before the tables:
ditherdither(3), The Shape of a Value (1), Companding —dac_curve(4)Each locator carries its chapter number in parentheses, which is not
decoration: three sections in this book are called some case of "MIDI", and
midi_voice_channelsis discussed in all three. Without it the reader gotmidi, MIDI,midiand no way to tell them apart.Every locator is a relative Markdown link, so it resolves on github.com and as
an internal PDF link alike — and an unresolvable one fails the book build,
which is what turns a renamed section into a build error rather than a dead
link in print.
Shape
No
numberin the front matter, so it renders after Appendix J as a plainaccent heading rather than claiming a letter of its own. It reuses the
<!-- table: fields -->machinery whole — no new template function, no newconverter directive.
The one template change: the identity column no longer justifies. It has only
ever held names, which do not stretch; a section title set into 1.5in and
stretched to the margins is three words with two rivers through it. Nothing
else in any book renders differently.
Verification
make lint,make typecheck(mypy --strict + pyright) cleanmake test— 3331 tests, all passmake booksrenders all three; the reference PDF is 201 pages, the indexruns from p. 170
python scripts/gen_reference_appendices.py --check— 11 generated files upto date
anchor; the index carries no
number; it does not index itself; the sectionwritten about a term leads its entry; plus unit tests for what counts as a
name, what counts as a concept, and where an entry files
Bookkeeping
docs/reference/README.md, the introduction's "What Is In Here", the Makefilehelp line and
CLAUDE.mdall now mention the index. The freshness test'sgenerated-file count goes 9 → 10, and
test_every_generated_file_convertsnow passes anchors to the converter — without them the index cannot resolve a
single one of its links.