[lexical-mdast] Bug Fix: Emphasis typed inside a word of any script stays as typed #9999
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 430 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9999"
general
weight: 0.35
potatowagon
Description
Since #9920, typing
xykeeps it as typed, because aor~run inside a word is more often math or a name. But only ASCII letters and digits counted as inside a word, socaféx,словокурсивandλέξηπλάγιαstill converted mid-word.A letter or decimal digit of any script now counts, with any combining marks after it, so
caféxstays as typed, and so doescafe\u0301x, anewith a combining acute (U+0301). The exceptions, where there is no word boundary to wait for, are unchanged: the CJK of the CJK-friendly amendment (isCjkCharacter, which also covers Hangul), and the scripts Unicode breaks into words by dictionary (Line_Break=SA): Thai, Lao, Khmer, Myanmar, Tai Le, New Tai Lue, Tai Tham, Tai Viet and Ahom. There, emphasis still converts after a letter (日本語,ภาษาไทยเอียง). A symbol is not inside a word: a character an emoji presentation selector (U+FE0F) or a keycap (an enclosing mark) follows, or an ideograph with an ideographic variation selector, so❤️x,1️⃣xand葛󠄀強調still convert. Markdown import and export are untouched.This supersedes the two earlier descriptions on the PR. Two later commits take the automated review's remaining points:
①or½, is not a word character ([\p{L}\p{Nd}], the any-script form of[A-Za-z0-9], rather than[\p{L}\p{N}]).①is not inisCjkCharacter, so手順①注意converted after the second commit where main converts it; it converts again.\p{sc=…}) rather than their script extensions (\p{scx=…}), which also take in letters other scripts share, such as U+02BC, the apostrophe Ukrainian writes inside a word. Soобʼєктnow stays as typed, as after any other letter.Changeset
.changeset/mdast-typed-emphasis-any-script.md(@lexical/mdastpatch,[fix], with aVerify:paragraph).Test plan
Before
MdastStream.tsas on main (4aa11ac91a47), with this branch's tests:7 of the 34 selected cases fail:
caféx,словокурсив,λέξηπλάγια,caféx,café~~x~~,cafe\u0301x(U+0301) andобʼєкт*(U+02BC). The symbol, CJK, Line_Break=SA,①and½cases pass on main and guard against regressions.After
The same command on this branch:
The full unit suite (
pnpm run test-unit, run at two workers):pnpm run ci-checkexits 0 (TypeScript, FlowFound 0 errors, Prettier, ESLint, and the changeset check all pass). The branch is merged up to date with main (c302b4bb4bf8); main's #10001 fixes the playgroundDateTimeComponentdate-picker tests that fail in December, which were the only failures in thecore-tests / unit (24.x)run.Not run: the browser-mode tests (
pnpm run test-browser) and the e2e suites. The change is in the shortcut scanner, which the unit tests above drive by typing into an editor.🤖 Generated with Claude Code