Skip to content

[codex] fix iOS WebKit markdown autolink bundle#5687

Open
chaochaoweb3 wants to merge 1 commit into
QuantumNous:mainfrom
chaochaoweb3:codex/gfm-without-autolink-lookbehind
Open

[codex] fix iOS WebKit markdown autolink bundle#5687
chaochaoweb3 wants to merge 1 commit into
QuantumNous:mainfrom
chaochaoweb3:codex/gfm-without-autolink-lookbehind

Conversation

@chaochaoweb3

@chaochaoweb3 chaochaoweb3 commented Jun 23, 2026

Copy link
Copy Markdown

Summary

  • replace browser-bundled remark-gfm with a local GFM preset that excludes gfm-autolink-literal
  • keep GFM footnotes, strikethrough, tables, and task-list items enabled for default and classic frontends
  • alias third-party remark-gfm imports, including Streamdown, to the compatible preset during Rsbuild bundling

Why

mdast-util-gfm-autolink-literal@2.0.1 includes an email autolink regex with lookbehind syntax. iOS 16.1 WebKit cannot parse that regex, so any bundle containing it can fail before React mounts.

Validation

  • cd web && npm exec --yes --package=bun -- bun install --frozen-lockfile
  • cd web/default && npm exec --yes --package=bun -- bun run typecheck
  • cd web/default && npm exec --yes --package=bun -- bun run build
  • rg --fixed-strings "(?<=^|\\s|\\p{P}|\\p{S})" web/default/dist web/default/src web/classic/src web/default/rsbuild.config.ts web/classic/rsbuild.config.ts returned no matches
  • rg "gfmAutolinkLiteral|literalAutolinkEmail|mdast-util-gfm-autolink-literal" web/default/dist web/default/src web/classic/src web/default/rsbuild.config.ts web/classic/rsbuild.config.ts returned no matches
  • git diff --check

Note: web/classic build currently fails on main because date-fns-tz@1.3.8 resolves against date-fns@4 exports, tracked separately in #5670 with an existing fix PR #5676. This PR intentionally does not duplicate that unrelated dependency fix.

Fixes #5550

Summary by CodeRabbit

  • New Features
    • Markdown rendering now supports more GitHub-flavored formatting, including footnotes, strikethrough, tables, and task lists.
    • Improved compatibility for these markdown features across the app’s classic web experience.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d883090f-ffaf-4a0b-aed9-7e985869f960

📥 Commits

Reviewing files that changed from the base of the PR and between bf17259 and 75cdac4.

⛔ Files ignored due to path filters (1)
  • web/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • web/classic/package.json
  • web/classic/rsbuild.config.ts
  • web/classic/src/components/common/markdown/MarkdownRenderer.jsx
  • web/classic/src/helpers/remarkGfmCompatible.js
✅ Files skipped from review due to trivial changes (1)
  • web/classic/rsbuild.config.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • web/classic/src/helpers/remarkGfmCompatible.js
  • web/classic/package.json
  • web/classic/src/components/common/markdown/MarkdownRenderer.jsx

Walkthrough

Adds a local remarkGfmCompatible.js helper to web/classic that manually registers GFM micromark and mdast extensions for footnotes, strikethrough, tables, and task lists—intentionally excluding mdast-util-gfm-autolink-literal. The build config aliases remark-gfm to this local module, and MarkdownRenderer.jsx is updated to use it. Eight new GFM sub-packages are added as explicit dependencies.

WebKit-compatible GFM plugin for web/classic

Layer / File(s) Summary
Compatible GFM plugin implementation and dependencies
web/classic/package.json, web/classic/src/helpers/remarkGfmCompatible.js
Eight mdast-util-gfm-* and micromark-extension-gfm-* sub-packages added as dependencies. New remarkGfmCompatible function registers micromark/mdast extensions for footnotes, strikethrough, tables, and task lists, omitting the autolink-literal module that contains the problematic lookbehind RegExp.
Build alias and component integration
web/classic/rsbuild.config.ts, web/classic/src/components/common/markdown/MarkdownRenderer.jsx
rsbuild.config.ts aliases remark-gfm to the local helper. MarkdownRenderer.jsx imports RemarkGfmCompatible and uses it in the ReactMarkdown remarkPlugins array.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A lookbehind lurked in the bundle so deep,
Crashing old WebKit and breaking its sleep.
I hopped past the autolink, crafted my own,
Now footnotes and tables are safely at home.
iOS 16.1 can browse without fright — ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the iOS WebKit markdown/autolink fix and matches the main change.
Linked Issues check ✅ Passed The changes replace remark-gfm with a local compatible preset that omits autolink lookbehind while preserving other GFM features.
Out of Scope Changes check ✅ Passed All edits support the WebKit compatibility fix; no unrelated code paths or features were introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chaochaoweb3 chaochaoweb3 force-pushed the codex/gfm-without-autolink-lookbehind branch from bf17259 to 75cdac4 Compare June 30, 2026 03:08
@chaochaoweb3

Copy link
Copy Markdown
Author

Rebased this PR onto the latest main and resolved the conflicts.

The default frontend has since moved away from the react-markdown / remark-gfm path to the newer marked renderer, so I dropped the now-obsolete default-frontend compatibility alias and helper from this PR. The remaining change is scoped to the classic frontend, which still imports remark-gfm via react-markdown.

Validation run locally:

  • git diff --check upstream/main...HEAD

I could not run the Bun workspace build here because this machine does not currently have bun installed.

@chaochaoweb3 chaochaoweb3 marked this pull request as ready for review June 30, 2026 03:10
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.

iOS 16.1 WebKit 白屏:前端 bundle 包含不兼容的 RegExp lookbehind

1 participant