Skip to content

docs(readme): hyperlink footnote citations to references - #27

Merged
mcdigman merged 2 commits into
devfrom
readme-footnote-hyperlinks
Jul 10, 2026
Merged

docs(readme): hyperlink footnote citations to references#27
mcdigman merged 2 commits into
devfrom
readme-footnote-hyperlinks

Conversation

@mcdigman

Copy link
Copy Markdown
Owner

What

Makes the inline [n] footnote citations in the README hyperlink to their specific reference entry, addressing the expectation of scientific users familiar with hyperref.

  • Each reference item in the References section gets a per-item anchor: <a id="ref-n"></a>.
  • Each inline citation becomes a fragment link, e.g. [\[1\]](#ref-1). The \[ \] escapes preserve the [1] bracket look while avoiding nested-bracket parsing ambiguity.

Cross-renderer behavior

  • GitHub / ReadTheDocs: clicking a citation jumps to that exact reference. ✅
  • PyPI: readme_renderer strips id attributes and generates no heading anchors, so the fragment links become inert — but they still render as clean [n] link text with no error. This is the same mechanism the existing Table of Contents already relies on, so no new PyPI risk is introduced.

There is no way to make in-page anchor navigation work on PyPI (it strips the anchors); this delivers working jumps on GitHub and graceful, non-breaking degradation on PyPI.

Verify PyPI rendering

python -m build && twine check dist/*

🤖 Generated with Claude Code

mcdigman and others added 2 commits July 10, 2026 02:50
Make inline [n] citations link to their specific reference entry via
per-item <a id="ref-n"> anchors. Jumps work on GitHub/ReadTheDocs; on
PyPI the anchors are stripped by readme_renderer but degrade gracefully
to inert, cleanly-rendered [n] link text (same as the existing TOC),
so nothing breaks there.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
MyST-Parser parses markdown [n](#ref-n) as a cross-reference and cannot
resolve it to the raw-HTML <a id> targets, so sphinx-build -W failed with
7 myst.xref_missing warnings. Write the citation links as raw HTML
(<a href="#ref-n">[n]</a>) too: MyST passes raw HTML through verbatim
without cross-reference resolution, so no warning is emitted, while GitHub
and PyPI render it identically (and this drops the \[ \] escapes). Jumps
now resolve in all three renderers on GitHub/Sphinx and degrade to inert
links on PyPI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mcdigman
mcdigman merged commit af4eada into dev Jul 10, 2026
14 checks passed
@mcdigman
mcdigman deleted the readme-footnote-hyperlinks branch July 10, 2026 07:57
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