Skip to content

Fix dcc.Markdown blanking emoji character references - #4194

Merged
T4rk1n merged 5 commits into
devfrom
fix/markdown-astral-entities
Nov 26, 2026
Merged

T4rk1n merged 5 commits into
devfrom
fix/markdown-astral-entities

Conversation

@T4rk1n

@T4rk1n T4rk1n commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Since 4.5.0, dcc.Markdown renders numeric character references above U+FFFF as blank, so 😀 shows nothing where it used to show an emoji. The parser that react-markdown 8 pulls in mishandles them. This moves dcc to react-markdown 9 (with remark-gfm 4, remark-math 6, rehype-raw 7, unist-util-visit 5), whose parser handles them.

v9 dropped a few things we relied on, so they come back as small plugins:

  • rehypeLinkTarget.ts replaces the removed linkTarget option. As before, link_target applies to every link, raw HTML ones included.
  • rehypeBlockCode.ts replaces the removed inline flag, so only code inside <pre> gets highlighted.
  • remark-math 6 wraps display math in <pre><code>, so rehypeDashMath.ts unwraps it.
  • v9's default URL check drops tel:. A custom urlTransform keeps it, as v8 did.
  • v9 uses Object.hasOwn and Array.prototype.at, which are newer than our browserslist and are not caught by es-check. polyfills.ts adds them only when missing, and only loads with the Markdown chunk.
  • entities, vfile-location and style-to-object are added to the Babel include list so the bundle still passes the ES2018 check. Prettier also reformatted webpack.config.js because the pre-commit hook checks the whole file. The only real change is that include line.

Other differences:

  • javascript: URLs are still neutralized. v8 rewrote them to javascript:void(0), v9 empties them, and it now does so for every URL attribute in raw HTML (src, action and so on), not only links and images.

Tests mkdw019 to mkdw024 cover emoji entities (Markdown and raw HTML), code highlighting, display math, link_target on raw links, tel:, and rendering with the two builtins deleted. Each one fails without its fix.

Note: #4130 also touches Markdown.tsx and the math path, so whichever lands second will need a rebase.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Dash performance benchmarks

⚠️ regressions to review

scenario metric p90 (ms) median growth baseline p90 note
⚠️ full_children_replace replace_ms 151.1 87.4 3.15x 161.2 1.4x baseline (norm)
⚠️ patch_scalar_update_large update_ms 131.0 108.6 0.96x 144.7 1.3x baseline (norm)
✅ callback_chain chain_ms 359.8 346.3 0.97x 595.4
✅ callback_chain graph_ms 1.8 1.8 1.0x 2.1
✅ callback_fanout fanout_ms 70.7 67.4 0.85x 88.3
✅ callback_fanout_children_update fanout_ms 134.8 123.2 0.87x 164.8
✅ deep_nesting render_ms 44.5 41.8 1.19x 61.1
✅ initial_render_large render_ms 470.6 446.9 0.96x 697.8
✅ initial_render_small render_ms 74.8 67.6 0.97x 102.7
✅ patch_append_nested append_ms 110.2 73.6 2.37x 127.2
✅ patch_append_toplevel append_ms 116.1 72.9 2.36x 165.8
✅ rerender_existing_subtree rerender_ms 93.9 86.4 0.86x 121.0
✅ wildcard_all_resolve wildcard_ms 260.7 230.8 0.95x 313.4
✅ wildcard_all_resolve graph_ms 1.1 1.1 1.0x 1.2

growth = late-third / early-third per-op time; ~1 is flat, a large value means the per-op cost scales with accumulated state.

machine scale vs baseline: 0.69x - divided out of the baseline ratios so they compare like for like (the absolute warn/fail ceilings are left un-scaled); calibrated on initial_render_small.

@camdecoster camdecoster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I only have one non-blocking comment.

"react-fast-compare": "^3.2.2",
"react-input-autosize": "^3.0.0",
"react-markdown": "^8.0.7",
"react-markdown": "^9.1.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're already doing a major upgrade, could you go ahead and upgrade to v10?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in f18f32b: v10 only removed the className prop, which we don't pass, so it is a drop-in. The markdown integration tests pass.

@sonarqubecloud

Copy link
Copy Markdown

@T4rk1n
T4rk1n merged commit 1cfa5be into dev Nov 26, 2026
52 of 53 checks passed
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.

3 participants