Skip to content

fix(markdown-core): CJK-friendly emphasis flanking so **标签:**正文 renders bold (#101120)#101230

Merged
steipete merged 5 commits into
openclaw:mainfrom
nicknmorty:fix/cjk-emphasis-flanking-101120
Jul 7, 2026
Merged

fix(markdown-core): CJK-friendly emphasis flanking so **标签:**正文 renders bold (#101120)#101230
steipete merged 5 commits into
openclaw:mainfrom
nicknmorty:fix/cjk-emphasis-flanking-101120

Conversation

@nicknmorty

@nicknmorty nicknmorty commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #101120

What Problem This Solves

CJK Markdown such as **标题:**正文 can render literal emphasis markers. CommonMark's closing-delimiter rule rejects punctuation immediately inside ** when adjacent CJK text follows without whitespace. Because Telegram, Signal, and Slack consume the shared Markdown IR, the defect belongs in packages/markdown-core, not in one transport.

Why This Change Was Made

  • Enable the maintained MIT markdown-it-cjk-friendly 2.0.2 plugin at the shared MarkdownIt construction point.
  • Keep the dependency local to @openclaw/markdown-core; its only runtime dependency, get-east-asian-width, was already resolved in this workspace.
  • Replace the submitted 125-line local delimiter/Unicode implementation with the upstream amendment, which directly covers supplementary CJK, variation selectors, ambiguous punctuation, underscores, Unicode whitespace, and the CommonMark corpus.
  • Keep Telegram's reported-output regression while adding shared IR regressions for Chinese, Japanese, Korean, supplementary-plane CJK, variation selectors, Unicode whitespace, ordinary Latin, intraword underscores, code spans, and links.

User Impact

CJK emphasis now renders consistently through every channel using the shared Markdown IR. Ordinary CommonMark behavior remains unchanged outside the CJK-friendly amendment; invalid whitespace-delimited openers remain literal.

Evidence

Reviewed head: dbc66f154026d80e23b496d723e60762712cd0ca

  • Sanitized AWS Crabbox cbx_ed9e9a7749ff / coral-lobster, public network, no Tailscale, empty instance profile, no credential hydration.
  • Run run_837ab245e94c: pnpm test packages/markdown-core/src/ir.emphasis-cjk.test.ts extensions/telegram/src/format.test.ts — 77 passed; pnpm check:changed -- ... — passed; pnpm build — passed.
  • Run run_4947d71286b2: clean full build plus source-blind built-artifact validation — 11/11 behavior fixtures passed.
  • git diff --check and focused oxfmt --check — passed.
  • Two fresh autoreviews after the dependency rewrite and changelog — clean, no accepted/actionable findings (0.96 and 0.97 confidence).
  • Direct dependency inspection: markdown-it-cjk-friendly 2.0.2 source/tests/package metadata and markdown-it 14.3.0 delimiter scanner; package is ESM-only, MIT, Node 18+, actively maintained, and tests parity against the CommonMark 0.31.2 corpus.

Docs

No command, configuration, or operator workflow changed. The maintainer changelog entry thanks @nicknmorty and references this PR and #101120.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 6, 2026
@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 6e0e94f53990b3dff613f75d135025d99102c55b, but the PR head is now b09b0c8fc650e5e18fb654dafd5c4e665508c9dd. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (4 earlier review cycles)
  • reviewed 2026-07-07T00:01:07.220Z sha 80fa441 :: needs real behavior proof before merge. :: [P1] Use a real markdown-it StateInline type contract
  • reviewed 2026-07-07T01:12:03.976Z sha 92f28bf :: needs real behavior proof before merge. :: [P1] Preserve markdown-it whitespace flanking
  • reviewed 2026-07-07T01:52:28.190Z sha e070fcb :: needs maintainer review before merge. :: none
  • reviewed 2026-07-07T02:54:59.400Z sha 0041bc6 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 7, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 7, 2026
nicknmorty added a commit to nicknmorty/openclaw that referenced this pull request Jul 7, 2026
…miter override

Preserves markdown-it isWhiteSpace classification (U+3000, U+00A0, U+2000-200A, etc.) before forcing CJK-adjacent delimiter flags, and adds U+3000/U+2009 regressions. Addresses clawsweeper P1 finding on openclaw#101230.
@nicknmorty

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 7, 2026
@nicknmorty
nicknmorty force-pushed the fix/cjk-emphasis-flanking-101120 branch from e070fcb to 0041bc6 Compare July 7, 2026 02:34
nicknmorty added a commit to nicknmorty/openclaw that referenced this pull request Jul 7, 2026
…miter override

Preserves markdown-it isWhiteSpace classification (U+3000, U+00A0, U+2000-200A, etc.) before forcing CJK-adjacent delimiter flags, and adds U+3000/U+2009 regressions. Addresses clawsweeper P1 finding on openclaw#101230.
@steipete steipete self-assigned this Jul 7, 2026
nicknmorty added a commit to nicknmorty/openclaw that referenced this pull request Jul 7, 2026
…miter override

Preserves markdown-it isWhiteSpace classification (U+3000, U+00A0, U+2000-200A, etc.) before forcing CJK-adjacent delimiter flags, and adds U+3000/U+2009 regressions. Addresses clawsweeper P1 finding on openclaw#101230.
@nicknmorty
nicknmorty force-pushed the fix/cjk-emphasis-flanking-101120 branch from 0041bc6 to e471027 Compare July 7, 2026 03:17
@steipete
steipete requested a review from a team as a code owner July 7, 2026 03:38
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • packages/markdown-core/package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Dependency graph change authorized

This PR includes dependency graph changes. A repository admin or member of @openclaw/openclaw-secops authorized this exact head SHA with /allow-dependencies-change.

  • Approved SHA: b09b0c8fc650e5e18fb654dafd5c4e665508c9dd
  • Approved by: @steipete
  • Reason: maintained MIT CJK delimiter plugin; exact package source, tests, metadata, lockfile, Node compatibility, and transitive graph reviewed

A later push changes the PR head SHA and requires a fresh security approval.

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jul 7, 2026
nicknmorty and others added 3 commits July 7, 2026 05:30
…miter override

Preserves markdown-it isWhiteSpace classification (U+3000, U+00A0, U+2000-200A, etc.) before forcing CJK-adjacent delimiter flags, and adds U+3000/U+2009 regressions. Addresses clawsweeper P1 finding on openclaw#101230.
@steipete
steipete force-pushed the fix/cjk-emphasis-flanking-101120 branch from 6e0e94f to b09b0c8 Compare July 7, 2026 04:32
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed docs Improvements or additions to documentation channel: signal Channel integration: signal channel: whatsapp-web Channel integration: whatsapp-web app: android App: android app: web-ui App: web-ui gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel scripts Repository scripts commands Command implementations agents Agent runtime and tooling extensions: anthropic extensions: qa-lab extensions: codex size: XL labels Jul 7, 2026
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​markdown-it-cjk-friendly@​2.0.2711009984100

View full report

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
Low adoption: npm markdown-it-cjk-friendly

Location: Package overview

From: packages/markdown-core/package.jsonnpm/[email protected]

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

/allow-dependencies-change maintained MIT CJK delimiter plugin; exact package source, tests, metadata, lockfile, Node compatibility, and transitive graph reviewed

@steipete
steipete merged commit 5909778 into openclaw:main Jul 7, 2026
114 of 119 checks passed
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
…rs bold (openclaw#101120) (openclaw#101230)

* test(telegram): reproduce CJK emphasis flanking bug

* fix(markdown-core): support CJK emphasis flanking

* fix(markdown-core): type CJK delimiter state (openclaw#101120)

* fix(markdown-core): mirror markdown-it Unicode whitespace in CJK delimiter override

Preserves markdown-it isWhiteSpace classification (U+3000, U+00A0, U+2000-200A, etc.) before forcing CJK-adjacent delimiter flags, and adds U+3000/U+2009 regressions. Addresses clawsweeper P1 finding on openclaw#101230.

* refactor(markdown): use maintained CJK flanking plugin

---------

Co-authored-by: Peter Steinberger <[email protected]>
sheyanmin pushed a commit to sheyanmin/openclaw that referenced this pull request Jul 8, 2026
…rs bold (openclaw#101120) (openclaw#101230)

* test(telegram): reproduce CJK emphasis flanking bug

* fix(markdown-core): support CJK emphasis flanking

* fix(markdown-core): type CJK delimiter state (openclaw#101120)

* fix(markdown-core): mirror markdown-it Unicode whitespace in CJK delimiter override

Preserves markdown-it isWhiteSpace classification (U+3000, U+00A0, U+2000-200A, etc.) before forcing CJK-adjacent delimiter flags, and adds U+3000/U+2009 regressions. Addresses clawsweeper P1 finding on openclaw#101230.

* refactor(markdown): use maintained CJK flanking plugin

---------

Co-authored-by: Peter Steinberger <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
…rs bold (openclaw#101120) (openclaw#101230)

* test(telegram): reproduce CJK emphasis flanking bug

* fix(markdown-core): support CJK emphasis flanking

* fix(markdown-core): type CJK delimiter state (openclaw#101120)

* fix(markdown-core): mirror markdown-it Unicode whitespace in CJK delimiter override

Preserves markdown-it isWhiteSpace classification (U+3000, U+00A0, U+2000-200A, etc.) before forcing CJK-adjacent delimiter flags, and adds U+3000/U+2009 regressions. Addresses clawsweeper P1 finding on openclaw#101230.

* refactor(markdown): use maintained CJK flanking plugin

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram dependencies-changed PR changes dependency-related files P2 Normal backlog priority with limited blast radius. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram: bold with CJK punctuation inside closing ** renders as literal asterisks (CommonMark flanking vs CJK)

2 participants