Skip to content

fix(ui): render bold CJK text that ends in punctuation - #376

Merged
linshenkx merged 1 commit into
linshenkx:developfrom
b84330808:fix/cjk-emphasis-markdown
Nov 13, 2026
Merged

linshenkx merged 1 commit into
linshenkx:developfrom
b84330808:fix/cjk-emphasis-markdown

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

Summary

Preview leaves ** as literal asterisks when the bold text ends in CJK punctuation and the next character is a CJK letter, e.g. **注意:**请先备份数据。, 1. **角色定位:**你是一名资深产品经理 or **「重点」**内容. CommonMark only closes emphasis before whitespace or punctuation, and Chinese and Japanese text has no spaces between words.

Both parsers in prepareMarkdownOutput are affected, so this shows up in Preview (the default output view) for optimized prompts, test results and favorites.

Add markdown-it-cjk-friendly (MIT, one dependency: get-east-asian-width) to both parsers. Emphasis that CommonMark already accepts renders the same as before.

Validation

  • New tests/unit/utils/markdown-output.spec.ts: on develop at 82e94e8 the CJK cases fail for both parsers (2 failed, 1 passed); with the change all 3 pass.
  • pnpm -F @prompt-optimizer/core build, then in packages/ui: the Markdown and HTML preview specs (MarkdownRenderer.*.spec.ts, html-preview.spec.ts, markdown-output-client.spec.ts, 57 tests) pass, vue-tsc --noEmit, eslint src/utils/markdown-output.ts and vite build pass.
  • node scripts/check-no-chinese-runtime.mjs passes.

CommonMark only closes `**` before whitespace or punctuation, so
`**注意:**请先备份数据。` stayed as literal asterisks in Preview.
Use markdown-it-cjk-friendly in both Markdown output parsers.
@vercel

vercel Bot commented Nov 12, 2026

Copy link
Copy Markdown

@b84330808 is attempting to deploy a commit to the linshenkx's projects Team on Vercel.

A member of the Team first needs to authorize it.

@linshenkx
linshenkx merged commit 71f5151 into linshenkx:develop Nov 13, 2026
0 of 3 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