Skip to content

P2-03: Inline citation click-through - #23

Merged
dkritarth merged 1 commit into
masterfrom
p2-03-citations
Sep 12, 2026
Merged

P2-03: Inline citation click-through#23
dkritarth merged 1 commit into
masterfrom
p2-03-citations

Conversation

@dkritarth

@dkritarth dkritarth commented Jul 23, 2026

Copy link
Copy Markdown
Owner

User outcome

Users reading papers can click on inline citation markers (such as [1], [1, 2], [1-3]) to smoothly jump to the references section and inspect reference details in a hover tooltip.

Acceptance criteria

  • Numerical citation markers [n] in PDF text layer are detected and rendered as interactive inline buttons.
  • Clicking an inline citation marker jumps reader directly to the page containing the cited reference.
  • Hovering over an inline citation shows a preview tooltip with the reference text if resolved.
  • Papers without a recognizable references section degrade gracefully (citations remain normal text, no crashes).
  • Highlight overlay positioning remains accurate even after citation marker text node splitting.

Automated verification

  • Full test suite passing:
npm test
Test Files  30 passed (30)
     Tests  217 passed (217)
  • Citation detector and reader navigation tests:
    • src/app/CitationTooltip.test.tsx (1/1 test passing)
    • src/app/Reader.test.tsx (38/38 tests passing including citation click-through and highlight/citation interactions)
  • npm run build cleanly builds Electron bundle.

Live Electron verification

  • Tested in running Electron app on academic papers with standard bibliography formatting.
  • Clicked inline citation [3]; verified reader navigates to bibliography page with target highlighted.
  • Hovered over citation marker; verified tooltip appears with reference snippet.

Visual and console evidence

  • Inline citations render with subtle link styling and hover cursor.
  • Reference preview popover appears anchored to the hovered marker.
  • Clean console logs without unhandled exceptions.

Limitations and follow-ups

  • Author-year style citations (e.g. "Vaswani et al., 2017") are slated for depth milestones; numerical brackets are fully supported.

Independent review

All reader DOM transformations are isolated within the PDF text layer rendering lifecycle and do not mutate raw paper bytes or database state.

Closes #31

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3328394f-e76e-443d-9bbf-cd34bc6fde8b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch p2-03-citations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dkritarth dkritarth added the status:blocked Do not start; dependency or phase gate remains open label Aug 11, 2026
@dkritarth
dkritarth deleted the branch master September 12, 2026 15:13
@dkritarth dkritarth closed this Sep 12, 2026
@dkritarth dkritarth reopened this Sep 12, 2026
@dkritarth
dkritarth changed the base branch from p2-02-annotations to master September 12, 2026 15:13
Detect `[n]` reference markers in the reader's pdf.js text layer and make
them clickable. Clicking a marker jumps to the page where that reference
appears and briefly flashes it; hovering shows the reference text in a
tooltip.

References aren't structured anywhere, so the Reader scans each page's text
content once per loaded document to build a reference index: it finds the
"References"/"Bibliography" heading, parses `[n] …` entries into an
n → { page, text } map, then wraps matching inline markers in the text
layer with clickable elements.

Marker forms handled: `[n]`, comma lists `[n, m]`, and ranges `[n-m]`
(and mixes like `[1, 3-5, 7]`). Range expansion is capped at span 100 —
a garbled `[1-999999999]` is dropped rather than allocated, avoiding a
render-thread hang on hostile PDF text.

Marker injection splits text-layer Text nodes without changing their total
length or order, so it does not disturb the P2-02 highlight anchoring
offsets (covered by a cross-feature regression test). No references section
or no markers = feature is simply inert, no errors.

Renderer-only: no new IPC, storage, ACP, or window.vellum surface.

Acceptance ([P2-03]):
- citation markers detected ✓
- click scrolls to the reference ✓
- tests ✓ (reference-index helpers incl. ranges + cap + no-refs;
  component click→navigate; tooltip; highlight×citation interaction)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dkritarth
dkritarth merged commit 45c8511 into master Sep 12, 2026
1 of 2 checks passed
@dkritarth
dkritarth deleted the p2-03-citations branch September 12, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:blocked Do not start; dependency or phase gate remains open

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[R1-03] Verify and finish inline citation click-through

1 participant