anthropics / anthropics/claude-code

[Bug] Markdown emphasis delimiters broken with CJK punctuation in Japanese output

Aperta
#89,827 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area:model area:tui bug platform:macos
Lingua principale
Python
Stelle
145k
Fork
23.1k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

**Bug Description**

## English version

Claude routinely emits Markdown such as `これは**「重要」**な点です。`, placing

`**` immediately outside CJK brackets or punctuation. Under CommonMark 0.31.2

§6.2, a `**` run only opens emphasis if it is left-flanking and only closes if

it is right-flanking. Because CJK text has no spaces around brackets, neither

condition (2a) nor (2b) is satisfied, so the delimiters are not recognized and

the literal `**` characters are rendered as text.

A worse variant: in `**「A」**なので**「B」**`, neither A nor B is emphasized —

instead the text *between* them ("なので") is emphasized, inverting the intent.

This happens many times a day in ordinary Japanese usage and is not a corner case.

Requested fixes (ideally both):

1. **Generation side** — when writing Japanese, keep punctuation outside the

emphasis span: prefer `「**重要**」` over `**「重要」**`, `(**注**)` over

`**(注)**`, and `**重要です**。` over `**重要です。**`.

2. **Rendering side** — adopt a CJK-friendly emphasis extension in the Markdown

renderer used by the Claude apps and claude.ai, so that existing output

renders as intended.

References:

- CommonMark 0.31.2 §6.2 — https://spec.commonmark.org/0.31.2/#emphasis-and-strong-emphasis

- Analysis by Shinyu Murakami (Vivliostyle) — https://gist.github.com/MurakamiShinyu/da24dbd6c1c2342331aa9dda23de477f

- vivliostyle/vfm#193 — https://github.com/vivliostyle/vfm/issues/193

- Mitigation plugin write-up — https://qiita.com/tats-u/items/f571313793b367d7c326

**Environment Info**
- Platform: darwin
- Terminal: Apple_Terminal
- Version: 2.1.176
- Feedback ID: eed7c54f-e2d2-4d60-b0a6-b5bf08fe4b0d

## 日本語版(短縮・フィードバック欄用)

日本語出力で強調が崩れます。Claude は `これは**「重要」**な点です。` のように
約物(「」『』()、。)の外側に `**` を置いた Markdown を頻繁に生成しますが、
CommonMark 6.2 の left/right-flanking delimiter run 規則では、約物に隣接し
かつ前後に空白のない `**` は強調マーカーとして認識されません。結果、太字に
ならず `**` が生テキストとして表示されます。

`**「A」**なので**「B」**` の形では、A・B が強調されず、あいだの「なので」が
強調されるという逆転も起きます。

対策として次のいずれか(できれば両方)を希望します。

1. 生成側: 日本語出力時に強調範囲の先頭・末尾を約物にしない
(`**「重要」**` ではなく `「**重要**」`)。
2. 描画側: Claude アプリ/claude.ai の Markdown レンダラで CJK 対応の
強調拡張(cjk-friendly emphasis)を採用する。

参考:
- CommonMark 0.31.2 §6.2 Emphasis and strong emphasis
https://spec.commonmark.org/0.31.2/#emphasis-and-strong-emphasis
- 村上真雄(Vivliostyle)による解説
https://gist.github.com/MurakamiShinyu/da24dbd6c1c2342331aa9dda23de477f
- vivliostyle/vfm#193
https://github.com/vivliostyle/vfm/issues/193
- 緩和用プラグインの解説(tats-u)
https://qiita.com/tats-u/items/f571313793b367d7c326

**Errors**
```json
[]
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

No repository files, tests, or entry points are named. Start by determining whether Claude Code owns Japanese Markdown generation or whether the behavior belongs to the Claude apps/claude.ai renderer, then reproduce the supplied CJK examples against the relevant component; done means emphasis renders correctly without literal delimiters or inverted spans.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
markdown
Ambito
documentation
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.