micromark-extension-cjk-friendly-util 1.1.0 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/categoryUtil.d.ts +4 -4
- package/dist/categoryUtil.js +4 -4
- package/dist/characterWithNonBmp.d.ts +3 -5
- package/dist/characterWithNonBmp.js +4 -2
- package/dist/classifyCharacter.d.ts +2 -2
- package/dist/classifyCharacter.js +6 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -7
- package/package.json +1 -1
package/dist/categoryUtil.d.ts
CHANGED
|
@@ -32,12 +32,12 @@ declare function isCjk(category: Category): boolean;
|
|
|
32
32
|
*/
|
|
33
33
|
declare function isIvs(category: Category): boolean;
|
|
34
34
|
/**
|
|
35
|
-
* `true` if the code point represents a [
|
|
35
|
+
* `true` if the code point represents a [Non-emoji General-use Variation Selector](https://github.com/tats-u/markdown-cjk-friendly/blob/main/specification.md#non-emoji-general-use-variation-selector).
|
|
36
36
|
*
|
|
37
37
|
* @param category the return value of `classifyCharacter`.
|
|
38
|
-
* @returns `true` if the code point represents an
|
|
38
|
+
* @returns `true` if the code point represents an Non-emoji General-use Variation Selector
|
|
39
39
|
*/
|
|
40
|
-
declare function
|
|
40
|
+
declare function isNonEmojiGeneralUseVS(category: Category): boolean;
|
|
41
41
|
/**
|
|
42
42
|
* `true` if the code point represents an [Unicode whitespace character](https://spec.commonmark.org/0.31.2/#unicode-whitespace-character) or an [Unicode punctuation character](https://spec.commonmark.org/0.31.2/#unicode-punctuation-character).
|
|
43
43
|
*
|
|
@@ -46,4 +46,4 @@ declare function isSvsFollowingCjk(category: Category): boolean;
|
|
|
46
46
|
*/
|
|
47
47
|
declare function isSpaceOrPunctuation(category: Category): boolean;
|
|
48
48
|
|
|
49
|
-
export { isCjk, isIvs, isNonCjkPunctuation,
|
|
49
|
+
export { isCjk, isIvs, isNonCjkPunctuation, isNonEmojiGeneralUseVS, isSpaceOrPunctuation, isUnicodeWhitespace };
|
package/dist/categoryUtil.js
CHANGED
|
@@ -11,7 +11,7 @@ var constantsEx;
|
|
|
11
11
|
constantsEx2.cjkPunctuation = 4098;
|
|
12
12
|
constantsEx2.ivs = 8192;
|
|
13
13
|
constantsEx2.cjkOrIvs = 12288;
|
|
14
|
-
constantsEx2.
|
|
14
|
+
constantsEx2.nonEmojiGeneralUseVS = 16384;
|
|
15
15
|
constantsEx2.variationSelector = 28672;
|
|
16
16
|
})(constantsEx || (constantsEx = {}));
|
|
17
17
|
|
|
@@ -28,8 +28,8 @@ function isCjk(category) {
|
|
|
28
28
|
function isIvs(category) {
|
|
29
29
|
return category === constantsEx.ivs;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return category === constantsEx.
|
|
31
|
+
function isNonEmojiGeneralUseVS(category) {
|
|
32
|
+
return category === constantsEx.nonEmojiGeneralUseVS;
|
|
33
33
|
}
|
|
34
34
|
function isSpaceOrPunctuation(category) {
|
|
35
35
|
return Boolean(category & constantsEx.spaceOrPunctuation);
|
|
@@ -38,7 +38,7 @@ export {
|
|
|
38
38
|
isCjk,
|
|
39
39
|
isIvs,
|
|
40
40
|
isNonCjkPunctuation,
|
|
41
|
+
isNonEmojiGeneralUseVS,
|
|
41
42
|
isSpaceOrPunctuation,
|
|
42
|
-
isSvsFollowingCjk,
|
|
43
43
|
isUnicodeWhitespace
|
|
44
44
|
};
|
|
@@ -8,11 +8,9 @@ import { Code } from 'micromark-util-types';
|
|
|
8
8
|
*/
|
|
9
9
|
declare function cjkOrIvs(uc: Code): boolean | null;
|
|
10
10
|
/**
|
|
11
|
-
* Check whether the character code represents
|
|
12
|
-
*
|
|
13
|
-
* U+FE0E is used for some CJK symbols (e.g. U+3299) that can also be
|
|
11
|
+
* Check whether the character code represents Non-emoji General-use Variation Selector (U+FE00-U+FE0E).
|
|
14
12
|
*/
|
|
15
|
-
declare
|
|
13
|
+
declare function nonEmojiGeneralUseVS(code: Code): boolean;
|
|
16
14
|
/**
|
|
17
15
|
* Check whether the character code represents Unicode punctuation.
|
|
18
16
|
*
|
|
@@ -55,4 +53,4 @@ declare const unicodePunctuation: (code: Code) => boolean;
|
|
|
55
53
|
*/
|
|
56
54
|
declare const unicodeWhitespace: (code: Code) => boolean;
|
|
57
55
|
|
|
58
|
-
export { cjkOrIvs,
|
|
56
|
+
export { cjkOrIvs, nonEmojiGeneralUseVS, unicodePunctuation, unicodeWhitespace };
|
|
@@ -37,7 +37,9 @@ function cjkOrIvs(uc) {
|
|
|
37
37
|
return /^\p{sc=Hangul}/u.test(String.fromCodePoint(uc));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
function nonEmojiGeneralUseVS(code) {
|
|
41
|
+
return code !== null && code >= 65024 && code <= 65038;
|
|
42
|
+
}
|
|
41
43
|
var unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
|
|
42
44
|
var unicodeWhitespace = regexCheck(/\s/);
|
|
43
45
|
function regexCheck(regex) {
|
|
@@ -48,7 +50,7 @@ function regexCheck(regex) {
|
|
|
48
50
|
}
|
|
49
51
|
export {
|
|
50
52
|
cjkOrIvs,
|
|
51
|
-
|
|
53
|
+
nonEmojiGeneralUseVS,
|
|
52
54
|
unicodePunctuation,
|
|
53
55
|
unicodeWhitespace
|
|
54
56
|
};
|
|
@@ -7,7 +7,7 @@ declare namespace constantsEx {
|
|
|
7
7
|
const cjkPunctuation: 4098;
|
|
8
8
|
const ivs: 8192;
|
|
9
9
|
const cjkOrIvs: 12288;
|
|
10
|
-
const
|
|
10
|
+
const nonEmojiGeneralUseVS: 16384;
|
|
11
11
|
const variationSelector: 28672;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -24,6 +24,6 @@ declare namespace constantsEx {
|
|
|
24
24
|
* @returns
|
|
25
25
|
* Group.
|
|
26
26
|
*/
|
|
27
|
-
declare function classifyCharacter(code: Code): typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | typeof constantsEx.cjk | typeof constantsEx.cjkPunctuation | typeof constantsEx.ivs | typeof constantsEx.
|
|
27
|
+
declare function classifyCharacter(code: Code): typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | typeof constantsEx.cjk | typeof constantsEx.cjkPunctuation | typeof constantsEx.ivs | typeof constantsEx.nonEmojiGeneralUseVS | 0;
|
|
28
28
|
|
|
29
29
|
export { classifyCharacter, constantsEx };
|
|
@@ -41,7 +41,9 @@ function cjkOrIvs(uc) {
|
|
|
41
41
|
return /^\p{sc=Hangul}/u.test(String.fromCodePoint(uc));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
function nonEmojiGeneralUseVS(code) {
|
|
45
|
+
return code !== null && code >= 65024 && code <= 65038;
|
|
46
|
+
}
|
|
45
47
|
var unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
|
|
46
48
|
var unicodeWhitespace = regexCheck(/\s/);
|
|
47
49
|
function regexCheck(regex) {
|
|
@@ -59,7 +61,7 @@ var constantsEx;
|
|
|
59
61
|
constantsEx2.cjkPunctuation = 4098;
|
|
60
62
|
constantsEx2.ivs = 8192;
|
|
61
63
|
constantsEx2.cjkOrIvs = 12288;
|
|
62
|
-
constantsEx2.
|
|
64
|
+
constantsEx2.nonEmojiGeneralUseVS = 16384;
|
|
63
65
|
constantsEx2.variationSelector = 28672;
|
|
64
66
|
})(constantsEx || (constantsEx = {}));
|
|
65
67
|
function classifyCharacter(code) {
|
|
@@ -68,8 +70,8 @@ function classifyCharacter(code) {
|
|
|
68
70
|
}
|
|
69
71
|
let value = 0;
|
|
70
72
|
if (code >= 4352) {
|
|
71
|
-
if (
|
|
72
|
-
return constantsEx.
|
|
73
|
+
if (nonEmojiGeneralUseVS(code)) {
|
|
74
|
+
return constantsEx.nonEmojiGeneralUseVS;
|
|
73
75
|
}
|
|
74
76
|
switch (cjkOrIvs(code)) {
|
|
75
77
|
case null:
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { isCjk, isIvs, isNonCjkPunctuation,
|
|
1
|
+
export { isCjk, isIvs, isNonCjkPunctuation, isNonEmojiGeneralUseVS, isSpaceOrPunctuation, isUnicodeWhitespace } from './categoryUtil.js';
|
|
2
2
|
export { classifyCharacter, constantsEx } from './classifyCharacter.js';
|
|
3
3
|
export { isCodeHighSurrogate, isCodeLowSurrogate, tryGetCodeTwoBefore, tryGetGenuineNextCode, tryGetGenuinePreviousCode } from './codeUtil.js';
|
|
4
4
|
import 'micromark-util-symbol';
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,9 @@ function cjkOrIvs(uc) {
|
|
|
44
44
|
return /^\p{sc=Hangul}/u.test(String.fromCodePoint(uc));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
function nonEmojiGeneralUseVS(code) {
|
|
48
|
+
return code !== null && code >= 65024 && code <= 65038;
|
|
49
|
+
}
|
|
48
50
|
var unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
|
|
49
51
|
var unicodeWhitespace = regexCheck(/\s/);
|
|
50
52
|
function regexCheck(regex) {
|
|
@@ -62,7 +64,7 @@ var constantsEx;
|
|
|
62
64
|
constantsEx2.cjkPunctuation = 4098;
|
|
63
65
|
constantsEx2.ivs = 8192;
|
|
64
66
|
constantsEx2.cjkOrIvs = 12288;
|
|
65
|
-
constantsEx2.
|
|
67
|
+
constantsEx2.nonEmojiGeneralUseVS = 16384;
|
|
66
68
|
constantsEx2.variationSelector = 28672;
|
|
67
69
|
})(constantsEx || (constantsEx = {}));
|
|
68
70
|
function classifyCharacter(code) {
|
|
@@ -71,8 +73,8 @@ function classifyCharacter(code) {
|
|
|
71
73
|
}
|
|
72
74
|
let value = 0;
|
|
73
75
|
if (code >= 4352) {
|
|
74
|
-
if (
|
|
75
|
-
return constantsEx.
|
|
76
|
+
if (nonEmojiGeneralUseVS(code)) {
|
|
77
|
+
return constantsEx.nonEmojiGeneralUseVS;
|
|
76
78
|
}
|
|
77
79
|
switch (cjkOrIvs(code)) {
|
|
78
80
|
case null:
|
|
@@ -101,8 +103,8 @@ function isCjk(category) {
|
|
|
101
103
|
function isIvs(category) {
|
|
102
104
|
return category === constantsEx.ivs;
|
|
103
105
|
}
|
|
104
|
-
function
|
|
105
|
-
return category === constantsEx.
|
|
106
|
+
function isNonEmojiGeneralUseVS(category) {
|
|
107
|
+
return category === constantsEx.nonEmojiGeneralUseVS;
|
|
106
108
|
}
|
|
107
109
|
function isSpaceOrPunctuation(category) {
|
|
108
110
|
return Boolean(category & constantsEx.spaceOrPunctuation);
|
|
@@ -174,8 +176,8 @@ export {
|
|
|
174
176
|
isCodeLowSurrogate,
|
|
175
177
|
isIvs,
|
|
176
178
|
isNonCjkPunctuation,
|
|
179
|
+
isNonEmojiGeneralUseVS,
|
|
177
180
|
isSpaceOrPunctuation,
|
|
178
|
-
isSvsFollowingCjk,
|
|
179
181
|
isUnicodeWhitespace,
|
|
180
182
|
tryGetCodeTwoBefore,
|
|
181
183
|
tryGetGenuineNextCode,
|