Repository navigation
fix(site): 中文标点后的加粗/斜体正常闭合(0.7.85) - #83
Merged
Merged
Conversation
CommonMark only closes `**...**` after punctuation such as `?` when whitespace or more punctuation follows, so Chinese like `**用 MCP?**在` rendered its asterisks literally. The site renderer now treats a CJK letter on the outer side of a delimiter run like whitespace; runs with no CJK letter beside them keep the standard result. The changelog also records the evidence-chain context-knowledge-query Skill from #82. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复网站中文加粗:
**用 MCP 还是知识包?**不在…这类写法在页面上原样显示星号。发布 0.7.85。Compatibility
无数据或接口兼容影响。旁边没有 CJK 字母的
*/_渲染结果与此前完全一致;旧 CLI 构建的网站在下一次context build时自动重新渲染(PACKAGE_SITE_VERSION已包含渲染配置与 CLI 版本)。Verification
见下方「自测情况」。
Checklist
bun run verify:fullpasses.(本地跑了bun run build、typecheck、lint 与 context-cli 全量bun test,见自测情况;完整 verify:full 由 CI 执行)背景
CommonMark 规定:结束的
**前面是标点(如?、)、、)时,后面必须是空白或标点才能闭合强调。中文标点后通常直接接汉字,因此**用知识包还是 MCP?**在本地写代码不会加粗,星号原样输出;有时还会与后面的加粗错配,生成嵌套的<strong>。VitePress 使用的 markdown-it 严格遵循该规则,问题来自规范对 CJK 不友好,而不是写法错误。改动
packages/context-cli/src/project/packageSiteTheme.ts:网站 markdown 配置中按实例替换 inline State 的scanDelims:分隔符外侧是汉字、平假名、片假名或谚文字母时,按空白处理来判断左/右侧翼;两侧都没有 CJK 字母时直接返回 markdown-it 原结果。不新增依赖。siteCjkEmphasis.test.ts。bun.lock只改 workspace 版本行);CHANGELOG 补记 feat(package): context-knowledge-query 按证据链查询 #82 的证据链 Skill。风险
只影响网站 HTML 渲染;包内 Markdown、llms 文本、搜索语料的分词不受影响。可能的变化仅限「标点 +
**+ CJK 字母」这类原本渲染失败的位置。向后兼容
现有工作区无需任何操作;升级后下一次构建会重新渲染网站。英文及无 CJK 相邻的内容输出不变。
自测情况
siteCjkEmphasis.test.ts:中/日/韩及扩展区汉字共 6 个修复用例;13 个英文、代码风格与混排用例(a * b * c、snake_case、__init__、2*3*4等)与原生 markdown-it 输出逐字相同。bun test:1357 pass;4 个失败(cli.test.ts插件安装 2 个、statusReadCost、productionReadReuse)在未修改的main上同样失败,与本改动无关。bun run build、typecheck、release:prepare通过;lint 0 error。version行;搜索索引文档、字段与 17,608 个词条完全一致(仅文档顺序不同)。另在一个以中文为主的知识站点上对比,只有含该写法的 2 个页面变为正确加粗,其余内容不变。🤖 Generated with Claude Code