P2-03: Inline citation click-through - #23
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
This was referenced Aug 11, 2026
dkritarth
force-pushed
the
p2-02-annotations
branch
from
September 12, 2026 15:12
9ff7326 to
f73054c
Compare
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
force-pushed
the
p2-03-citations
branch
from
September 12, 2026 15:13
27ef0a0 to
0ce61cb
Compare
8 tasks
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.
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
Automated verification
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 buildcleanly builds Electron bundle.Live Electron verification
Visual and console evidence
Limitations and follow-ups
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