Bug: single tilde (~) renders as strikethrough — gfm() default singleTilde:true in client-ui-primitives markdown parser #1869
erneseye415-source
started this conversation in
General
Replies: 1 comment
|
Verified and staged a patch. The parser here is micromark (not marked), and Repro (micromark-extension-gfm@3, mdast-util-gfm@3, exactly the versions in Cherry-pick-ready branch (both call sites, streaming + settled arms): https://github.com/zoahdev/deepseek-harness/tree/fix/markdown-single-tilde One-line change per call site: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary / 摘要
Markdown source like
每天 2~3 小时,周末 5~6 小时renders with a strikethrough barthrough
3 小时,周末 5. Assistant answers commonly use~for ranges (2~3 小时,2005~2015,2026.8 ~ 12), so every line containing two tildes gets a large span oftext crossed out — visually it looks like leftover edit/diff artifacts, but it is a
parse-level bug, persistent after page refresh.
每天 2~3 小时,周末 5~6 小时这类文本在 Web GUI 中会被渲染成23 小时,周末 56 小时。AI 回答常用~表示区间(2~3 小时、2005~2015),同一行出现两个
~时,中间一大段文字会被删除线划掉,看起来像"草稿修订痕迹",刷新页面也不会消失。Environment / 环境
@deepseek-ai/dsh0.1.0-rc.6(npx 安装的 CLI)@deepseek-ai/dsh-web-frontend/dist(Vite 预构建产物)@deepseek-ai/dsh-client-ui-primitives的 Markdown 语法(编译自src/types/markdown/parse.ts,产物为lib/types/markdown/parse.js)Root cause / 根因
parseGfm()与parseGfmWithMath()以gfm()(无参数)构造 GFM 扩展:micromark-extension-gfm会把 options 透传给micromark-extension-gfm-strikethrough,而后者的
singleTilde默认值为true:于是单个
~既可开又可合,一行中两个~配成一对,把中间文本全部标记为delete,渲染成
<del>(浏览器默认 line-through)。Repro / 最小复现
另一样本(年份区间,与用户截图现象一致):
Fix / 建议修复
两处调用点补上选项即可,标准双波浪号
~~text~~不受影响:建议同时排查代码库中其他以默认参数调用
gfm()的站点(如 plain-text 投影、其他Markdown 消费者),统一显式传
{ singleTilde: false }。Workaround applied locally / 本机临时补丁
在 npx 安装目录内已做等价的临时修复(升级/重装后需重新应用):
node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/index.js— 两处
gfm()→gfm({ singleTilde: false })node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/vendor-*.js— 内联的 strikethrough 工厂默认值
n==null&&(n=!0)→n==null&&(n=!1)Verification / 验证
fromMarkdown(src, {extensions:[gfm()]})产生delete节点(见上)。fromMarkdown(src, {extensions:[gfm({singleTilde:false})]})无delete节点。Related / 相关
singleTilde文档:https://github.com/micromark/micromark-extension-gfm-strikethrough
https://github.github.com/gfm/#strikethrough-extension-
All reactions