Repository navigation
fix(workbench): use native CJK Markdown parsing for Bot replies - #6717
Conversation
Remove the source-rewriting emphasis pass now that the synchronized NSH parser supports CJK delimiter rules. Cover punctuation placement, nested code, and raw HTML preservation with native parser behavior tests. Generated-by: Codex
There was a problem hiding this comment.
I reviewed all four changed files at e8b1a60e79ed5126268755d2c9480646218d392a and traced BotReply through TextView to the existing native Markdown parser. Removing the JavaScript repair is appropriate: the parser already supports CJK delimiter rules, while the old repair can alter literal code and move punctuation out of emphasis. No confirmed P0–P2 finding in this change.
The actual BotReply component, run with controlled UI adapters, forwards eight representative inputs unchanged. The old component changes six of them, including nested quoted code and raw HTML as well as prose punctuation. I ran cargo test --locked -p maka-workbench --test markdown: all three native-parser behavior tests pass, covering CJK emphasis and literal nested code/HTML preservation. All 157 Workbench JavaScript tests pass after installing the locked dependencies and applying the normal patches; the source-header check also passes. The deleted helper has no remaining import. No native window, selection or clipboard acceptance was performed locally.
An actual merge with rust-preview ee7e906056aa256e584e21e060ae106e6399c094 succeeds. I read the hosted native logs and verified their checkout against the synthetic merge already checked against my actual current-base merge. Windows job 129091762968 passes all 22 selected Desktop tests (329.873 seconds) and both pixel tests (1.556 seconds); macOS job 129091763280 passes all 22 selected Desktop tests (236.885 seconds) and both pixel tests (2.523 seconds).
CI 42595122938 has completed successfully.
This change adds no database schema or protocol epoch.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Summary
Bot replies still pass through a JavaScript Markdown repair even though #6708 added CJK-friendly parsing in NSH. That repair moves punctuation out of emphasis and can rewrite literal code inside quoted/list containers. Bot replies now pass the original
message().textdirectly toTextView, using the same native parser as other Markdown views.Deletes
markdownEmphasis.tsand its JavaScript tests. Adds three focused Rust behavior tests throughnsh_base::text_view::Parser: punctuation remains inside CJK bold/italic/strikethrough spans, nested and HTML code retains its literal body, and raw HTML spanning blank lines does not disable emphasis in adjacent prose. The raw-HTML test uses literal HTML mode so scripts and comments remain observable.Follow-up requested in the closing review of #6712. Refs #6658 and #6413 (Bot chat presentation only; the capability inventory remains open).
Verification
cargo test --locked -p maka-workbench --test markdown: 3 passed.node --test products/maka/workbench/tests/*.test.mjs: 157 passed (Node 24.21.0).ui_typesexample, generated fresh declarations, and ran TypeScript against the current UI sources: passed.BotReply.tsx, rustfmt on the new Rust test,git diff --check, and the staged ASF header check: passed.origin/rust-previewpassed and selects the root Rust tests plus the related desktop, contracts, and product suites.Example covered by the new tests:
- > **原文:**继续retains code body**原文:**继续; the paragraphs before and after it still parse**前文:**继续into a strong span containing前文:followed by继续.AI use
Tool(s) and scope: Codex implemented the cleanup, wrote the native parser tests, ran the checks, and drafted this description. The commit carries
Generated-by: Codex.Checklist
Does this PR entail a change in behavior?