Skip to content

fix(workbench): use native CJK Markdown parsing for Bot replies - #6717

Merged
M4n5ter merged 1 commit into
rust-previewfrom
fix/native-cjk-emphasis
Nov 10, 2026
Merged

M4n5ter merged 1 commit into
rust-previewfrom
fix/native-cjk-emphasis

Conversation

@liugddx

@liugddx liugddx commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

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().text directly to TextView, using the same native parser as other Markdown views.

Deletes markdownEmphasis.ts and its JavaScript tests. Adds three focused Rust behavior tests through nsh_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).
  • Rebuilt the ui_types example, generated fresh declarations, and ran TypeScript against the current UI sources: passed.
  • Biome on BotReply.tsx, rustfmt on the new Rust test, git diff --check, and the staged ASF header check: passed.
  • CI planning against origin/rust-preview passed and selects the root Rust tests plus the related desktop, contracts, and product suites.
  • No native desktop window or clipboard interaction was tested. The parser tests assert the document's emphasis nodes and literal code/HTML text directly; they guard the upstream parser contract rather than testing source text.

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

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

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

  • Native behavior tests cover the parser contract used by Bot replies
  • Format, typecheck and affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

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

@Astro-Han Astro-Han left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@liugddx
liugddx requested a review from M4n5ter November 10, 2026 00:53
@M4n5ter
M4n5ter merged commit bbbf4a2 into rust-preview Nov 10, 2026
32 checks passed
@M4n5ter
M4n5ter deleted the fix/native-cjk-emphasis branch November 10, 2026 01:31
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.

3 participants