You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
parseGfm / parseGfmWithMath (packages/client/ui-primitives/src/markdown/parse.ts) use micromark-extension-gfm, which defaults singleTilde: true.
In Chinese and technical prose, ~ is commonly used as a range or approximate sign (e.g. 350~500ml, 1~1.5 升). With singleTilde enabled, a lone ~ pairs with a later ~ and the text in between renders as strikethrough.
Repro:
parseGfm('350~500ml 的小瓶,那才 1~1.5 升,更没问题。')
The span ~500ml 的小瓶,那才 1~ is struck through. GitHub itself ignores lone ~ — only ~~double-tilde~~ is strikethrough per GFM spec.
Root cause
micromark-extension-gfm's singleTilde option defaults to true, allowing a single ~ as a strikethrough delimiter.
Fix
Pass gfm({ singleTilde: false }) so strikethrough strictly requires ~~ and lone ~ renders literally. Applies to both parseGfm and parseGfmWithMath, covering both rendering arms (streaming and settled).
Tests
Added 2 regression cases to markdown-dom-parity.client.spec.tsx with matching fixtures:
single-tilde-range-not-strikethrough — a range like 350~500ml is no longer struck through
single-tilde-escaped-and-bare — escaped tilde, real ~~strikethrough~~, and bare single tildes all behave correctly
pnpm vitest run packages/client/ui-primitives/tests/markdown-dom-parity.client.spec.tsx — 52 passed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem
parseGfm/parseGfmWithMath(packages/client/ui-primitives/src/markdown/parse.ts) usemicromark-extension-gfm, which defaultssingleTilde: true.In Chinese and technical prose,
~is commonly used as a range or approximate sign (e.g.350~500ml,1~1.5 升). WithsingleTildeenabled, a lone~pairs with a later~and the text in between renders as strikethrough.Repro:
The span
~500ml 的小瓶,那才 1~is struck through. GitHub itself ignores lone~— only~~double-tilde~~is strikethrough per GFM spec.Root cause
micromark-extension-gfm'ssingleTildeoption defaults totrue, allowing a single~as a strikethrough delimiter.Fix
Pass
gfm({ singleTilde: false })so strikethrough strictly requires~~and lone~renders literally. Applies to bothparseGfmandparseGfmWithMath, covering both rendering arms (streaming and settled).Tests
Added 2 regression cases to
markdown-dom-parity.client.spec.tsxwith matching fixtures:single-tilde-range-not-strikethrough— a range like350~500mlis no longer struck throughsingle-tilde-escaped-and-bare— escaped tilde, real~~strikethrough~~, and bare single tildes all behave correctlypnpm vitest run packages/client/ui-primitives/tests/markdown-dom-parity.client.spec.tsx— 52 passed.All reactions