[Bug]: apps/mobile markdownDocument & EnrichedMarkdownText (md4c) turn single tildes (~) into strikethrough in both user and assistant messages
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/mobile
Steps to reproduce
Not a duplicate of #29254 (opening a focused apps/mobile report because #41858 was auto-closed as a duplicate of #29254 without reopening):
- #29254 and its open PR #29270 target only
apps/web(and even #35859 for sent user messages only updatedapps/web). apps/mobileuses a completely separate native Markdown pipeline (apps/mobile/src/lib/markdownDocument.ts+apps/mobile/src/native/EnrichedMarkdownText.tsxbacked byreact-native-enriched-markdown/ Cmd4c). Even if #29254 / #29270 merges, zero files underapps/mobileare modified, and mobile remains broken for both user messages and assistant replies.
- Open any thread in the T3 Code mobile app (iOS or Android).
- Send or view a message containing two single tildes (
~) in the same paragraph — common in numeric ranges, CJK prose, or macOS iCloud paths, e.g.:Latency is around 10~20ms (about 80~90% faster), saved under com~apple~CloudDocs. - Observe how
MobileEnrichedMarkdownTextrenders the message.
Expected behavior
Only double tildes (~~text~~) should render as GFM strikethrough, matching apps/web user messages (#35859) and singleTilde: false. Single tildes (~) in numeric ranges (10~20, 80~90%) and paths (com~apple~CloudDocs) should render literally without striking through intervening text.
Actual behavior
In apps/mobile, pairs of single tildes (~) in the same paragraph are parsed as strikethrough and the ~ characters themselves disappear — e.g. 10~20ms (about 80~90% faster) renders with 20ms (about 80 struck through and both ~ dropped, and com~apple~CloudDocs strikes through apple. This affects both sent user messages and assistant replies on mobile.
Root cause (apps/mobile, verified on main @ 772f8d40ce)
apps/mobile/src/lib/markdownDocument.ts(lines 14 and 501) configuresunified().use(remarkParse).use(remarkGfm)without{ singleTilde: false }, so mobile's own AST preprocessing treats~...~asdeletenodes.apps/mobile/src/native/EnrichedMarkdownText.tsx(lines 272–288, 463–499) passes the preprocessed Markdown directly toreact-native-enriched-markdown(1.2.0-t3.19), whose underlying Cmd4cparser (MD_FLAG_STRIKETHROUGH) treats single~...~as strikethrough by default, andmarkdownForNativeParsing()/markdownForNativeRendering()does not escape unescaped single~in prose before handing off tomd4c.
Suggested fix
- Pass
{ singleTilde: false }toremarkGfminapps/mobile/src/lib/markdownDocument.ts(lines 14 and 501). - Either:
- Add a prose-escaping step in
apps/mobile/src/lib/markdownDocument.ts(following the existingapplyMarkdownEditspattern used bymarkdownWithTableBreaks,markdownWithEscapedWindowsDestinations, etc.) that escapes single unescaped~characters outside code fences, inline code, links/URLs, and double/triple~~/~~~delimiters as\~beforeEnrichedMarkdownTextrenders them (verifiable directly with Vitest unit tests inapps/mobile/src/lib/markdownDocument.test.ts); or - Expose a
singleTilde: false/ double-tilde-only strikethrough option inmd4cFlagsin the forkedreact-native-enriched-markdownpackage (apps/mobile/deps/).
- Add a prose-escaping step in
Impact
Minor bug or occasional failure
Version or commit
main @ 772f8d40ce (reproduced on mobile builds; untouched since #41858)
Environment
T3 Code Mobile (iOS / Android, apps/mobile using react-native-enriched-markdown 1.2.0-t3.19 / md4c)
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
Wrap numeric ranges or paths containing ~ in inline code backticks, or escape single tildes as ~.