Repository navigation
Conversation
…n does not track Post-merge review of #6658 found two cases where the scan still rewrote a code body: indented code inside a blockquote, and raw HTML blocks (`<pre>` and similar) whose body runs across blank lines. The scan reads one line at a time and does not follow either. Rather than grow the scan, a reply that contains one of these is left exactly as written. The worst case is a stray asterisk; it is never a changed code body. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>
Astro-Han
left a comment
There was a problem hiding this comment.
I reviewed both changed files at 0c515f79998b8ea0703ccd106aa5f1bf4e9b46fc. The new guard preserves the supplied top-level quoted-code and raw-HTML examples, but one P2 remains: quoted indented code inside a list is still rewritten. The inline comment at markdownEmphasis.ts:281 contains the reproducer.
I ran the exact current Markdown-emphasis test file with Node 24: all 12 tests pass. Replacing only the production module with its incoming-base version makes the newly added test fail (11 pass, one fail), confirming the intended cases are repaired. I also passed two counterexamples through the actual production function and the same markdown 1.0.0 parser locked by NSH: - > **原文:**继续 and 1. > **原文:**继续. Both parse as code blocks before and after processing, but the code value changes from **原文:**继续 to **原文**:继续. I checked the BotReply call site and native code-block conversion; this is a changed literal code body, not an emphasis-only difference. I did not run a native desktop or clipboard interaction.
An actual merge with current rust-preview 75fe3d0e059c58b798782604668f37b56a420255 succeeds. CI 42565747315 has completed with failure. I read its macOS log: all 22 Desktop tests pass, then the second pixel test fails while loading the unchanged fixture that binds the reserved Cmd+H shortcut. That failure is separate from this PR's two-file text change and from the P2 above. There is no database schema or protocol change.
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.
| * body can run across blank lines. A reply that has one is left exactly as written, so the | ||
| * worst case is a stray asterisk and never a changed code body. | ||
| */ | ||
| const UNMODELLED = /^[ \t]*(?:>[ \t]*)+(?: {4,}|\t)|<(?:pre|script|style|textarea)\b|<!--/imu; |
There was a problem hiding this comment.
[P2] Include list containers when guarding quoted code. For a Bot reply containing - > **原文:**继续, this pattern does not match because the first container marker is -, so closeCjkEmphasis returns - > **原文**:继续. The project's locked markdown 1.0.0 parser identifies both versions as a list containing a blockquote containing a code block: its literal code changes from **原文:**继续 to **原文**:继续. The ordered-list form 1. > **原文:**继续 fails identically. BotReply.tsx:49 sends the rewritten string to TextView, whose code-block converter preserves that changed value. The new protection therefore still alters displayed code in this supported container shape. Recognize the surrounding list prefixes, or conservatively leave these replies unchanged, and add these cases.
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.
Generated-by: Codex
2e7d8a0 to
6a663ab
Compare
Use a conservative tag-line guard and verify mixed container and HTML block cases, including unterminated processing instructions and declarations. Generated-by: Codex
EnglishThanks for following up on the Good news on the premise noted in the description ("A fix inside the Markdown parser would not need to model any of this, but Because
Closing
中文感谢跟进 关于描述中提到的前提(“如果在 Markdown 解析器内部修复就不需要建模这些情况,但 由于
因此这里先关闭
|
Summary
Follow-up to #6658. The CJK emphasis repair could change literal code inside blockquotes and lists, or text inside raw HTML blocks. For example,
- > **原文:**继续was rewritten to- > **原文**:继续, changing the code block's contents.Replies containing potentially indented code behind mixed quote/list prefixes, HTML tag lines (including closing and custom tags), or raw HTML comment/declaration/processing-instruction openers now remain byte-identical. This also covers CDATA and raw HTML bodies spanning blank lines. Ordinary list and quote prose still receives the emphasis repair.
The guard deliberately skips the entire reply, including ambiguous tag lines: some prose may retain visible asterisks. It avoids expanding the line scan into another Markdown parser. The Markdown parser in
third-party/nshis synchronized from upstream.Verification
0c515f799produces 11 passes and 2 failures, covering the nested-container and raw-HTML regressions.markdownparser verified 5 nested-code fixtures and 9 HTML-block fixtures; the production repair preserves each input exactly. The HTML cases include genuinely unclosed processing instructions and declarations.git diff --checkpassed.ui_typesgenerator and the current workbench sources.AI use
Tool(s) and scope: Claude Code authored the initial guard and tests. Codex implemented the mixed-container and raw-HTML follow-up, validated the behavior, and updated this description. Material AI-authored commits carry
Generated-bytrailers.Checklist
Does this PR entail a change in behavior?