Skip to content

feat: add papers.cool entry and navigation support - #66

Open
AI-explorer-123 wants to merge 2 commits into
j3soon:masterfrom
AI-explorer-123:feature/open-in-papers-cool
Open

feat: add papers.cool entry and navigation support#66
AI-explorer-123 wants to merge 2 commits into
j3soon:masterfrom
AI-explorer-123:feature/open-in-papers-cool

Conversation

@AI-explorer-123

@AI-explorer-123 AI-explorer-123 commented Mar 30, 2026

Copy link
Copy Markdown

Summary

  • Add a new papers.cool entry under Extra Services on arXiv abstract pages.
  • papers.cool link format: https://papers.cool/arxiv/search?highlight=1&query=<arxiv_id>.
  • Add papers.cool URL parsing/mapping so the extension button can navigate from papers.cool pages back to the corresponding arXiv abstract page, analogous to existing ar5iv support.
  • Update Chrome/Firefox manifests for papers.cool URL matching and host access.
  • Update README references from "ar5iv" to "ar5iv + papers.cool" where appropriate.
  • Add navigation testcase for 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

  • Unit navigation test passed locally (tests/unit-test, npm test -- --runInBand).

Summary by CodeRabbit

  • New Features

    • Added support for papers.cool as an additional external service to access arXiv papers
    • Extension now recognizes and properly handles papers.cool domain URLs
    • Papers can be seamlessly accessed through papers.cool alongside existing services
  • Tests

    • Added test cases to verify papers.cool functionality

Review Change Stack

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>
Copilot AI review requested due to automatic review settings March 30, 2026 11:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/testcases/testcases.yaml Outdated
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"

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
title: "Search papers with code highlights by query: 1512.03385"
title: Deep Residual Learning for Image Recognition | papers.cool

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +26 to 27
- 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)

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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>
@AI-explorer-123

Copy link
Copy Markdown
Author

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.

@j3soon

j3soon commented May 24, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

Walkthrough

This 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.

Changes

papers.cool External Service Integration

Layer / File(s) Summary
Feature documentation
README.md
Feature list, screenshots note, and solution description all updated to include papers.cool as an additional external service option for opening papers.
Chrome extension: papers.cool URL patterns and handling
chrome/manifest.json, chrome/content.js, chrome/target_url_regexp_replace.js
Manifest configures content.js injection on papers.cool search and paper detail pages with host permissions; content.js extracts arXiv IDs from papers.cool URLs and injects papers.cool as an extra service link; target_url_regexp_replace.js adds rewrite rules mapping papers.cool URLs to arxiv.org/abs.
Firefox extension: papers.cool URL patterns and handling
firefox/manifest.json, firefox/content.js, firefox/target_url_regexp_replace.js
Manifest enables content.js on papers.cool search URLs; content.js extracts arXiv IDs and adds papers.cool extra service link; target_url_regexp_replace.js adds rules to normalize papers.cool URLs via regex patterns.
Test validation
tests/testcases/testcases.yaml
New testcase for paper 1512.03385 verifies that papers.cool URLs navigate to the correct arXiv abstract with expected title and metadata.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • j3soon/arxiv-utils#67: Both PRs extend URL-rewrite mechanisms by adding regex entries to target_url_regexp_replace.js files to map external site paper URLs to https://arxiv.org/abs/<id> with corresponding test coverage.

Poem

🐰 A paper too cool for just one place,
Now papers.cool shows up with grace!
From Firefox to Chrome, they both agree—
One more service, wild and free! 📚✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding papers.cool as a new external service with navigation support alongside existing arXiv integration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Missing URL pattern for direct papers.cool paper pages.

The manifest only includes *://papers.cool/arxiv/search* (line 15), but firefox/content.js also parses direct paper URLs like papers.cool/arxiv/<id> (line 13 of content.js). Without a matching pattern in content_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 win

Missing URL pattern for direct papers.cool paper pages.

The manifest only includes *://papers.cool/arxiv/search* (line 20), but chrome/content.js also parses direct paper URLs like papers.cool/arxiv/<id> (line 13 of content.js). Without a matching pattern in content_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 value

Minor 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 value

Minor 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

📥 Commits

Reviewing files that changed from the base of the PR and between 328c90a and a9a976a.

📒 Files selected for processing (8)
  • README.md
  • chrome/content.js
  • chrome/manifest.json
  • chrome/target_url_regexp_replace.js
  • firefox/content.js
  • firefox/manifest.json
  • firefox/target_url_regexp_replace.js
  • tests/testcases/testcases.yaml

Comment on lines +180 to +184
- 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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).

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.

3 participants