|
1 | | -#### Make Markdown's newline handling nearly compatible with the behavior of browsers/CSS (#16805 by @tats-u) |
| 1 | +#### Make space and newline always interchangeable between Chinese/Japanese letter and non-Chinese-or-Japanese character in Markdown (#16805 by @tats-u) |
2 | 2 |
|
3 | | -Markdown documents formatted by Prettier are ultimately rendered in browsers in most cases. Major Markdown-to-HTML converters do not touch newline characters in Markdown paragraphs and leave them to browsers. However, Prettier's newline handling when `proseWrap` is set to `always` or `never` has not been compatible with browsers' behavior. |
| 3 | +Markdown documents formatted by Prettier are ultimately rendered in browsers in most cases. Major Markdown-to-HTML converters do not touch newline characters in Markdown paragraphs and leave them to browsers. However, Prettier's newline handling when `proseWrap` is set to `always` or `never` has not been compatible with the behavior of CSS/browsers (especially Firefox). |
4 | 4 |
|
5 | | -https://wpt.fyi/results/css/css-text/line-breaking?label=master&label=experimental&aligned&q=segment-break-transformation-rules- |
| 5 | +https://wpt.fyi/results/css/css-text/line-breaking?label=master&label=experimental&aligned&q=segment-break-transformation- |
6 | 6 |
|
7 | 7 | The PR [#11597](https://github.com/prettier/prettier/pull/11597) mistakenly introduced an excessively complex specification that a newline between han and an non-CJK character can be converted to a space or just removed depending on the frequency of spaces between han and non-CJK characters, but it is not compatible with any browsers' behavior. Therefore, we removed this specification and conform to the browser's behavior. |
8 | 8 |
|
9 | | -This change allows us to treat a line break between a Chinese/Japanese non-punctuation character and a non-Chinese/Japanese character as interchangeable with a space without conditions even when `proseWrap` is set to `always`. |
| 9 | +This change allows us to treat a line break between a Chinese/Japanese non-punctuation character and a non-Chinese/Japanese character as interchangeable with a space without conditions even when `proseWrap` is set to `always`. It also improve the visual consistency of rendered Markdown documents between Prettier and browsers. |
10 | 10 |
|
11 | 11 | <!-- prettier-ignore --> |
12 | 12 | ```md |
13 | 13 | <!-- Input (--prose-wrap=always --print-width=20) --> |
14 | | -日本語 English 汉语 English 漢語 English |
15 | | -日本語 English 汉语 English 漢語 English |
| 14 | +日本語 English 中文 English |
| 15 | +日本語 English 中文 English |
16 | 16 | 日本語 |
17 | 17 | English |
18 | | -汉语 |
| 18 | +中文 |
19 | 19 | English |
20 | | -漢語 |
21 | | -English |
22 | | -日本語English汉语English漢語English |
| 20 | +日本語English中文English |
23 | 21 |
|
24 | | -日本語English汉语English漢語English |
25 | | -日本語English汉语English漢語English |
| 22 | +日本語English中文English |
| 23 | +日本語English中文English |
26 | 24 | 日本語 |
27 | 25 | English |
28 | | -汉语 |
29 | | -English |
30 | | -漢語 |
| 26 | +中文 |
31 | 27 | English |
32 | | -日本語 English 汉语 English 漢語 English |
| 28 | +日本語 English 中文 English |
33 | 29 |
|
34 | 30 | <!-- Prettier stable --> |
35 | | -日本語 English 汉语 English 漢語 English 日本語 English 汉语 English 漢語 English 日本語 English 汉语 English 漢語 English 日本語English汉语English漢語English |
| 31 | +日本語 English 中文 English 日本語 English 中文 English 日本語 English 中文 English 日本語English中文English |
36 | 32 |
|
37 | | -日本語English汉语English漢語English日本語English汉语English漢語English日本語 English 汉语English 漢語 English日本語 English 汉语English 漢語 English |
| 33 | +日本語English中文English日本語English中文English日本語English中文English日本語 English 中文 English |
38 | 34 |
|
39 | 35 | <!-- Prettier main --> |
40 | | -日本語 English 汉语 |
41 | | -English 漢語 English |
42 | | -日本語 English 汉语 |
43 | | -English 漢語 English |
44 | | -日本語 English 汉语 |
45 | | -English 漢語 English |
46 | | -日本語English汉语English漢語English |
47 | | - |
48 | | -日本語English汉语English漢語English |
49 | | -日本語English汉语English漢語English |
50 | | -日本語 English 汉语 |
51 | | -English 漢語 English |
52 | | -日本語 English 汉语 |
53 | | -English 漢語 English |
| 36 | +日本語 English 中文 |
| 37 | +English 日本語 |
| 38 | +English 中文 English |
| 39 | +日本語 English 中文 |
| 40 | +English |
| 41 | +日本語English中文English |
| 42 | + |
| 43 | +日本語English中文English |
| 44 | +日本語English中文English |
| 45 | +日本語 English 中文 |
| 46 | +English 日本語 |
| 47 | +English 中文 English |
| 48 | + |
54 | 49 | ``` |
0 commit comments