Skip to content

fix(client): render fences whose label carries trailing punctuation - #335

Merged
taekchef merged 3 commits into
omdsh-dev:mainfrom
SparkElf:fix/fence-label-punctuation
Oct 20, 2026
Merged

taekchef merged 3 commits into
omdsh-dev:mainfrom
SparkElf:fix/fence-label-punctuation

Conversation

@SparkElf

@SparkElf SparkElf commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

当模型把围栏语言写成 dsh-ui> 或 DSH-UI 时,原先可能只显示代码块,且没有纠错反馈。本改动统一客户端发现、首次接管、后续维护、围栏编号及服务端纠错的语言识别,让这些容错写法完整生效。

  • 将大小写、空白和尾部标点归一化提取为客户端与服务端共用的纯字符串规则。
  • 在 DOM 语言白名单过滤前处理标签,覆盖流式内容及宿主类名变化后的发现路径。
  • 保留无语言与来源不可用的区别;dsh-ui-special、dsh-ui-dark、JSON 和普通代码保持各自语义。
  • 更新 SKILL 的围栏指引,统一推荐写法与实际容错行为。

验证:Node 24 下 npm run check 通过(100 个文件、1297 项测试,含类型、构建与独立导出检查);verify-pack 通过(2.61 MB / 8.60 MB)。新增真实 DOM 与服务端回归在修复前出现 8 项预期失败,修复后通过。已合入当前 main 的输入框隔离和 Mermaid 字体修复,未发布 npm 版本。

SparkElf and others added 3 commits October 20, 2026 00:50
A fence written as ```dsh-ui> (one stray `>` after the language tag) never
renders: the host's mdast keeps the tag verbatim, so the snapshot language is
`dsh-ui>` rather than `dsh-ui`, and the takeover check falls through to the
generic code-block path. Nothing warns — the reply just shows raw JSON.

A single real session held 182 such fences. Normalize the label before every
comparison instead: trim, ignore case, and strip trailing punctuation from the
tag. Four decisions share the resolver (candidate discovery, ordinal counting,
takeover, diagnostic rebuild) so a fence cannot be found by one and rejected by
another. Labels that merely start with `dsh-ui` (`dsh-ui-special`) are left
alone, and the null/undefined distinction the content-fallback relies on is
preserved.

Also teach the fence label rule in SKILL.md, with the failure table.
@taekchef
taekchef merged commit 1f4d9ea into omdsh-dev:main Oct 20, 2026
6 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.

2 participants