feat: add papers.cool entry and navigation support - #66
Conversation
Add papers.cool integration analogous to ar5iv in extra services, URL parsing, and navigation mapping across Chrome/Firefox; update manifests, tests, and README. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds papers.cool as an “Extra Services” destination on arXiv abstract pages and extends the extension’s URL mapping so users can navigate from papers.cool back to the corresponding arXiv abstract via the extension action (similar to existing ar5iv handling).
Changes:
- Add papers.cool link under “Extra Services” on arXiv abstract pages (Chrome + Firefox content scripts).
- Add papers.cool → arXiv URL parsing/mapping and update Chrome/Firefox manifests for URL matching/host access.
- Add a navigation testcase for papers.cool → arXiv and update README mentions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/testcases/testcases.yaml |
Adds a navigation testcase for papers.cool -> arXiv. |
firefox/target_url_regexp_replace.js |
Adds URL rewrite rule for papers.cool search pages to arXiv abstract pages. |
firefox/manifest.json |
Extends content script match patterns to include papers.cool search URLs. |
firefox/content.js |
Adds papers.cool ID parsing and adds papers.cool to “Extra Services” links on arXiv abstracts. |
chrome/target_url_regexp_replace.js |
Adds URL rewrite rule for papers.cool search pages to arXiv abstract pages. |
chrome/manifest.json |
Adds papers.cool to content script matches and host permissions. |
chrome/content.js |
Adds papers.cool ID parsing and adds papers.cool to “Extra Services” links on arXiv abstracts. |
README.md |
Updates feature bullets to mention papers.cool alongside ar5iv. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| title2: Deep Residual Learning for Image Recognition | Abstract | ||
| description: ar5iv -> arXiv | ||
| - url: https://papers.cool/arxiv/search?highlight=1&query=1512.03385 | ||
| title: "Search papers with code highlights by query: 1512.03385" |
There was a problem hiding this comment.
The papers.cool -> arXiv navigation testcase sets title to the site’s native page title, but the extension injects a content script on papers.cool/arxiv/search* and will overwrite document.title to <arXiv paper title> | papers.cool (see getPageType()/mainAsync() in content scripts). This will make the end-to-end navigation test flaky/fail because it waits for the title field before clicking the extension button. Update title to the expected extension-modified title (e.g., Deep Residual Learning for Image Recognition | papers.cool).
| title: "Search papers with code highlights by query: 1512.03385" | |
| title: Deep Residual Learning for Image Recognition | papers.cool |
| - Open the paper in extra services such as [ar5iv](https://ar5iv.labs.arxiv.org/) and [papers.cool](https://papers.cool/). | ||
| - Works with Native Tab Search, and other plugins! (See the [Solution Descriptions](#solution-descriptions) section for more details) |
There was a problem hiding this comment.
README updates mention papers.cool in the feature bullets, but the permissions/manual-test sections still reference only ar5iv (e.g., the Chrome host permission bullet for *://ar5iv.labs.arxiv.org/* and the manual test note about “ar5iv tabs”). Since this PR adds papers.cool host access/matches, those sections should be updated as well to stay consistent and avoid confusing users about why the new permission exists.
Switch papers.cool links to /arxiv/<id> to avoid search tokenization splitting IDs like 2512.21334 into 2512 and 21334; keep backward-compatible parsing for search URLs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Updated per testing feedback: switched papers.cool link from search query URL to direct paper URL (https://papers.cool/arxiv/), which avoids tokenization issues for IDs with dots (e.g., 2512.21334). Also added direct URL parsing rules while keeping old search URL parsing for compatibility. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThis PR extends both the Chrome and Firefox extensions to recognize and handle papers.cool URLs as an additional external service alongside ar5iv. Changes include manifest updates to enable content script injection, URL pattern matching for ID extraction, extra service link injection, URL rewriting rules, and corresponding documentation and test coverage. Changespapers.cool External Service Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
firefox/manifest.json (1)
9-17:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winMissing URL pattern for direct papers.cool paper pages.
The manifest only includes
*://papers.cool/arxiv/search*(line 15), butfirefox/content.jsalso parses direct paper URLs likepapers.cool/arxiv/<id>(line 13 of content.js). Without a matching pattern incontent_scripts.matches, the content script won't be injected on those pages, breaking title renaming and navigation functionality.🐛 Proposed fix to add the missing URL pattern
"*://ar5iv.labs.arxiv.org/html/*", "*://papers.cool/arxiv/search*", + "*://papers.cool/arxiv/*", "*://mozilla.github.io/pdf.js/web/viewer.html*"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@firefox/manifest.json` around lines 9 - 17, The manifest's content_scripts.matches array is missing the pattern that covers direct papers.cool paper pages used by firefox/content.js; update the "matches" array in manifest.json to add a URL pattern matching direct paper pages (e.g., the same host path pattern that firefox/content.js expects such as papers.cool/arxiv/<id>) so the content script is injected on those pages and title renaming/navigation from content.js works correctly.chrome/manifest.json (1)
9-21:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winMissing URL pattern for direct papers.cool paper pages.
The manifest only includes
*://papers.cool/arxiv/search*(line 20), butchrome/content.jsalso parses direct paper URLs likepapers.cool/arxiv/<id>(line 13 of content.js). Without a matching pattern incontent_scripts.matches, the content script won't be injected on those pages, breaking title renaming and navigation functionality.🐛 Proposed fix to add the missing URL pattern
"*://ar5iv.labs.arxiv.org/html/*", - "*://papers.cool/arxiv/search*" + "*://papers.cool/arxiv/search*", + "*://papers.cool/arxiv/*" ],🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@chrome/manifest.json` around lines 9 - 21, The manifest's content_scripts.matches is missing a pattern for direct papers.cool paper pages, so chrome/content.js (which parses URLs like papers.cool/arxiv/<id>) won't be injected; update the "matches" array in manifest.json to include a pattern matching direct paper pages such as "*://papers.cool/arxiv/*" (in addition to the existing "*://papers.cool/arxiv/search*") so the content script runs on both search and individual paper pages.
🧹 Nitpick comments (2)
firefox/content.js (1)
12-13: 💤 Low valueMinor regex pattern inconsistency.
Line 13 uses
[^\/\?\#]+to capture the arXiv ID, while other similar patterns in this file (e.g., line 11 for ar5iv) use\S*?. Both work correctly for arXiv IDs, but using\S*?would be more consistent with the existing codebase.♻️ Proposed change for consistency
- [/^.*:\/\/papers\.cool\/arxiv\/([^\/\?\#]+)\/*(\?.*?)?(\#.*?)?$/, "$1", "papers.cool"], + [/^.*:\/\/papers\.cool\/arxiv\/(\S*?)\/*(\?.*?)?(\#.*?)?$/, "$1", "papers.cool"],🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@firefox/content.js` around lines 12 - 13, Replace the inconsistency in the second regex pattern (the array entry matching papers.cool arXiv pages) by using the same token style as other patterns: change the capture from [^\/\?\#]+ to \S*? so it matches the arXiv ID the same way as the other entries (keep the rest of the pattern intact in the array element in firefox/content.js).chrome/content.js (1)
12-13: 💤 Low valueMinor regex pattern inconsistency.
Line 13 uses
[^\/\?\#]+to capture the arXiv ID, while other similar patterns in this file (e.g., line 11 for ar5iv) use\S*?. Both work correctly for arXiv IDs, but using\S*?would be more consistent with the existing codebase.♻️ Proposed change for consistency
- [/^.*:\/\/papers\.cool\/arxiv\/([^\/\?\#]+)\/*(\?.*?)?(\#.*?)?$/, "$1", "papers.cool"], + [/^.*:\/\/papers\.cool\/arxiv\/(\S*?)\/*(\?.*?)?(\#.*?)?$/, "$1", "papers.cool"],🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@chrome/content.js` around lines 12 - 13, Replace the inconsistent character-class capture in the papers.cool arXiv URL regex with the same non-greedy whitespace-based pattern used elsewhere: locate the array entry whose regex matches papers.cool arxiv URLs (the line with the pattern containing "papers.cool" and currently using [^\/\?\#]+) and change that capture to use \S*? so it matches the arXiv ID consistently with the other patterns like the ar5iv entry.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/testcases/testcases.yaml`:
- Around line 180-184: The test case uses a direct papers.cool article URL but
the extension manifests (chrome/manifest.json and firefox/manifest.json) only
register the content script for papers.cool/arxiv/search* so the content script
and toolbar button never activate; update the manifests' content_scripts.matches
(or url_patterns) to include the article pattern (e.g., papers.cool/arxiv/* or
the specific article regex) so the content script will run on URLs like
papers.cool/arxiv/1512.03385, then re-run the test in
tests/testcases/testcases.yaml to validate end-to-end navigation (also verify
target_url_regexp_replace.js behavior still applies for rewriting).
---
Outside diff comments:
In `@chrome/manifest.json`:
- Around line 9-21: The manifest's content_scripts.matches is missing a pattern
for direct papers.cool paper pages, so chrome/content.js (which parses URLs like
papers.cool/arxiv/<id>) won't be injected; update the "matches" array in
manifest.json to include a pattern matching direct paper pages such as
"*://papers.cool/arxiv/*" (in addition to the existing
"*://papers.cool/arxiv/search*") so the content script runs on both search and
individual paper pages.
In `@firefox/manifest.json`:
- Around line 9-17: The manifest's content_scripts.matches array is missing the
pattern that covers direct papers.cool paper pages used by firefox/content.js;
update the "matches" array in manifest.json to add a URL pattern matching direct
paper pages (e.g., the same host path pattern that firefox/content.js expects
such as papers.cool/arxiv/<id>) so the content script is injected on those pages
and title renaming/navigation from content.js works correctly.
---
Nitpick comments:
In `@chrome/content.js`:
- Around line 12-13: Replace the inconsistent character-class capture in the
papers.cool arXiv URL regex with the same non-greedy whitespace-based pattern
used elsewhere: locate the array entry whose regex matches papers.cool arxiv
URLs (the line with the pattern containing "papers.cool" and currently using
[^\/\?\#]+) and change that capture to use \S*? so it matches the arXiv ID
consistently with the other patterns like the ar5iv entry.
In `@firefox/content.js`:
- Around line 12-13: Replace the inconsistency in the second regex pattern (the
array entry matching papers.cool arXiv pages) by using the same token style as
other patterns: change the capture from [^\/\?\#]+ to \S*? so it matches the
arXiv ID the same way as the other entries (keep the rest of the pattern intact
in the array element in firefox/content.js).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: acfddd77-8933-4275-8512-575a970e5852
📒 Files selected for processing (8)
README.mdchrome/content.jschrome/manifest.jsonchrome/target_url_regexp_replace.jsfirefox/content.jsfirefox/manifest.jsonfirefox/target_url_regexp_replace.jstests/testcases/testcases.yaml
| - url: https://papers.cool/arxiv/1512.03385 | ||
| title: Deep Residual Learning for Image Recognition | ||
| url2: https://arxiv.org/abs/1512.03385 | ||
| title2: Deep Residual Learning for Image Recognition | Abstract | ||
| description: papers.cool -> arXiv |
There was a problem hiding this comment.
Test case won't validate full functionality due to manifest gap.
The test case uses the direct papers.cool URL format (papers.cool/arxiv/1512.03385), but the manifest files are missing the URL pattern to inject the content script on these pages (they only include papers.cool/arxiv/search*). This means:
- The content script won't run on the test URL
- The extension button won't be enabled
- Navigation won't work in the actual extension
The test only validates URL rewriting logic (via target_url_regexp_replace.js), not the end-to-end navigation flow. This is consistent with the critical manifest issues flagged in chrome/manifest.json and firefox/manifest.json.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/testcases/testcases.yaml` around lines 180 - 184, The test case uses a
direct papers.cool article URL but the extension manifests (chrome/manifest.json
and firefox/manifest.json) only register the content script for
papers.cool/arxiv/search* so the content script and toolbar button never
activate; update the manifests' content_scripts.matches (or url_patterns) to
include the article pattern (e.g., papers.cool/arxiv/* or the specific article
regex) so the content script will run on URLs like papers.cool/arxiv/1512.03385,
then re-run the test in tests/testcases/testcases.yaml to validate end-to-end
navigation (also verify target_url_regexp_replace.js behavior still applies for
rewriting).
Summary
https://papers.cool/arxiv/search?highlight=1&query=<arxiv_id>.papers.cool -> arXiv.What is papers.cool and why this helps
papers.cool is a paper discovery/search site. In this integration, arxiv-utils can open papers.cool directly from arXiv via:
https://papers.cool/arxiv/search?highlight=1&query=<arxiv_id>This keeps user flow smooth when browsing related code-oriented search results and still allows quick navigation back to canonical arXiv pages with the extension button/hotkey.
Validation
tests/unit-test,npm test -- --runInBand).Summary by CodeRabbit
New Features
Tests