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.
@@ -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 [Standard Variation Selector that can follow CJK](https://github.com/tats-u/markdown-cjk-friendly/blob/main/specification.md#svs-that-can-follow-cjk).
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 Standard Variation Selector that can follow CJK
38
+ * @returns `true` if the code point represents an Non-emoji General-use Variation Selector
39
39
  */
40
- declare function isSvsFollowingCjk(category: Category): boolean;
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, isSpaceOrPunctuation, isSvsFollowingCjk, isUnicodeWhitespace };
49
+ export { isCjk, isIvs, isNonCjkPunctuation, isNonEmojiGeneralUseVS, isSpaceOrPunctuation, isUnicodeWhitespace };
@@ -11,7 +11,7 @@ var constantsEx;
11
11
  constantsEx2.cjkPunctuation = 4098;
12
12
  constantsEx2.ivs = 8192;
13
13
  constantsEx2.cjkOrIvs = 12288;
14
- constantsEx2.svsFollowingCjk = 16384;
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 isSvsFollowingCjk(category) {
32
- return category === constantsEx.svsFollowingCjk;
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 Standard Variation Sequence that can follow an ideographic character.
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 const svsFollowingCjk: (code: Code) => boolean;
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, svsFollowingCjk, unicodePunctuation, unicodeWhitespace };
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
- var svsFollowingCjk = regexCheck(/[\uFE00-\uFE02\uFE0E]/u);
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
- svsFollowingCjk,
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 svsFollowingCjk: 16384;
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.svsFollowingCjk | 0;
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
- var svsFollowingCjk = regexCheck(/[\uFE00-\uFE02\uFE0E]/u);
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.svsFollowingCjk = 16384;
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 (svsFollowingCjk(code)) {
72
- return constantsEx.svsFollowingCjk;
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, isSpaceOrPunctuation, isSvsFollowingCjk, isUnicodeWhitespace } from './categoryUtil.js';
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
- var svsFollowingCjk = regexCheck(/[\uFE00-\uFE02\uFE0E]/u);
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.svsFollowingCjk = 16384;
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 (svsFollowingCjk(code)) {
75
- return constantsEx.svsFollowingCjk;
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 isSvsFollowingCjk(category) {
105
- return category === constantsEx.svsFollowingCjk;
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micromark-extension-cjk-friendly-util",
3
- "version": "1.1.0",
3
+ "version": "2.0.0-rc.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {