Skip to content

docs: restructure the README for scanning - #16

Merged
lintdeveloper merged 3 commits into
mainfrom
docs/readme-restructure
Aug 4, 2026
Merged

docs: restructure the README for scanning#16
lintdeveloper merged 3 commits into
mainfrom
docs/readme-restructure

Conversation

@lintdeveloper

Copy link
Copy Markdown
Owner

Documentation only — no code, no API change.

The problem, measured

before:  437 lines, 16 sections, no table of contents, 69% prose

Format for display began 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:

is*: 14   parse*: 14   format*: 14   generate*: 14
DEFAULT redact: phone vnin rsa-pin driver-license plate fixed-line
OPT-IN  redact: passport tin cac nin-or-bvn tax-id nuban voter-vin

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 behind inferBanks, 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

17 TypeScript snippets extracted and compiled  ✓ exit 0
10 TOC anchors resolved against headings       ✓ 0 broken
4 <details> blocks, open/close balanced        ✓
blank line after every </summary>              ✓ (markdown needs it to render inside)
lint                                           ✓

Two judgment calls

Kept the reasoning in the README rather than splitting it into docs/. A separate file would give cleaner source, but docs/ 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.

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.
@lintdeveloper
lintdeveloper merged commit e7030ef into main Aug 4, 2026
2 checks passed
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.

1 participant