Skip to content

feat(core): opt-in preserveWindowsPaths md4c flag - #1105

Open
juliusmarminge wants to merge 1 commit into
software-mansion:mainfrom
pingdotgg:fix/windows-path-escapes
Open

juliusmarminge wants to merge 1 commit into
software-mansion:mainfrom
pingdotgg:fix/windows-path-escapes

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What/Why?

CommonMark reads every \ before punctuation as an escape, so an agent's message Saved to C:\Users\me\.t3\_build\shot.png renders as C:\Users\me.t3_build\shot.png. Coding-agent output mentions Windows paths all the time, and the dropped separators make them wrong.

This adds an opt-in md4cFlags.preserveWindowsPaths (off by default, so CommonMark output is unchanged). With it on, a backslash escape inside a Windows drive path in prose keeps its backslash:

off: Saved to C:\Users\me.t3_build\shot.png and C:/work.config and C:\folder(draft.
on:  Saved to C:\Users\me\.t3\_build\shot.png and C:/work\.config and C:\folder\(draft.

A path starts at a drive letter that is not preceded by a word character (C:\, C:/, or a bare C: right before the escape) and runs through formatting spans such as C:/Users/**me**\.config. Whitespace, line breaks, code, math and images end it. Past whitespace nothing tells a path from a sentence, so C:\tmp \*x\* still gives *x*. Code spans, link destinations and titles, and image alt text are unchanged.

To tell an escape from the literal character, MD4CParser uses the new ENRMRKD_FLAG_ESCAPEDTEXT / ENRMRKD_TEXT_ESCAPED from software-mansion-labs/md4c#5. That PR needs to merge first. packages/core/cpp/enrmrkd/ here is byte-identical to its head, and I'll re-run scripts/fetch-md4c.sh once it lands. The check scans only text appended since the last escape, so a paragraph with many escapes is not rescanned.

The flag is plumbed like preserveBlankLines: React Native (iOS, Android, web, measurement cache keys), the iOS and Android SDKs, the WASM wrapper (bundle rebuilt), and the docs.

Testing

  • New windows-paths.md fixture in the golden AST dump. The flag is on in the extensions-on variants and off in the rest, so the golden records both behaviors. No existing fixture's AST changed. scripts/test-core-parser.sh and scripts/test-web-bundle.mjs pass.
  • md4c-flags.test.tsx covers the default and forwarding of the new prop. The React Native package's tsc and Jest suites pass (1,791 tests).
  • enriched-markdown-ios builds for the iOS Simulator, and T3 Code's React Native iOS and Android dev clients build with this change. enriched-markdown-android: :parser:assembleDebug, :ui:testDebugUnitTest and ktlintCheck pass.

PR Checklist

  • Code compiles and runs on iOS
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes, verified in a downstream app
  • E2E tests are passing
  • Required regression tests have been added

Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.

@juliusmarminge
juliusmarminge force-pushed the fix/windows-path-escapes branch from 60f8909 to ebd6365 Compare October 27, 2026 22:53
juliusmarminge added a commit to pingdotgg/t3code that referenced this pull request Oct 27, 2026
The native renderer read the \. in C:\Users\me\.t3 as an escape and
dropped the separator. Ship the Enriched Markdown fork archive with the
opt-in md4cFlags.preserveWindowsPaths (upstream software-mansion/enriched-markdown#1105)
and turn it on, replacing the pnpm patch. The JS document parser used
for PR descriptions keeps prose paths the same way.

Co-authored-by: OhadC <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
CommonMark reads the \. in C:\Users\me\.config as an escape and drops the
separator. With md4cFlags.preserveWindowsPaths, a backslash escape inside a
Windows drive path in prose keeps its backslash. Escapes elsewhere, code,
link destinations, titles and image alt text are unchanged.

Uses ENRMRKD_FLAG_ESCAPEDTEXT from software-mansion-labs/md4c to tell an
escape from a literal character.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge
juliusmarminge force-pushed the fix/windows-path-escapes branch from ebd6365 to 4e76cb5 Compare October 27, 2026 23:22
juliusmarminge added a commit to pingdotgg/t3code that referenced this pull request Oct 27, 2026
The native renderer read the \. in C:\Users\me\.t3 as an escape and
dropped the separator. Ship the Enriched Markdown fork archive with the
opt-in md4cFlags.preserveWindowsPaths (upstream software-mansion/enriched-markdown#1105)
and turn it on, replacing the pnpm patch. The JS document parser used
for PR descriptions keeps prose paths the same way.

Co-authored-by: OhadC <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
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.

1 participant