Back to Prettier

18656

changelog_unreleased/markdown/18656.md

3.9.0936 B
Original Source

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), 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'