Skip to content

fix: normalize OpenAI citation markers - #815

Merged
alphaxiv-bot[bot] merged 2 commits into
mainfrom
clo/normalize-openai-citation-markers
Oct 28, 2026
Merged

alphaxiv-bot[bot] merged 2 commits into
mainfrom
clo/normalize-openai-citation-markers

Conversation

@paperclover

Copy link
Copy Markdown
Contributor

Little known trick.

Closes #684

Assisted-by: gpt-6.1-terra

Little known trick.

Closes #684

Assisted-by: gpt-6.1-terra
@paperclover paperclover added the auto-merge Queue for automatic merge once all checks pass label Oct 28, 2026
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches chat replies and Markdown artifact previews.

The PR appears safe to merge, with a non-blocking edge case affecting citation URLs containing numeric dollar amounts.

Findings

  1. P2 Citation URLs can change ▶
Fix with agent prompt
### Issue 1
ui/src/markdownNormalization.ts:235-239
A completed citation for `https://example.org/prices/$100` becomes `<https://example.org/prices/\$100>`. This replacement creates the link, then `normalizeCurrencyDollars` inserts a backslash. Backslashes are literal inside Markdown autolinks, so clicking the citation opens a different URL.

Keep citation URLs out of the later math and currency changes, and add a test for a URL containing a numeric dollar amount.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Converts OpenAI citation markers into readable Markdown.

  • Markdown readers show citation URLs instead of OpenAI markers.

Reviews (1) · Last reviewed commit: "fix: normalize OpenAI citation markers" · Reviewed by Greptile

Comment on lines +235 to +239
.replace(/\uE200cite\uE202([^\uE200\uE201]*)\uE201/g, (_, sources: string) =>
sources.split("\uE202")
.filter((source) => /^https?:\/\/[^\s<>]+$/i.test(source))
.map((source) => `<${source}>`)
.join(" "))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Citation URLs can change

A completed citation for https://example.org/prices/$100 becomes <https://example.org/prices/\$100>. This replacement creates the link, then normalizeCurrencyDollars inserts a backslash. Backslashes are literal inside Markdown autolinks, so clicking the citation opens a different URL.

Keep citation URLs out of the later math and currency changes, and add a test for a URL containing a numeric dollar amount.

Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/markdownNormalization.ts
Line: 235-239

Comment:
**Citation URLs can change**

A completed citation for `https://example.org/prices/$100` becomes `<https://example.org/prices/\$100>`. This replacement creates the link, then `normalizeCurrencyDollars` inserts a backslash. Backslashes are literal inside Markdown autolinks, so clicking the citation opens a different URL.

Keep citation URLs out of the later math and currency changes, and add a test for a URL containing a numeric dollar amount.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@alphaxiv-bot
alphaxiv-bot Bot merged commit 14d3244 into main Oct 28, 2026
9 checks passed
@alphaxiv-bot
alphaxiv-bot Bot deleted the clo/normalize-openai-citation-markers branch October 28, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Queue for automatic merge once all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] unrendered tags about citations in chat

1 participant