Treat U+3000 and U+FF5E as CJK punctuation-equivalent in Markdown prose wrap (#18656)

Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
Tatsunori Uchinoandfisker authored and GitHub committed 2026-01-18 09:34:45 +08:00
1 parent 3876c1143b
commit 1f678ab02f
6 files changed
+67 -39

No files matched your search

+5 -4
View File
@@ -2,12 +2,13 @@
Some tools treat these spaces as meaningful.
```bash
await require('prettier').format('/**\n * With 2 spaces \n */', {parser: 'babel'});
```js
await prettier.format("/**\n * With 2 spaces \n */", { parser: "babel" });
# Prettier stable
/* Prettier stable */
// -> '/**\n * With 2 spaces\n */\n'
# Prettier main
/* Prettier main */
// -> '/**\n * With 2 spaces \n */\n'
// ^^ space preserved
```
+17
View File
@@ -0,0 +1,17 @@
#### Treat U+3000 as CJK punctuation-equivalent and make sure to recognize U+FF5E as CJK punctuation again in Markdown prose wrap (#18656 by @tats-u)
We improved the text wrapping in Markdown written in Chinese and Japanese by treating some non Unicode punctuation characters as equivalent to CJK punctuation. A part of this was assumed to have been introduced in 3.5.0 ([#16832](https://github.com/prettier/prettier/pull/16832)), but it was not fully implemented and not noticed until now due to insufficient test cases.
```js
await prettier.format(
"U+3000\u{3000}\nU+301C\u{301C}\nU+FF5E\u{FF5E}\nU+1F221\u{1F221} 测试 Test テスト\n",
{ parser: "markdown", proseWrap: "always" },
);
/* Prettier stable */
// -> 'U+3000  U+301C〜U+FF5E~ U+1F221🈡 测试 Test テスト\n'
//  ^ extra space  ^ extra space
/* Prettier main */
// -> 'U+3000 U+301C〜U+FF5E~U+1F221🈡 测试 Test テスト\n'
```