Strip leaked <cite> tags from chat output#22
Merged
Conversation
The assistant grounds answers with inline source markup like <cite index="1-9">…</cite>. react-markdown has no raw-HTML plugin, so these tags rendered as literal text in the chat. Strip the tags (keeping the cited prose) before rendering assistant messages. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Fixes grounded assistant responses rendering literal <cite …> / </cite> markup in the chat UI by stripping citation wrapper tags before content is passed to react-markdown.
Changes:
- Added a
stripCitations()helper to remove inline<cite>markup while preserving the cited text. - Applied citation stripping to assistant message rendering only (user messages unchanged).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+35
to
+37
| function stripCitations(text: string): string { | ||
| return text.replace(/<cite\b[^>]*>/gi, "").replace(/<\/cite>/gi, ""); | ||
| } |
philosophercode
added a commit
that referenced
this pull request
Jun 2, 2026
Fills test gaps from PRs that merged before the suite branch was cut, and documents v5 for agents: - ChatFab tests for <cite> tag stripping (#22): tags removed, cited prose kept, multi-tag and no-tag cases. Plus pending tool-call status labels (get_unit_details / report_issue / generic) and the photo-upload flow (upload → removable preview → [Attached photos: …] hint on send, and the upload-error path). ChatFab statement coverage 54% → 81%; overall 87.5% → 92%. - Dark-mode E2E (#23): tool-detail page resolves the dark design tokens when the dark theme is active, and the choice persists across reload. - v5/AGENTS.md: scoped agent guide (stack, Notion data layer, key files, conventions, how to run the test suite) with an explicit note that the root CLAUDE.md is v4/AirTable and does not apply to v5. - Install @vitest/coverage-v8 so `npm run test:coverage` works (the config referenced the provider but it was never added). test:all green: 232 Vitest + 17 Playwright, lint + tsc clean. Co-authored-by: Isaac S <philosophercode@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The MakerLab Assistant grounds answers with inline source markup like
<cite index="1-9">…</cite>. The chat renders assistant text withreact-markdown, which has no raw-HTML plugin, so the tags showed up asliteral text (e.g.
<cite index="1-9">) in grounded answers.Fix
Add a small
stripCitations()helper inChatFab.tsxthat removes theopening/closing
<cite>tags while keeping the cited prose, and apply it toassistant message text before it reaches
react-markdown.Scoped to assistant rendering only; no behavior change for user messages or
markdown formatting.
Notes
npm run lintlocally (eslint not installed in thisworkspace); relying on CI.
🤖 Generated with Claude Code