Repository navigation
fix(mobile): hide unused link reference definitions like desktop - #8389
Open
cwschroeder wants to merge 1 commit into
Open
cwschroeder wants to merge 1 commit into
cwschroeder wants to merge 1 commit into
Conversation
A CommonMark link reference definition such as `[label]: #` renders as nothing on desktop, because react-markdown drops definition nodes. The mobile renderer (gpt_markdown) has no definitions and shows the line as plain text, so the same message looks different on the two clients. Agent tooling uses such a line to carry a machine-readable marker on top of a human-readable post; on mobile the marker stays visible. MessageContent now removes definitions that no reference in the message uses before the existing link normalization. Definitions that a `[label]` points to stay, because mobile cannot resolve the reference and the raw line is the only place the destination is visible. Fenced code and lines that continue a paragraph are left alone, as in CommonMark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christian Schröder <christian.w.schroeder@gmail.com>
🔐 Codex Security Review
|
This branch has not been deployed
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.
Summary
A CommonMark link reference definition such as
[label]: #renders as nothing on desktop, because react-markdown drops definition nodes. The mobile renderer (gpt_markdown) has no definitions and shows the line as plain text, so the same message looks different on the two clients.Agent tooling uses such a line to carry a machine-readable marker above a human-readable post. On desktop the post starts with the text; on mobile it starts with the marker.
MessageContentnow removes definitions that no reference in the message uses, before the existing link normalization.[label]points to stay. Mobile cannot resolve the reference, and the raw line is the only place the destination is visible, so removing it would lose information.Testing
flutter test test/features/channels/message_content/link_reference_definitions_test.dart: nine cases (leading and inner unused definitions, full and collapsed references, fenced code, paragraph continuation, look-alikes, CRLF, no-op).flutter test test/features/channels/message_content_test.dart: new widget test renders a message throughMessageContentand asserts the marker text is gone while the body renders. It fails when the call inMessageContentis removed.dart formatandflutter analyzeon the changed files: clean.Not checked on a device or simulator.
🤖 Generated with Claude Code