micromark-extension-cjk-friendly 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2024 Tatsunori Uchino, and authors and contributors of original packages
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # micromark-extension-cjk-friendly
2
+
3
+ [![Version](https://img.shields.io/npm/v/micromark-extension-cjk-friendly)](https://npmjs.com/package/micromark-extension-cjk-friendly) [![NPM Downloads](https://img.shields.io/npm/dw/micromark-extension-cjk-friendly)](https://npmjs.com/package/micromark-extension-cjk-friendly) [![NPM Last Update](https://img.shields.io/npm/last-update/micromark-extension-cjk-friendly)](https://npmjs.com/package/micromark-extension-cjk-friendly)
4
+
5
+ A [micromark](https://github.com/micromark/micromark) extension to make Markdown emphasis (`**`) in CommonMark compatible with Chinese, Japanese, and Korean (CJK).
6
+
7
+ <span lang="ja">CommonMarkの強調記号(`**`)を日本語・中国語・韓国語にきちんと対応させるための[micromark](https://github.com/micromark/micromark)拡張</span>
8
+
9
+ <span lang="zh-Hans-CN">一个 [micromark](https://github.com/micromark/micromark) 扩展,用于使 CommonMark 的强调标记(`**`)能够正确支持中文、日语和韩语文本。</span>
10
+
11
+ <span lang="ko">CommonMark의 강조 표시(`**`) 를 한국어, 중국어, 일본어와 호환되도록 만드는 [micromark](https://github.com/micromark/micromark) 확장</span>
12
+
13
+ ## Problem / <span lang="ja">問題</span> / <span lang="zh-Hans-CN">问题</span> / <span lang="ko">문제점</span>
14
+
15
+ CommonMark has a problem that the following emphasis marks `**` are not recognized as emphasis marks in Japanese, Chinese, and Korean.
16
+
17
+ <span lang="ja">CommonMarkには、日本語・中国語・韓国語内の次のような強調記号(`**`)が強調記号として認識されない問題があります。</span>
18
+
19
+ <span lang="zh-Hans-CN">CommonMark存在以下问题:在中文、日语和韩语文本中,强调标记`**`不会被识别为强调标记。</span>
20
+
21
+ <span lang="ko">CommonMark는 일본어와 중국어에서 다음과 같은 강조 표시 `**`가 강조 표시로 인식되지 않는 문제가 있습니다.</span>
22
+
23
+ ```md
24
+ **このアスタリスクは強調記号として認識されず、そのまま表示されます。**この文のせいで。
25
+
26
+ **该星号不会被识别,而是直接显示。**这是因为它没有被识别为强调符号。
27
+
28
+ **이 별표는 강조 표시로 인식되지 않고 그대로 표시됩니다(이 괄호 때문에)**이 문장 때문에.
29
+ ```
30
+
31
+ This problem occurs because the character just inside the `**` is a (Japanese or Chinese) punctuation mark (。) or parenthesis and the character just outside is not a space or punctuation mark.
32
+
33
+ <span lang="ja">これが起こった原因は、終了側の`**`のすぐ内側が約物(。やカッコ)、かつ外側が約物や空白以外の文字であるためです。</span>
34
+
35
+ <span lang="zh-Hans-CN">这个问题是因为在`**`的结束部分,内侧字符是标点符号(。)或括号,而外侧字符不是空格或标点符号。</span>
36
+
37
+ <span lang="ko">이 문제는 `**` 바로 안쪽의 문자가 (일본어나 중국어) 문장 부호(。) 또는 괄호이고 바깥쪽 문자가 공백이나 문장 부호가 아니기 때문에 발생합니다.</span>
38
+
39
+ Of course, not only the end side but also the start side has the same issue.
40
+
41
+ <span lang="ja">もちろん終了側だけでなく、開始側も同様の問題が存在します。</span>
42
+
43
+ <span lang="zh-Hans-CN">当然,不仅是结束侧,开始侧也存在同样的问题。</span>
44
+
45
+ <span lang="ko">물론 끝나는 부분뿐만 아니라 시작하는 부분에서도 동일한 문제가 있습니다.</span>
46
+
47
+ CommonMark issue: https://github.com/commonmark/commonmark-spec/issues/650
48
+
49
+ ## Runtime Requirements / <span lang="ja">実行環境の要件</span> / <span lang="zh-Hans-CN">运行环境要求</span> / <span lang="ko">업데이트 전략</span>
50
+
51
+ This package uses the [`v` flag of the regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets) introduced in ES2024 to determine whether the character is an emoji or not.
52
+
53
+ <span lang="ja">本パッケージは文字が絵文字かどうかを判定するために、ES2024で導入された[正規表現の`v`フラグ](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets)を使用しています。</span>
54
+
55
+ <span lang="zh-CN">本包使用 ES2024 引入的[`v` 标志](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets) 来判断字符是否为 emoji。</span>
56
+
57
+ <span lang="ko">이 패키지는 ES2024에서 도입된 [`v` 플래그](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets)를 사용하여 문자가 이모지인지 여부를 판단합니다.</span>
58
+
59
+ It makes this package compatible only with relatively recent browsers and Node.js:
60
+
61
+ <span lang="ja">このため、本パッケージは、次のような比較的新しいブラウザやNode.jsでしか動作しません。</span>
62
+
63
+ <span lang="zh-CN">因此,本包只兼容比较新的浏览器和 Node.js:</span>
64
+
65
+ <span lang="ko">따라서, 이 패키지는 비교적 최신 브라우저와 Node.js에서만 작동합니다.</span>
66
+
67
+ - Chrome / Edge 112 or later
68
+ - Firefox 116 or later
69
+ - Safari 17 or later
70
+ - Node.js 20 or later
71
+
72
+ ## Installation / <span lang="ja">インストール</span> / <span lang="zh-Hans-CN">安装</span> / <span lang="ko">설치</span>
73
+
74
+ Install `micromark-extension-cjk-friendly` via [npm](https://www.npmjs.com/):
75
+
76
+ <span lang="ja">`micromark-extension-cjk-friendly`を[npm](https://www.npmjs.com/)でインストールしてください。</span>
77
+
78
+ <span lang="zh-Hans-CN">通过 [npm](https://www.npmjs.com/) 安装 `micromark-extension-cjk-friendly`。</span>
79
+
80
+ <span lang="ko">`micromark-extension-cjk-friendly`를 [npm](https://www.npmjs.com/)으로 설치하세요.</span>
81
+
82
+ ```bash
83
+ npm install micromark-extension-cjk-friendly
84
+ ```
85
+
86
+ If you use another package manager, please replace `npm install` with the command of the package manager you use (e.g. `pnpm add` or `yarn add`).
87
+
88
+ <span lang="ja">npm以外のパッケージマネージャを使う場合は、`npm install`を当該パッケージマネージャのコマンド(例:`pnpm add`・`yarn add`)に置き換えてください。</span>
89
+
90
+ <span lang="zh-Hans-CN">如果使用其他包管理器,请将 `npm install` 替换为当时包管理器的命令(例如:`pnpm add`、`yarn add`)。</span>
91
+
92
+ <span lang="ko">다른 패키지 매니저를 사용하는 경우 `npm install`을 해당 패키지 매니저의 명령어(예: `pnpm add`, `yarn add`)로 바꾸어 주세요.</span>
93
+
94
+ ## Usage / <span lang="ja">使い方</span> / <span lang="zh-Hans-CN">用法</span> / <span lang="ko">사용법</span>
95
+
96
+ Import `micromark` and `micromark-extension-cjk-friendly`, and use the extension as follows:
97
+
98
+ <span lang="ja">`micromark`と`micromark-extension-cjk-friendly`をインポートし、次のように拡張を使用してください。</span>
99
+
100
+ <span lang="zh-Hans-CN">通过 `micromark` 和 `micromark-extension-cjk-friendly` 导入,然后使用扩展如下:</span>
101
+
102
+ <span lang="ko">`micromark`와 `micromark-extension-cjk-friendly`를 임포트하고 다음과 같이 확장을 사용하세요.</span>
103
+
104
+ ```js
105
+ import { micromark } from "micromark";
106
+ import { gfm, gfmHtml } from "micromark-extension-gfm";
107
+ import { cjkFriendlyExtension } from "micromark-extension-cjk-friendly";
108
+
109
+ // e.g. combine with GFM extension
110
+ const htmlString = micromark(
111
+ markdownString,
112
+ {
113
+ extensions: [gfm(), cjkFriendlyExtension()], // in no particular order
114
+ htmlExtensions: [gfmHtml()],
115
+ }
116
+ )
117
+ ```
118
+
119
+ ## Specification / <span lang="ja">規格書</span> / <span lang="zh-Hans-CN">规范</span> / <span lang="ko">규정서</span>
120
+
121
+ https://github.com/tats-u/markdown-cjk-friendly/blob/main/specification.md (English)
122
+
123
+ ## Contributing / <span lang="ja">貢献</span> / <span lang="zh-Hans-CN">贡献</span> / <span lang="ko">기여</span>
124
+
125
+ ### Setup
126
+
127
+ Install the dependencies:
128
+
129
+ ```bash
130
+ pnpm install
131
+ ```
132
+
133
+ ### Get Started
134
+
135
+ Build the library:
136
+
137
+ ```bash
138
+ pnpm build
139
+ ```
140
+
141
+ Build the library in watch mode:
142
+
143
+ ```bash
144
+ pnpm dev
145
+ ```
@@ -0,0 +1,15 @@
1
+ import type { Effects, Resolver, State, TokenizeContext } from "micromark-util-types";
2
+ /** @type {Construct} */
3
+ export declare const attention: {
4
+ name: string;
5
+ resolveAll: typeof resolveAllAttention;
6
+ tokenize: typeof tokenizeAttention;
7
+ };
8
+ declare function resolveAllAttention(events: Parameters<Resolver>[0], context: Parameters<Resolver>[1]): ReturnType<Resolver>;
9
+ /**
10
+ * @this {TokenizeContext}
11
+ * Context.
12
+ * @type {Tokenizer}
13
+ */
14
+ declare function tokenizeAttention(this: TokenizeContext, effects: Effects, ok: State): State;
15
+ export {};
@@ -0,0 +1,55 @@
1
+ import type { Code } from "micromark-util-types";
2
+ /**
3
+ * Check if `uc` is CJK or IVS
4
+ *
5
+ * @param uc code point
6
+ * @returns `true` if `uc` is CJK, `null` if IVS, or `false` if neither
7
+ */
8
+ export declare function cjkOrIvs(uc: Code): boolean | null;
9
+ /**
10
+ * Check whether the character code represents Standard Variation Sequence that can follow an ideographic character.
11
+ *
12
+ * U+FE0E is used for some CJK symbols (e.g. U+3299) that can also be
13
+ */
14
+ export declare const svsFollowingCjk: (code: Code) => boolean;
15
+ /**
16
+ * Check whether the character code represents Unicode punctuation.
17
+ *
18
+ * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,
19
+ * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`
20
+ * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`
21
+ * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII
22
+ * punctuation (see `asciiPunctuation`).
23
+ *
24
+ * See:
25
+ * **\[UNICODE]**:
26
+ * [The Unicode Standard](https://www.unicode.org/versions/).
27
+ * Unicode Consortium.
28
+ *
29
+ * @param code
30
+ * Code.
31
+ * @returns
32
+ * Whether it matches.
33
+ */
34
+ export declare const unicodePunctuation: (code: Code) => boolean;
35
+ /**
36
+ * Check whether the character code represents Unicode whitespace.
37
+ *
38
+ * Note that this does handle micromark specific markdown whitespace characters.
39
+ * See `markdownLineEndingOrSpace` to check that.
40
+ *
41
+ * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,
42
+ * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),
43
+ * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**).
44
+ *
45
+ * See:
46
+ * **\[UNICODE]**:
47
+ * [The Unicode Standard](https://www.unicode.org/versions/).
48
+ * Unicode Consortium.
49
+ *
50
+ * @param code
51
+ * Code.
52
+ * @returns
53
+ * Whether it matches.
54
+ */
55
+ export declare const unicodeWhitespace: (code: Code) => boolean;
@@ -0,0 +1,26 @@
1
+ import { constants } from "micromark-util-symbol";
2
+ import type { Code } from "micromark-util-types";
3
+ export declare namespace constantsEx {
4
+ const spaceOrPunctuation: 3;
5
+ const cjk: 4096;
6
+ const cjkPunctuation: 4098;
7
+ const ivs: 8192;
8
+ const cjkOrIvs: 12288;
9
+ const svsFollowingCjk: 16384;
10
+ const variationSelector: 28672;
11
+ }
12
+ /**
13
+ * Classify whether a code represents whitespace, punctuation, or something
14
+ * else.
15
+ *
16
+ * Used for attention (emphasis, strong), whose sequences can open or close
17
+ * based on the class of surrounding characters.
18
+ *
19
+ * > 👉 **Note**: eof (`null`) is seen as whitespace.
20
+ *
21
+ * @param code
22
+ * Code.
23
+ * @returns
24
+ * Group.
25
+ */
26
+ export declare function classifyCharacter(code: Code): typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | typeof constantsEx.cjk | typeof constantsEx.cjkPunctuation | typeof constantsEx.ivs | typeof constantsEx.svsFollowingCjk | 0;
package/dist/index.cjs ADDED
@@ -0,0 +1,346 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = function(exports1, definition) {
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = function(obj, prop) {
13
+ return Object.prototype.hasOwnProperty.call(obj, prop);
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.r = function(exports1) {
18
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
19
+ value: 'Module'
20
+ });
21
+ Object.defineProperty(exports1, '__esModule', {
22
+ value: true
23
+ });
24
+ };
25
+ })();
26
+ var __webpack_exports__ = {};
27
+ __webpack_require__.r(__webpack_exports__);
28
+ __webpack_require__.d(__webpack_exports__, {
29
+ cjkFriendlyExtension: ()=>cjkFriendlyExtension
30
+ });
31
+ const external_micromark_util_symbol_namespaceObject = require("micromark-util-symbol");
32
+ const external_devlop_namespaceObject = require("devlop");
33
+ const external_micromark_util_chunked_namespaceObject = require("micromark-util-chunked");
34
+ const external_micromark_util_resolve_all_namespaceObject = require("micromark-util-resolve-all");
35
+ const external_micromark_util_character_namespaceObject = require("micromark-util-character");
36
+ const external_get_east_asian_width_namespaceObject = require("get-east-asian-width");
37
+ function cjkOrIvs(uc) {
38
+ if (!uc || uc < 0) return false;
39
+ const eaw = (0, external_get_east_asian_width_namespaceObject.eastAsianWidthType)(uc);
40
+ switch(eaw){
41
+ case "fullwidth":
42
+ case "halfwidth":
43
+ return true;
44
+ case "wide":
45
+ return !/^\p{RGI_Emoji}/v.test(String.fromCodePoint(uc));
46
+ case "narrow":
47
+ return false;
48
+ case "ambiguous":
49
+ return 0xe0100 <= uc && uc <= 0xe01ef && null;
50
+ case "neutral":
51
+ return /^\p{sc=Hangul}/u.test(String.fromCodePoint(uc));
52
+ }
53
+ }
54
+ const svsFollowingCjk = regexCheck(/[\uFE00-\uFE02\uFE0E]/u);
55
+ const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
56
+ const unicodeWhitespace = regexCheck(/\s/);
57
+ function regexCheck(regex) {
58
+ return check;
59
+ function check(code) {
60
+ return null !== code && code > -1 && regex.test(String.fromCodePoint(code));
61
+ }
62
+ }
63
+ (function(constantsEx) {
64
+ constantsEx.spaceOrPunctuation = 3;
65
+ constantsEx.cjk = 0x1000;
66
+ constantsEx.cjkPunctuation = 0x1002;
67
+ constantsEx.ivs = 0x2000;
68
+ constantsEx.cjkOrIvs = 0x3000;
69
+ constantsEx.svsFollowingCjk = 0x4000;
70
+ constantsEx.variationSelector = 0x7000;
71
+ })(classifyCharacter_constantsEx || (classifyCharacter_constantsEx = {}));
72
+ function classifyCharacter(code) {
73
+ if (code === external_micromark_util_symbol_namespaceObject.codes.eof || (0, external_micromark_util_character_namespaceObject.markdownLineEndingOrSpace)(code) || unicodeWhitespace(code)) return external_micromark_util_symbol_namespaceObject.constants.characterGroupWhitespace;
74
+ let value = 0;
75
+ if (code >= 0x1100) {
76
+ if (svsFollowingCjk(code)) return classifyCharacter_constantsEx.svsFollowingCjk;
77
+ switch(cjkOrIvs(code)){
78
+ case null:
79
+ return classifyCharacter_constantsEx.ivs;
80
+ case true:
81
+ value |= classifyCharacter_constantsEx.cjk;
82
+ break;
83
+ }
84
+ }
85
+ if (unicodePunctuation(code)) value |= external_micromark_util_symbol_namespaceObject.constants.characterGroupPunctuation;
86
+ return value;
87
+ }
88
+ var classifyCharacter_constantsEx;
89
+ const attention = {
90
+ name: "attention",
91
+ resolveAll: resolveAllAttention,
92
+ tokenize: tokenizeAttention
93
+ };
94
+ function resolveAllAttention(events, context) {
95
+ let index = -1;
96
+ let open;
97
+ let group;
98
+ let text;
99
+ let openingSequence;
100
+ let closingSequence;
101
+ let use;
102
+ let nextEvents;
103
+ let offset;
104
+ while(++index < events.length)if ("enter" === events[index][0] && "attentionSequence" === events[index][1].type && events[index][1]._close) {
105
+ open = index;
106
+ while(open--)if ("exit" === events[open][0] && "attentionSequence" === events[open][1].type && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
107
+ if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) continue;
108
+ use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
109
+ const start = {
110
+ ...events[open][1].end
111
+ };
112
+ const end = {
113
+ ...events[index][1].start
114
+ };
115
+ movePoint(start, -use);
116
+ movePoint(end, use);
117
+ openingSequence = {
118
+ type: use > 1 ? external_micromark_util_symbol_namespaceObject.types.strongSequence : external_micromark_util_symbol_namespaceObject.types.emphasisSequence,
119
+ start,
120
+ end: {
121
+ ...events[open][1].end
122
+ }
123
+ };
124
+ closingSequence = {
125
+ type: use > 1 ? external_micromark_util_symbol_namespaceObject.types.strongSequence : external_micromark_util_symbol_namespaceObject.types.emphasisSequence,
126
+ start: {
127
+ ...events[index][1].start
128
+ },
129
+ end
130
+ };
131
+ text = {
132
+ type: use > 1 ? external_micromark_util_symbol_namespaceObject.types.strongText : external_micromark_util_symbol_namespaceObject.types.emphasisText,
133
+ start: {
134
+ ...events[open][1].end
135
+ },
136
+ end: {
137
+ ...events[index][1].start
138
+ }
139
+ };
140
+ group = {
141
+ type: use > 1 ? external_micromark_util_symbol_namespaceObject.types.strong : external_micromark_util_symbol_namespaceObject.types.emphasis,
142
+ start: {
143
+ ...openingSequence.start
144
+ },
145
+ end: {
146
+ ...closingSequence.end
147
+ }
148
+ };
149
+ events[open][1].end = {
150
+ ...openingSequence.start
151
+ };
152
+ events[index][1].start = {
153
+ ...closingSequence.end
154
+ };
155
+ nextEvents = [];
156
+ if (events[open][1].end.offset - events[open][1].start.offset) nextEvents = (0, external_micromark_util_chunked_namespaceObject.push)(nextEvents, [
157
+ [
158
+ "enter",
159
+ events[open][1],
160
+ context
161
+ ],
162
+ [
163
+ "exit",
164
+ events[open][1],
165
+ context
166
+ ]
167
+ ]);
168
+ nextEvents = (0, external_micromark_util_chunked_namespaceObject.push)(nextEvents, [
169
+ [
170
+ "enter",
171
+ group,
172
+ context
173
+ ],
174
+ [
175
+ "enter",
176
+ openingSequence,
177
+ context
178
+ ],
179
+ [
180
+ "exit",
181
+ openingSequence,
182
+ context
183
+ ],
184
+ [
185
+ "enter",
186
+ text,
187
+ context
188
+ ]
189
+ ]);
190
+ (0, external_devlop_namespaceObject.ok)(context.parser.constructs.insideSpan.null, "expected `insideSpan` to be populated");
191
+ nextEvents = (0, external_micromark_util_chunked_namespaceObject.push)(nextEvents, (0, external_micromark_util_resolve_all_namespaceObject.resolveAll)(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context));
192
+ nextEvents = (0, external_micromark_util_chunked_namespaceObject.push)(nextEvents, [
193
+ [
194
+ "exit",
195
+ text,
196
+ context
197
+ ],
198
+ [
199
+ "enter",
200
+ closingSequence,
201
+ context
202
+ ],
203
+ [
204
+ "exit",
205
+ closingSequence,
206
+ context
207
+ ],
208
+ [
209
+ "exit",
210
+ group,
211
+ context
212
+ ]
213
+ ]);
214
+ if (events[index][1].end.offset - events[index][1].start.offset) {
215
+ offset = 2;
216
+ nextEvents = (0, external_micromark_util_chunked_namespaceObject.push)(nextEvents, [
217
+ [
218
+ "enter",
219
+ events[index][1],
220
+ context
221
+ ],
222
+ [
223
+ "exit",
224
+ events[index][1],
225
+ context
226
+ ]
227
+ ]);
228
+ } else offset = 0;
229
+ (0, external_micromark_util_chunked_namespaceObject.splice)(events, open - 1, index - open + 3, nextEvents);
230
+ index = open + nextEvents.length - offset - 2;
231
+ break;
232
+ }
233
+ }
234
+ index = -1;
235
+ while(++index < events.length)if ("attentionSequence" === events[index][1].type) events[index][1].type = "data";
236
+ return events;
237
+ }
238
+ function tokenizeAttention(effects, ok) {
239
+ const attentionMarkers = this.parser.constructs.attentionMarkers.null;
240
+ let previous = this.previous;
241
+ const { now, sliceSerialize } = this;
242
+ if (previous && previous >= 0xdc00 && previous <= 0xdfff) {
243
+ const nowPoint = now();
244
+ if (nowPoint._bufferIndex >= 2) {
245
+ const previousBuffer = sliceSerialize({
246
+ start: {
247
+ ...nowPoint,
248
+ _bufferIndex: nowPoint._bufferIndex - 2
249
+ },
250
+ end: nowPoint
251
+ });
252
+ const previousCandidate = previousBuffer.codePointAt(0);
253
+ if (previousCandidate && previousCandidate >= 65536) previous = previousCandidate;
254
+ }
255
+ }
256
+ const before = classifyCharacter(previous);
257
+ let beforePrimary = before;
258
+ if (before === classifyCharacter_constantsEx.svsFollowingCjk) {
259
+ const nowPoint = now();
260
+ const previousWidth = previous >= 65536 ? 2 : 1;
261
+ if (nowPoint._bufferIndex >= 1 + previousWidth) {
262
+ const idealStart = nowPoint._bufferIndex - previousWidth - 2;
263
+ const twoPreviousBuffer = sliceSerialize({
264
+ start: {
265
+ ...nowPoint,
266
+ _bufferIndex: idealStart >= 0 ? idealStart : 0
267
+ },
268
+ end: {
269
+ ...nowPoint,
270
+ _bufferIndex: nowPoint._bufferIndex - previousWidth
271
+ }
272
+ });
273
+ const twoPreviousLast = twoPreviousBuffer.charCodeAt(twoPreviousBuffer.length - 1);
274
+ if (!Number.isNaN(twoPreviousLast)) {
275
+ let twoPrevious;
276
+ if (twoPreviousBuffer.length >= 2 && twoPreviousLast >= 0xdc00 && twoPreviousLast <= 0xdfff) {
277
+ const twoPreviousCandidate = twoPreviousBuffer.codePointAt(0);
278
+ twoPrevious = twoPreviousCandidate && twoPreviousCandidate >= 65536 ? twoPreviousCandidate : twoPreviousLast;
279
+ } else twoPrevious = twoPreviousLast;
280
+ beforePrimary = classifyCharacter(twoPrevious);
281
+ }
282
+ }
283
+ }
284
+ let marker;
285
+ return start;
286
+ function start(code) {
287
+ (0, external_devlop_namespaceObject.ok)(code === external_micromark_util_symbol_namespaceObject.codes.asterisk || code === external_micromark_util_symbol_namespaceObject.codes.underscore, "expected asterisk or underscore");
288
+ marker = code;
289
+ effects.enter("attentionSequence");
290
+ return inside(code);
291
+ }
292
+ function inside(code) {
293
+ if (code === marker) {
294
+ effects.consume(code);
295
+ return inside;
296
+ }
297
+ const token = effects.exit("attentionSequence");
298
+ let next = code;
299
+ if (next && next >= 0xd800 && next <= 0xdfff) {
300
+ const nowPoint = now();
301
+ const nextCandidate = sliceSerialize({
302
+ start: nowPoint,
303
+ end: {
304
+ ...nowPoint,
305
+ _bufferIndex: nowPoint._bufferIndex + 2
306
+ }
307
+ }).codePointAt(0);
308
+ if (nextCandidate && nextCandidate >= 65536) next = nextCandidate;
309
+ }
310
+ const after = classifyCharacter(next);
311
+ (0, external_devlop_namespaceObject.ok)(attentionMarkers, "expected `attentionMarkers` to be populated");
312
+ const beforeNonCjkPunctuation = Boolean((before & classifyCharacter_constantsEx.cjkPunctuation) === external_micromark_util_symbol_namespaceObject.constants.characterGroupPunctuation);
313
+ const beforeSpaceOrNonCjkPunctuation = Boolean(beforeNonCjkPunctuation || before & external_micromark_util_symbol_namespaceObject.constants.characterGroupWhitespace);
314
+ const afterNonCjkPunctuation = Boolean((after & classifyCharacter_constantsEx.cjkPunctuation) === external_micromark_util_symbol_namespaceObject.constants.characterGroupPunctuation);
315
+ const afterSpaceOrNonCjkPunctuation = Boolean(afterNonCjkPunctuation || after & external_micromark_util_symbol_namespaceObject.constants.characterGroupWhitespace);
316
+ const beforeCjkOrIvs = Boolean(beforePrimary & classifyCharacter_constantsEx.cjk || before & classifyCharacter_constantsEx.ivs);
317
+ const open = Boolean(!afterSpaceOrNonCjkPunctuation || afterNonCjkPunctuation && (beforeSpaceOrNonCjkPunctuation || beforeCjkOrIvs) || attentionMarkers.includes(code));
318
+ const close = Boolean(!beforeSpaceOrNonCjkPunctuation || beforeNonCjkPunctuation && (afterSpaceOrNonCjkPunctuation || after & classifyCharacter_constantsEx.cjk) || attentionMarkers.includes(previous));
319
+ token._open = Boolean(marker === external_micromark_util_symbol_namespaceObject.codes.asterisk ? open : open && (before & classifyCharacter_constantsEx.spaceOrPunctuation || !close));
320
+ token._close = Boolean(marker === external_micromark_util_symbol_namespaceObject.codes.asterisk ? close : close && (after & classifyCharacter_constantsEx.spaceOrPunctuation || !open));
321
+ return ok(code);
322
+ }
323
+ }
324
+ function movePoint(point, offset) {
325
+ point.column += offset;
326
+ point.offset += offset;
327
+ point._bufferIndex += offset;
328
+ }
329
+ function cjkFriendlyExtension() {
330
+ return {
331
+ text: {
332
+ [external_micromark_util_symbol_namespaceObject.codes.asterisk]: attention,
333
+ [external_micromark_util_symbol_namespaceObject.codes.underscore]: attention
334
+ },
335
+ insideSpan: {
336
+ null: [
337
+ attention
338
+ ]
339
+ }
340
+ };
341
+ }
342
+ var __webpack_export_target__ = exports;
343
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
344
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
345
+ value: true
346
+ });
@@ -0,0 +1,5 @@
1
+ import type { Extension } from "micromark-util-types";
2
+ /**
3
+ * Make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK).
4
+ */
5
+ export declare function cjkFriendlyExtension(): Extension;
package/dist/index.js ADDED
@@ -0,0 +1,312 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__ from "micromark-util-symbol";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_devlop__ from "devlop";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_micromark_util_chunked_0c4f2f7c__ from "micromark-util-chunked";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_micromark_util_resolve_all_7bf88077__ from "micromark-util-resolve-all";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_micromark_util_character_bdee8a5c__ from "micromark-util-character";
6
+ import * as __WEBPACK_EXTERNAL_MODULE_get_east_asian_width_c890dec0__ from "get-east-asian-width";
7
+ function cjkOrIvs(uc) {
8
+ if (!uc || uc < 0) return false;
9
+ const eaw = (0, __WEBPACK_EXTERNAL_MODULE_get_east_asian_width_c890dec0__.eastAsianWidthType)(uc);
10
+ switch(eaw){
11
+ case "fullwidth":
12
+ case "halfwidth":
13
+ return true;
14
+ case "wide":
15
+ return !/^\p{RGI_Emoji}/v.test(String.fromCodePoint(uc));
16
+ case "narrow":
17
+ return false;
18
+ case "ambiguous":
19
+ return 0xe0100 <= uc && uc <= 0xe01ef && null;
20
+ case "neutral":
21
+ return /^\p{sc=Hangul}/u.test(String.fromCodePoint(uc));
22
+ }
23
+ }
24
+ const svsFollowingCjk = regexCheck(/[\uFE00-\uFE02\uFE0E]/u);
25
+ const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
26
+ const unicodeWhitespace = regexCheck(/\s/);
27
+ function regexCheck(regex) {
28
+ return check;
29
+ function check(code) {
30
+ return null !== code && code > -1 && regex.test(String.fromCodePoint(code));
31
+ }
32
+ }
33
+ (function(constantsEx) {
34
+ constantsEx.spaceOrPunctuation = 3;
35
+ constantsEx.cjk = 0x1000;
36
+ constantsEx.cjkPunctuation = 0x1002;
37
+ constantsEx.ivs = 0x2000;
38
+ constantsEx.cjkOrIvs = 0x3000;
39
+ constantsEx.svsFollowingCjk = 0x4000;
40
+ constantsEx.variationSelector = 0x7000;
41
+ })(classifyCharacter_constantsEx || (classifyCharacter_constantsEx = {}));
42
+ function classifyCharacter(code) {
43
+ if (code === __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.codes.eof || (0, __WEBPACK_EXTERNAL_MODULE_micromark_util_character_bdee8a5c__.markdownLineEndingOrSpace)(code) || unicodeWhitespace(code)) return __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.constants.characterGroupWhitespace;
44
+ let value = 0;
45
+ if (code >= 0x1100) {
46
+ if (svsFollowingCjk(code)) return classifyCharacter_constantsEx.svsFollowingCjk;
47
+ switch(cjkOrIvs(code)){
48
+ case null:
49
+ return classifyCharacter_constantsEx.ivs;
50
+ case true:
51
+ value |= classifyCharacter_constantsEx.cjk;
52
+ break;
53
+ }
54
+ }
55
+ if (unicodePunctuation(code)) value |= __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.constants.characterGroupPunctuation;
56
+ return value;
57
+ }
58
+ var classifyCharacter_constantsEx;
59
+ const attention = {
60
+ name: "attention",
61
+ resolveAll: resolveAllAttention,
62
+ tokenize: tokenizeAttention
63
+ };
64
+ function resolveAllAttention(events, context) {
65
+ let index = -1;
66
+ let open;
67
+ let group;
68
+ let text;
69
+ let openingSequence;
70
+ let closingSequence;
71
+ let use;
72
+ let nextEvents;
73
+ let offset;
74
+ while(++index < events.length)if ("enter" === events[index][0] && "attentionSequence" === events[index][1].type && events[index][1]._close) {
75
+ open = index;
76
+ while(open--)if ("exit" === events[open][0] && "attentionSequence" === events[open][1].type && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
77
+ if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) continue;
78
+ use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
79
+ const start = {
80
+ ...events[open][1].end
81
+ };
82
+ const end = {
83
+ ...events[index][1].start
84
+ };
85
+ movePoint(start, -use);
86
+ movePoint(end, use);
87
+ openingSequence = {
88
+ type: use > 1 ? __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.types.strongSequence : __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.types.emphasisSequence,
89
+ start,
90
+ end: {
91
+ ...events[open][1].end
92
+ }
93
+ };
94
+ closingSequence = {
95
+ type: use > 1 ? __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.types.strongSequence : __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.types.emphasisSequence,
96
+ start: {
97
+ ...events[index][1].start
98
+ },
99
+ end
100
+ };
101
+ text = {
102
+ type: use > 1 ? __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.types.strongText : __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.types.emphasisText,
103
+ start: {
104
+ ...events[open][1].end
105
+ },
106
+ end: {
107
+ ...events[index][1].start
108
+ }
109
+ };
110
+ group = {
111
+ type: use > 1 ? __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.types.strong : __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.types.emphasis,
112
+ start: {
113
+ ...openingSequence.start
114
+ },
115
+ end: {
116
+ ...closingSequence.end
117
+ }
118
+ };
119
+ events[open][1].end = {
120
+ ...openingSequence.start
121
+ };
122
+ events[index][1].start = {
123
+ ...closingSequence.end
124
+ };
125
+ nextEvents = [];
126
+ if (events[open][1].end.offset - events[open][1].start.offset) nextEvents = (0, __WEBPACK_EXTERNAL_MODULE_micromark_util_chunked_0c4f2f7c__.push)(nextEvents, [
127
+ [
128
+ "enter",
129
+ events[open][1],
130
+ context
131
+ ],
132
+ [
133
+ "exit",
134
+ events[open][1],
135
+ context
136
+ ]
137
+ ]);
138
+ nextEvents = (0, __WEBPACK_EXTERNAL_MODULE_micromark_util_chunked_0c4f2f7c__.push)(nextEvents, [
139
+ [
140
+ "enter",
141
+ group,
142
+ context
143
+ ],
144
+ [
145
+ "enter",
146
+ openingSequence,
147
+ context
148
+ ],
149
+ [
150
+ "exit",
151
+ openingSequence,
152
+ context
153
+ ],
154
+ [
155
+ "enter",
156
+ text,
157
+ context
158
+ ]
159
+ ]);
160
+ (0, __WEBPACK_EXTERNAL_MODULE_devlop__.ok)(context.parser.constructs.insideSpan.null, "expected `insideSpan` to be populated");
161
+ nextEvents = (0, __WEBPACK_EXTERNAL_MODULE_micromark_util_chunked_0c4f2f7c__.push)(nextEvents, (0, __WEBPACK_EXTERNAL_MODULE_micromark_util_resolve_all_7bf88077__.resolveAll)(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context));
162
+ nextEvents = (0, __WEBPACK_EXTERNAL_MODULE_micromark_util_chunked_0c4f2f7c__.push)(nextEvents, [
163
+ [
164
+ "exit",
165
+ text,
166
+ context
167
+ ],
168
+ [
169
+ "enter",
170
+ closingSequence,
171
+ context
172
+ ],
173
+ [
174
+ "exit",
175
+ closingSequence,
176
+ context
177
+ ],
178
+ [
179
+ "exit",
180
+ group,
181
+ context
182
+ ]
183
+ ]);
184
+ if (events[index][1].end.offset - events[index][1].start.offset) {
185
+ offset = 2;
186
+ nextEvents = (0, __WEBPACK_EXTERNAL_MODULE_micromark_util_chunked_0c4f2f7c__.push)(nextEvents, [
187
+ [
188
+ "enter",
189
+ events[index][1],
190
+ context
191
+ ],
192
+ [
193
+ "exit",
194
+ events[index][1],
195
+ context
196
+ ]
197
+ ]);
198
+ } else offset = 0;
199
+ (0, __WEBPACK_EXTERNAL_MODULE_micromark_util_chunked_0c4f2f7c__.splice)(events, open - 1, index - open + 3, nextEvents);
200
+ index = open + nextEvents.length - offset - 2;
201
+ break;
202
+ }
203
+ }
204
+ index = -1;
205
+ while(++index < events.length)if ("attentionSequence" === events[index][1].type) events[index][1].type = "data";
206
+ return events;
207
+ }
208
+ function tokenizeAttention(effects, ok) {
209
+ const attentionMarkers = this.parser.constructs.attentionMarkers.null;
210
+ let previous = this.previous;
211
+ const { now, sliceSerialize } = this;
212
+ if (previous && previous >= 0xdc00 && previous <= 0xdfff) {
213
+ const nowPoint = now();
214
+ if (nowPoint._bufferIndex >= 2) {
215
+ const previousBuffer = sliceSerialize({
216
+ start: {
217
+ ...nowPoint,
218
+ _bufferIndex: nowPoint._bufferIndex - 2
219
+ },
220
+ end: nowPoint
221
+ });
222
+ const previousCandidate = previousBuffer.codePointAt(0);
223
+ if (previousCandidate && previousCandidate >= 65536) previous = previousCandidate;
224
+ }
225
+ }
226
+ const before = classifyCharacter(previous);
227
+ let beforePrimary = before;
228
+ if (before === classifyCharacter_constantsEx.svsFollowingCjk) {
229
+ const nowPoint = now();
230
+ const previousWidth = previous >= 65536 ? 2 : 1;
231
+ if (nowPoint._bufferIndex >= 1 + previousWidth) {
232
+ const idealStart = nowPoint._bufferIndex - previousWidth - 2;
233
+ const twoPreviousBuffer = sliceSerialize({
234
+ start: {
235
+ ...nowPoint,
236
+ _bufferIndex: idealStart >= 0 ? idealStart : 0
237
+ },
238
+ end: {
239
+ ...nowPoint,
240
+ _bufferIndex: nowPoint._bufferIndex - previousWidth
241
+ }
242
+ });
243
+ const twoPreviousLast = twoPreviousBuffer.charCodeAt(twoPreviousBuffer.length - 1);
244
+ if (!Number.isNaN(twoPreviousLast)) {
245
+ let twoPrevious;
246
+ if (twoPreviousBuffer.length >= 2 && twoPreviousLast >= 0xdc00 && twoPreviousLast <= 0xdfff) {
247
+ const twoPreviousCandidate = twoPreviousBuffer.codePointAt(0);
248
+ twoPrevious = twoPreviousCandidate && twoPreviousCandidate >= 65536 ? twoPreviousCandidate : twoPreviousLast;
249
+ } else twoPrevious = twoPreviousLast;
250
+ beforePrimary = classifyCharacter(twoPrevious);
251
+ }
252
+ }
253
+ }
254
+ let marker;
255
+ return start;
256
+ function start(code) {
257
+ (0, __WEBPACK_EXTERNAL_MODULE_devlop__.ok)(code === __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.codes.asterisk || code === __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.codes.underscore, "expected asterisk or underscore");
258
+ marker = code;
259
+ effects.enter("attentionSequence");
260
+ return inside(code);
261
+ }
262
+ function inside(code) {
263
+ if (code === marker) {
264
+ effects.consume(code);
265
+ return inside;
266
+ }
267
+ const token = effects.exit("attentionSequence");
268
+ let next = code;
269
+ if (next && next >= 0xd800 && next <= 0xdfff) {
270
+ const nowPoint = now();
271
+ const nextCandidate = sliceSerialize({
272
+ start: nowPoint,
273
+ end: {
274
+ ...nowPoint,
275
+ _bufferIndex: nowPoint._bufferIndex + 2
276
+ }
277
+ }).codePointAt(0);
278
+ if (nextCandidate && nextCandidate >= 65536) next = nextCandidate;
279
+ }
280
+ const after = classifyCharacter(next);
281
+ (0, __WEBPACK_EXTERNAL_MODULE_devlop__.ok)(attentionMarkers, "expected `attentionMarkers` to be populated");
282
+ const beforeNonCjkPunctuation = Boolean((before & classifyCharacter_constantsEx.cjkPunctuation) === __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.constants.characterGroupPunctuation);
283
+ const beforeSpaceOrNonCjkPunctuation = Boolean(beforeNonCjkPunctuation || before & __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.constants.characterGroupWhitespace);
284
+ const afterNonCjkPunctuation = Boolean((after & classifyCharacter_constantsEx.cjkPunctuation) === __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.constants.characterGroupPunctuation);
285
+ const afterSpaceOrNonCjkPunctuation = Boolean(afterNonCjkPunctuation || after & __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.constants.characterGroupWhitespace);
286
+ const beforeCjkOrIvs = Boolean(beforePrimary & classifyCharacter_constantsEx.cjk || before & classifyCharacter_constantsEx.ivs);
287
+ const open = Boolean(!afterSpaceOrNonCjkPunctuation || afterNonCjkPunctuation && (beforeSpaceOrNonCjkPunctuation || beforeCjkOrIvs) || attentionMarkers.includes(code));
288
+ const close = Boolean(!beforeSpaceOrNonCjkPunctuation || beforeNonCjkPunctuation && (afterSpaceOrNonCjkPunctuation || after & classifyCharacter_constantsEx.cjk) || attentionMarkers.includes(previous));
289
+ token._open = Boolean(marker === __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.codes.asterisk ? open : open && (before & classifyCharacter_constantsEx.spaceOrPunctuation || !close));
290
+ token._close = Boolean(marker === __WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.codes.asterisk ? close : close && (after & classifyCharacter_constantsEx.spaceOrPunctuation || !open));
291
+ return ok(code);
292
+ }
293
+ }
294
+ function movePoint(point, offset) {
295
+ point.column += offset;
296
+ point.offset += offset;
297
+ point._bufferIndex += offset;
298
+ }
299
+ function cjkFriendlyExtension() {
300
+ return {
301
+ text: {
302
+ [__WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.codes.asterisk]: attention,
303
+ [__WEBPACK_EXTERNAL_MODULE_micromark_util_symbol_0f33a452__.codes.underscore]: attention
304
+ },
305
+ insideSpan: {
306
+ null: [
307
+ attention
308
+ ]
309
+ }
310
+ };
311
+ }
312
+ export { cjkFriendlyExtension };
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "micromark-extension-cjk-friendly",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js",
9
+ "module-sync": "./dist/index.js",
10
+ "require": "./dist/index.cjs"
11
+ }
12
+ },
13
+ "main": "./dist/index.cjs",
14
+ "module": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "files": ["dist", "LICENSE", "README.md"],
17
+ "repository": {
18
+ "url": "https://github.com/tats-u/markdown-cjk-friendly"
19
+ },
20
+ "license": "MIT",
21
+ "author": "Tatsunori Uchino <tats.u@live.jp> (https://github.com/tats-u)",
22
+ "bugs": "https://github.com/tats-u/markdown-cjk-friendly/issues",
23
+ "keywords": [
24
+ "micromark-extension",
25
+ "micromark",
26
+ "markdown",
27
+ "japanese",
28
+ "chinese",
29
+ "korean",
30
+ "cjk"
31
+ ],
32
+ "description": "micromark extension to make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK)",
33
+ "sideEffects": false,
34
+ "scripts": {
35
+ "build": "rslib build",
36
+ "dev": "rslib build --watch",
37
+ "test": "vitest --run",
38
+ "test:up": "vitest -u",
39
+ "test:watch": "vitest watch",
40
+ "lint:type": "tsc --noEmit",
41
+ "prepack": "node -e \"require('fs').cpSync('../../LICENSE', './LICENSE')\""
42
+ },
43
+ "dependencies": {
44
+ "devlop": "^1.0.0",
45
+ "get-east-asian-width": "^1.3.0",
46
+ "micromark-util-character": "^2.0.0",
47
+ "micromark-util-chunked": "^2.0.0",
48
+ "micromark-util-resolve-all": "^2.0.0",
49
+ "micromark-util-symbol": "^2.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@rslib/core": "^0.3.1",
53
+ "micromark": "^4.0.1",
54
+ "micromark-extension-gfm": "^3.0.0",
55
+ "micromark-util-types": "^2.0.0"
56
+ },
57
+ "peerDependencies": {
58
+ "micromark": "^4.0.0",
59
+ "micromark-util-types": "^2.0.0"
60
+ },
61
+ "peerDependenciesMeta": {
62
+ "micromark-util-types": {
63
+ "optional": true
64
+ }
65
+ },
66
+ "engines": {
67
+ "node": ">=20"
68
+ }
69
+ }