markdown-it-cjk-friendly 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # markdown-it-cjk-friendly
2
2
 
3
- [![Version](https://img.shields.io/npm/v/markdown-it-cjk-friendly)](https://npmjs.com/package/markdown-it-cjk-friendly)
3
+ [![Version](https://img.shields.io/npm/v/markdown-it-cjk-friendly)](https://npmjs.com/package/markdown-it-cjk-friendly) [![NPM Downloads](https://img.shields.io/npm/dw/markdown-it-cjk-friendly)](https://npmjs.com/package/markdown-it-cjk-friendly) [![NPM Last Update](https://img.shields.io/npm/last-update/markdown-it-cjk-friendly)](https://npmjs.com/package/markdown-it-cjk-friendly)
4
4
 
5
5
  A [markdown-it](https://github.com/markdown-it/markdown-it) plugin to make Markdown emphasis (`**`) in CommonMark compatible with Chinese, Japanese, and Korean (CJK).
6
6
 
@@ -109,6 +109,10 @@ const md = MarkdownIt();
109
109
  md.use(markdownItCjkFriendly);
110
110
  ```
111
111
 
112
+ ## Specification / <span lang="ja">規格書</span> / <span lang="zh-Hans-CN">规范</span> / <span lang="ko">규정서</span>
113
+
114
+ https://github.com/tats-u/markdown-cjk-friendly/blob/main/specification.md (English)
115
+
112
116
  ## Contributing / <span lang="ja">貢献</span> / <span lang="zh-Hans-CN">贡献</span> / <span lang="ko">기여</span>
113
117
 
114
118
  ### Setup
package/dist/index.cjs CHANGED
@@ -74,14 +74,16 @@ function markdownItCjFriendlyPlugin(md) {
74
74
  const nextChar = pos < max ? this.src.codePointAt(pos) : 0x20;
75
75
  const isLastCJKChar = (isLastActuallyTwoPrev ? isCjk : isCjkOrIvs)(lastChar);
76
76
  const isNextCJKChar = isCjk(nextChar);
77
- const isLastNonCjkPunctChar = (0, utils_mjs_namespaceObject.isMdAsciiPunct)(lastChar) || (0, utils_mjs_namespaceObject.isPunctChar)(String.fromCodePoint(lastChar)) && !isLastCJKChar;
78
- const isNextNonCjkPunctChar = (0, utils_mjs_namespaceObject.isMdAsciiPunct)(nextChar) || (0, utils_mjs_namespaceObject.isPunctChar)(String.fromCodePoint(nextChar)) && !isNextCJKChar;
77
+ const isLastPunctChar = (0, utils_mjs_namespaceObject.isMdAsciiPunct)(lastChar) || (0, utils_mjs_namespaceObject.isPunctChar)(String.fromCodePoint(lastChar));
78
+ const isNextPunctChar = (0, utils_mjs_namespaceObject.isMdAsciiPunct)(nextChar) || (0, utils_mjs_namespaceObject.isPunctChar)(String.fromCodePoint(nextChar));
79
+ const isLastNonCjkPunctChar = isLastPunctChar && !isLastCJKChar;
80
+ const isNextNonCjkPunctChar = isNextPunctChar && !isNextCJKChar;
79
81
  const isLastWhiteSpace = (0, utils_mjs_namespaceObject.isWhiteSpace)(lastChar);
80
82
  const isNextWhiteSpace = (0, utils_mjs_namespaceObject.isWhiteSpace)(nextChar);
81
83
  const left_flanking = !isNextWhiteSpace && (!isNextNonCjkPunctChar || isLastNonCjkPunctChar || isLastWhiteSpace || isLastCJKChar);
82
84
  const right_flanking = !isLastWhiteSpace && (!isLastNonCjkPunctChar || isNextWhiteSpace || isNextNonCjkPunctChar || isNextCJKChar);
83
- const can_open = left_flanking && (canSplitWord || !right_flanking || isLastNonCjkPunctChar);
84
- const can_close = right_flanking && (canSplitWord || !left_flanking || isNextNonCjkPunctChar);
85
+ const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
86
+ const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
85
87
  return {
86
88
  can_open,
87
89
  can_close,
package/dist/index.js CHANGED
@@ -44,14 +44,16 @@ function markdownItCjFriendlyPlugin(md) {
44
44
  const nextChar = pos < max ? this.src.codePointAt(pos) : 0x20;
45
45
  const isLastCJKChar = (isLastActuallyTwoPrev ? isCjk : isCjkOrIvs)(lastChar);
46
46
  const isNextCJKChar = isCjk(nextChar);
47
- const isLastNonCjkPunctChar = (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isMdAsciiPunct)(lastChar) || (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isPunctChar)(String.fromCodePoint(lastChar)) && !isLastCJKChar;
48
- const isNextNonCjkPunctChar = (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isMdAsciiPunct)(nextChar) || (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isPunctChar)(String.fromCodePoint(nextChar)) && !isNextCJKChar;
47
+ const isLastPunctChar = (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isMdAsciiPunct)(lastChar) || (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isPunctChar)(String.fromCodePoint(lastChar));
48
+ const isNextPunctChar = (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isMdAsciiPunct)(nextChar) || (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isPunctChar)(String.fromCodePoint(nextChar));
49
+ const isLastNonCjkPunctChar = isLastPunctChar && !isLastCJKChar;
50
+ const isNextNonCjkPunctChar = isNextPunctChar && !isNextCJKChar;
49
51
  const isLastWhiteSpace = (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isWhiteSpace)(lastChar);
50
52
  const isNextWhiteSpace = (0, __WEBPACK_EXTERNAL_MODULE_markdown_it_lib_common_utils_mjs_c48a6852__.isWhiteSpace)(nextChar);
51
53
  const left_flanking = !isNextWhiteSpace && (!isNextNonCjkPunctChar || isLastNonCjkPunctChar || isLastWhiteSpace || isLastCJKChar);
52
54
  const right_flanking = !isLastWhiteSpace && (!isLastNonCjkPunctChar || isNextWhiteSpace || isNextNonCjkPunctChar || isNextCJKChar);
53
- const can_open = left_flanking && (canSplitWord || !right_flanking || isLastNonCjkPunctChar);
54
- const can_close = right_flanking && (canSplitWord || !left_flanking || isNextNonCjkPunctChar);
55
+ const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
56
+ const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
55
57
  return {
56
58
  can_open,
57
59
  can_close,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-it-cjk-friendly",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -30,6 +30,7 @@
30
30
  "cjk"
31
31
  ],
32
32
  "description": "markdown-it plugin to make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK)",
33
+ "sideEffects": false,
33
34
  "scripts": {
34
35
  "build": "rslib build",
35
36
  "dev": "rslib build --watch",