Correctly format CJK sentences with Variation Selector. (#8511)
* Correctly format CJK sentences with IVS. * Changelog pr-8511 * Changelog title should contain the title * GitHub user name can contain `-`. https://github.com/prettier/prettier/pull/8511#issuecomment-640231668
This commit is contained in:
1 parent
a9fd99846a
commit
0f8cc01aa5
5 files changed
+32
-3
No files matched your search
@@ -0,0 +1,13 @@
|
|||||||
|
#### Correctly format CJK sentences with Variation Selector ([#8511](https://github.com/prettier/prettier/pull/8511) by [@ne-sachirou](https://github.com/ne-sachirou))
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
```markdown
|
||||||
|
<!-- Input -->
|
||||||
|
麻󠄁羽󠄀‼️
|
||||||
|
|
||||||
|
<!-- Prettier stable -->
|
||||||
|
麻 󠄁 羽 󠄀 ‼️
|
||||||
|
|
||||||
|
<!-- Prettier master -->
|
||||||
|
麻󠄁羽󠄀‼️
|
||||||
|
```
|
||||||
+1
-1
@@ -387,7 +387,7 @@
|
|||||||
],
|
],
|
||||||
"ignoreRegExpList": [
|
"ignoreRegExpList": [
|
||||||
"<!-- prettier-ignore -->\\n(`{3,})\\w*\\n[\\s\\S]+?\\1",
|
"<!-- prettier-ignore -->\\n(`{3,})\\w*\\n[\\s\\S]+?\\1",
|
||||||
"\\[(\\*{2})?@\\w+?\\1\\]",
|
"\\[(\\*{2})?@[-\\w]+?\\1\\]",
|
||||||
"\\[`\\w+`\\]",
|
"\\[`\\w+`\\]",
|
||||||
"ve{2,}r{2,}y",
|
"ve{2,}r{2,}y",
|
||||||
"ve+r+y+long\\w*",
|
"ve+r+y+long\\w*",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const cjkRegex = require("cjk-regex");
|
|||||||
const regexpUtil = require("regexp-util");
|
const regexpUtil = require("regexp-util");
|
||||||
const unicodeRegex = require("unicode-regex");
|
const unicodeRegex = require("unicode-regex");
|
||||||
|
|
||||||
const cjkPattern = cjkRegex()
|
const cjkPattern = `(?:${cjkRegex()
|
||||||
.union(
|
.union(
|
||||||
unicodeRegex({
|
unicodeRegex({
|
||||||
Script_Extensions: ["Han", "Katakana", "Hiragana", "Hangul", "Bopomofo"],
|
Script_Extensions: ["Han", "Katakana", "Hiragana", "Hangul", "Bopomofo"],
|
||||||
@@ -18,7 +18,9 @@ const cjkPattern = cjkRegex()
|
|||||||
],
|
],
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.toString();
|
.toString()})(?:${unicodeRegex({
|
||||||
|
Block: ["Variation_Selectors", "Variation_Selectors_Supplement"],
|
||||||
|
}).toString()})?`;
|
||||||
|
|
||||||
const kPattern = unicodeRegex({ Script: ["Hangul"] })
|
const kPattern = unicodeRegex({ Script: ["Hangul"] })
|
||||||
.union(unicodeRegex({ Script_Extensions: ["Hangul"] }))
|
.union(unicodeRegex({ Script_Extensions: ["Hangul"] }))
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ This ia an english paragraph with a CJK quote “中文“.
|
|||||||
该网站在国外无法访问,故以下演示无效
|
该网站在国外无法访问,故以下演示无效
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
IVS 麻󠄁羽󠄀‼️
|
||||||
|
|
||||||
=====================================output=====================================
|
=====================================output=====================================
|
||||||
這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長
|
這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長
|
||||||
很長的段落
|
很長的段落
|
||||||
@@ -49,6 +51,8 @@ This ia an english paragraph with a CJK quote “中文“.
|
|||||||
|
|
||||||
::: warning 注意该网站在国外无法访问,故以下演示无效 :::
|
::: warning 注意该网站在国外无法访问,故以下演示无效 :::
|
||||||
|
|
||||||
|
IVS 麻󠄁羽󠄀‼️
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -75,6 +79,8 @@ This ia an english paragraph with a CJK quote “中文“.
|
|||||||
该网站在国外无法访问,故以下演示无效
|
该网站在国外无法访问,故以下演示无效
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
IVS 麻󠄁羽󠄀‼️
|
||||||
|
|
||||||
=====================================output=====================================
|
=====================================output=====================================
|
||||||
這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落
|
這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落
|
||||||
|
|
||||||
@@ -90,6 +96,8 @@ This ia an english paragraph with a CJK quote “中文“.
|
|||||||
|
|
||||||
::: warning 注意该网站在国外无法访问,故以下演示无效 :::
|
::: warning 注意该网站在国外无法访问,故以下演示无效 :::
|
||||||
|
|
||||||
|
IVS 麻󠄁羽󠄀‼️
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -116,6 +124,8 @@ This ia an english paragraph with a CJK quote “中文“.
|
|||||||
该网站在国外无法访问,故以下演示无效
|
该网站在国外无法访问,故以下演示无效
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
IVS 麻󠄁羽󠄀‼️
|
||||||
|
|
||||||
=====================================output=====================================
|
=====================================output=====================================
|
||||||
這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落
|
這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落
|
||||||
|
|
||||||
@@ -133,6 +143,8 @@ This ia an english paragraph with a CJK quote “中文“.
|
|||||||
该网站在国外无法访问,故以下演示无效
|
该网站在国外无法访问,故以下演示无效
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
IVS 麻󠄁羽󠄀‼️
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -13,3 +13,5 @@ This ia an english paragraph with a CJK quote “中文“.
|
|||||||
::: warning 注意
|
::: warning 注意
|
||||||
该网站在国外无法访问,故以下演示无效
|
该网站在国外无法访问,故以下演示无效
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
IVS 麻󠄁羽󠄀‼️
|
||||||
Reference in new issue
Block a user