Skip to content

docs: use text-fragment anchors in README so methods land precisely#354

Merged
iskandr merged 1 commit into
mainfrom
docs-readme-text-fragment-anchors
May 13, 2026
Merged

docs: use text-fragment anchors in README so methods land precisely#354
iskandr merged 1 commit into
mainfrom
docs-readme-text-fragment-anchors

Conversation

@iskandr

@iskandr iskandr commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #353. That PR stripped #Lnnn anchors because they drifted on every source change, but the result linked every method to the bare genome.py file — which doesn't actually navigate you to the method, just opens the file.

Replaces bare-file links with text-fragment anchors (#:~:text=def%20name(). Modern browsers honor these and scroll to the first match in the rendered page. Drift-resistant: works as long as the method's def line exists in the file, regardless of line number.

The trailing ( is load-bearing: def genes would otherwise also match def genes_at_locus. Same for class Gene( vs class GeneFoo( (none today, but cheap insurance).

Also removed the intro paragraph from #353 — it was an apology for the lack of precision and isn't needed now that the links land where they should.

Test plan

  • 42 source links, all with method- or class-specific text-fragment anchors
  • def genes( vs def genes_at_locus( (and the other prefix-collision pairs) verified unique
  • HEAD-checked sample URLs against github.com (200 OK)
  • No code changes; no version bump

Caveats

Text-fragment URLs are supported in Chrome / Edge / Firefox / Safari (Safari 16.4+). Older browsers fall back to opening the file at the top, which is no worse than #353's bare-file link.

…recisely

The previous pass (#353) stripped line-number anchors as a brittleness
fix, but the result linked every method to the bare genome.py file,
which is not actually useful. Replaced bare-file links with text-fragment
anchors (#:~:text=def%20name() that scroll to the method definition in
modern browsers without depending on its line number. The trailing
paren keeps "def genes(" from also matching "def genes_at_locus(".

Class links use #:~:text=class%20Name( for the same reason.

Also dropped the intro paragraph that apologized for the lack of
precision - it was only needed when the links were imprecise.

Docs-only; no version bump.
@iskandr iskandr merged commit 247a9a0 into main May 13, 2026
10 checks passed
@iskandr iskandr deleted the docs-readme-text-fragment-anchors branch May 13, 2026 14:58
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 84.971%. remained the same — docs-readme-text-fragment-anchors into main

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.

2 participants