Skip to content

fix(mobile): keep #-prefixed markdown link labels visible - #6135

Draft
olympusbuildz wants to merge 1 commit into
block:mainfrom
olympusbuildz:fix/mobile-hash-link-label-6124
Draft

fix(mobile): keep #-prefixed markdown link labels visible#6135
olympusbuildz wants to merge 1 commit into
block:mainfrom
olympusbuildz:fix/mobile-hash-link-label-6124

Conversation

@olympusbuildz

Copy link
Copy Markdown

Problem

On iOS, Markdown links whose label starts with # render as nothing. A body like:

See [#2959](https://github.com/block/buzz/issues/2959) for details.

shows See for details. — no label, no underline, no tap target. Desktop renders the same message correctly.

Root cause

  1. MessageContent registers _ChannelLinkMd (and mentions/emoji) ahead of gpt_markdown defaults.
  2. Default ATagMd builds the link label by re-running the full inlineComponents list on the label text.
  3. _ChannelLinkMd matches digits-only tokens (#2959) and replaces them with a _TokenPill WidgetSpan.
  4. _buildLink only collects plain TextSpan.text, so the label becomes empty nested placeholders and draws blank on device.

Paths: mobile/lib/features/channels/message_content.dart, message_content/token_pill.dart.

Fix

  • _AuthoredMarkdownLinkMd: own the [label](url) path; generate labels with stock formatting components only (no mention/channel/emoji). Drop stock ATagMd from the list to avoid double handling.
  • Channel generic token: require at least one letter/underscore so bare digits-only #2959 is never a channel pill (defense in depth for non-link text too).

Why it matters

GitHub-style issue/PR links in chat are common. Invisible links on mobile lose the destination and break reading flow; desktop already works.

Test plan

cd mobile
flutter test test/features/channels/message_content_test.dart
# 76 passed @ fa17ab2ed

Named regressions:

  • digits-only bare #token is not a channel pill
  • keeps #-prefixed link labels visible (not channel pills)
  • known channel name inside a link label stays plain text
  • existing #channel links group still green

Manual verify

  1. Post See [#2959](https://github.com/block/buzz/issues/2959) for details. from Desktop.
  2. Open the message on iOS — label #2959 visible, tappable, opens the URL.
  3. Bare #general for a real channel still pills and navigates.

Risk / blast radius

  • Link labels no longer turn into channel/mention pills (authored [label](url) keeps plain label text). Bare #channel / @mention outside links unchanged.
  • Digits-only bare #N no longer becomes a non-interactive channel pill (never a valid channel name).

Closest work

none found (issue #6124 unlinked; related area #4572 is tappable-links, different symptom)

Fixes #6124

gpt_markdown re-runs inline components on link labels, so
_ChannelLinkMd turned [block#2959](url) into a nested token pill and
the link drew blank on iOS. Own the ATag path so labels skip
mention/channel/emoji components, and reject digits-only bare
#tokens as channels.

Regression coverage in message_content_test for GitHub-style
issue labels and known channel names inside link text.

Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
Co-authored-by: Olympusbuildz <Olympus.roots@outlook.com>
Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
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.

mobile: Markdown links with a #-prefixed label render as nothing (desktop renders them fine)

1 participant