docs: restructure the README for scanning - #16
Merged
Conversation
437 lines, 16 sections, no table of contents, 69% prose. The qualities it was optimised for — stating every limit plainly, never overclaiming — had made it unscannable: every honest caveat was a paragraph, and the paragraphs accumulated. 'Format for display' began around line 250, so a reader asking how to format a phone number scrolled past 107 lines of identifier-specific caveats to reach it. - Capability table up front: all 14 identifiers against their is*/format*/ generate*/detect() names and whether redaction covers them by default. Generated from the real exports rather than from memory. - Reordered so the library's shape comes first: Install -> table -> Quick start -> Format -> Generate -> Mask -> Redact -> identifier notes -> integrations. - Table of contents, with all 10 anchors verified against real headings. - 109 lines of deep reasoning moved into four collapsed <details> blocks: why validators cannot be detectors, the redaction false-positive measurements, the NUBAN residue proof behind inferBanks, the voter-VIN evidence table, and the fixed-line letter guard. Nothing deleted — one click away instead of in the scroll path. Kept in the README rather than split into a separate doc so no link can rot and nothing depends on a file that might not be published. Rendered default view: ~437 -> ~307 lines. All 17 TypeScript snippets extracted and compiled against the project's tsc; details markup balanced with the blank line markdown needs after each </summary>.
The first pass added a capability table, a TOC and collapsed the deep reasoning, but source length barely moved (437 -> 416) and the code ratio actually fell, because prose was preserved while some samples were cut. This finishes the job. What changed: now that docs/design-decisions.md is published, the README LINKS to the reasoning instead of carrying it. Three anchors point into it (validator-cannot-detect, the NUBAN arithmetic, cite-a-source), all verified against real headings. Per-identifier caveats became a single table rather than six prose blocks. The Install/Quick start/Format/ Generate/Mask sections collapsed into one 'Core API' block showing all four shapes at once, since they are identical across identifiers. total 437 -> 226 lines rendered default ~198 lines scannable (code+table) 87 lines prose 139 lines Kept in place: the one <details> block listing what redaction will NOT catch. That is compliance-relevant and npm users must be able to reach it without leaving the page — docs/ does not ship in the tarball. Verified: all snippets compile against the project tsc; every claimed output executed and checked (fixedLineArea, the unallocated-code undefined, upgraded=true, mask, formatPlate, formatNuban); 6 internal and 3 cross-file anchors resolve; details markup balanced.
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.
Documentation only — no code, no API change.
The problem, measured
Format for displaybegan around line 250, so a reader asking "how do I format a phone number" scrolled past 107 lines of identifier-specific caveats to reach it. The two largest sections — Redact (75) and NUBAN (65) — were a third of the file and dominated by why we don't do things.The irony: the qualities the README was optimised for — stating every limit plainly, never overclaiming — are exactly what made it unscannable. Every honest caveat was a paragraph, and the paragraphs accumulated.
Four changes
1. A capability table up front. All 14 identifiers against their
is*/format*/generate*/detect()name and whether redaction covers them by default. This is what most readers actually want, and it replaces a lot of scattered prose. Generated from the real exports rather than from memory:2. Reordered so the library's shape comes first — Install → table → Quick start → Format → Generate → Mask → Redact → identifier notes → integrations. Identifier caveats no longer sit between a reader and the core API.
3. A table of contents, with all 10 anchors verified against the actual headings (0 broken).
4. 109 lines of deep reasoning moved into four collapsed
<details>blocks: why validators cannot be detectors, the redaction false-positive measurements, the NUBAN residue proof behindinferBanks, the voter-VIN evidence table, and the fixed-line letter guard. Nothing is deleted — it's one click away instead of in the scroll path.Verification
Two judgment calls
Kept the reasoning in the README rather than splitting it into
docs/. A separate file would give cleaner source, butdocs/is not published in this repo, so the links would rot and the reasoning would become unreachable for anyone reading on npm or GitHub. Collapsed<details>solves the actual problem — rendered scannability — without that risk.Source length barely moved: 437 → 416. I predicted ~260 and did not hit it. The win is in structure and rendered length (~307 lines with the details collapsed, a 30% reduction), not raw file size. Worth being straight about, since the headline number looks like little changed.
Changeset is
patch.