remark-cjk-friendly 2.2.0 → 2.3.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/README.md +46 -6
- package/dist/bidi.d.ts +9 -0
- package/dist/bidi.js +16 -0
- package/dist/index.d.ts +1 -8
- package/dist/index.js +3 -12
- package/dist/parseOnly.d.ts +3 -3
- package/dist/parseOnly.js +3 -3
- package/dist/serializeOnly.d.ts +2 -2
- package/dist/serializeOnly.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -170,13 +170,53 @@ const processor = unified()
|
|
|
170
170
|
const htmlResult = (await processor.process(markdownString)).toString();
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
This plugin also wires the reverse path for `remark-stringify` / `mdast-util-to-markdown`, so CJK text around `*` / `**` stays raw when it is valid under this specification instead of being escaped as character references.
|
|
173
|
+
This plugin also wires the reverse path for `remark-stringify` / `mdast-util-to-markdown`, so CJK text around `*` / `**` stays raw when it is valid under this specification instead of being escaped as character references. Since this serialization feature may be removed from the default entry point of `remark-cjk-friendly` in a future version, it is strongly recommended to import from `remark-cjk-friendly/bidi`. For users who only need parsing or serialization and want to minimize bundle size (reduces a few KB), import from `remark-cjk-friendly/parseOnly` or `remark-cjk-friendly/serializeOnly` respectively.
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
| Entry point | Parsing (Markdown → AST) | Serialization (AST → Markdown) |
|
|
176
|
+
| --- | --- | --- |
|
|
177
|
+
| `remark-cjk-friendly` | ✅ | ⚠️ |
|
|
178
|
+
| `remark-cjk-friendly/bidi` | ✅ | ✅ |
|
|
179
|
+
| `remark-cjk-friendly/parseOnly` | ✅ | ❌ |
|
|
180
|
+
| `remark-cjk-friendly/serializeOnly` | ❌ | ✅ |
|
|
176
181
|
|
|
177
|
-
<
|
|
182
|
+
<div lang="ja">
|
|
183
|
+
|
|
184
|
+
このプラグインは`remark-stringify` / `mdast-util-to-markdown`向けの逆方向シリアライズ拡張にも対応しており、この仕様で妥当なケースでは`*` / `**`の前後にあるCJK文字が文字参照へエスケープされず、そのまま出力されます。このシリアライズ機能は将来のバージョンで`remark-cjk-friendly`のデフォルトのエントリポイントから削除するかもしれませんので、`remark-cjk-friendly/bidi`からインポートすることを強く推奨します。また、パース・シリアライズの片方しか使わない場合でバンドルサイズを最小限に抑えたい場合(数KB削減)は、`remark-cjk-friendly/parseOnly`または`remark-cjk-friendly/serializeOnly`からインポートしてください。
|
|
185
|
+
|
|
186
|
+
| エントリポイント | パース(Markdown → AST) | シリアライズ(AST → Markdown) |
|
|
187
|
+
| --- | --- | --- |
|
|
188
|
+
| `remark-cjk-friendly` | ⭕️ | ⚠️ |
|
|
189
|
+
| `remark-cjk-friendly/bidi` | ⭕️ | ⭕️ |
|
|
190
|
+
| `remark-cjk-friendly/parseOnly` | ⭕️ | ❌ |
|
|
191
|
+
| `remark-cjk-friendly/serializeOnly` | ❌ | ⭕️ |
|
|
192
|
+
|
|
193
|
+
</div>
|
|
178
194
|
|
|
179
|
-
<
|
|
195
|
+
<div lang="zh-Hans-CN">
|
|
196
|
+
|
|
197
|
+
此插件还会自动接入 `remark-stringify` / `mdast-util-to-markdown` 的反向序列化扩展,因此在本规范允许的情况下,`*` / `**` 周围的 CJK 文字会保持原样输出,而不会被转义为字符引用。由于此序列化功能可能在未来版本中从 `remark-cjk-friendly` 的默认入口点中删除,强烈建议从 `remark-cjk-friendly/bidi` 导入。如果只需要解析或序列化其中之一,并希望尽量减小打包体积(可减少数KB),请分别从 `remark-cjk-friendly/parseOnly` 或 `remark-cjk-friendly/serializeOnly` 导入。
|
|
198
|
+
|
|
199
|
+
| 入口点 | 解析(Markdown → AST) | 序列化(AST → Markdown) |
|
|
200
|
+
| --- | --- | --- |
|
|
201
|
+
| `remark-cjk-friendly` | ✅ | ⚠️ |
|
|
202
|
+
| `remark-cjk-friendly/bidi` | ✅ | ✅ |
|
|
203
|
+
| `remark-cjk-friendly/parseOnly` | ✅ | ❌ |
|
|
204
|
+
| `remark-cjk-friendly/serializeOnly` | ❌ | ✅ |
|
|
205
|
+
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
<div lang="ko">
|
|
209
|
+
|
|
210
|
+
이 플러그인은 `remark-stringify` / `mdast-util-to-markdown`용 역방향 직렬화 확장도 자동으로 연결하므로, 이 사양에서 유효한 경우 `*` / `**` 주변의 CJK 문자가 문자 참조로 이스케이프되지 않고 그대로 출력됩니다. 이 직렬화 기능은 향후 버전에서 `remark-cjk-friendly`의 기본 엔트리 포인트에서 제거될 수 있으므로, `remark-cjk-friendly/bidi`에서 가져오는 것을 강력히 권장합니다. 파싱과 직렬화 중 하나만 필요하고 번들 크기를 최소화하려는 경우(수 KB 절감)에는 각각 `remark-cjk-friendly/parseOnly` 또는 `remark-cjk-friendly/serializeOnly`에서 가져오세요.
|
|
211
|
+
|
|
212
|
+
| 엔트리 포인트 | 파싱(Markdown → AST) | 직렬화(AST → Markdown) |
|
|
213
|
+
| --- | --- | --- |
|
|
214
|
+
| `remark-cjk-friendly` | ⭕️ | ⚠️ |
|
|
215
|
+
| `remark-cjk-friendly/bidi` | ⭕️ | ⭕️ |
|
|
216
|
+
| `remark-cjk-friendly/parseOnly` | ⭕️ | ❌ |
|
|
217
|
+
| `remark-cjk-friendly/serializeOnly` | ❌ | ⭕️ |
|
|
218
|
+
|
|
219
|
+
</div>
|
|
180
220
|
|
|
181
221
|
For MDX, add `remarkCjkFriendly` to the `remarkPlugins` array in the config object:
|
|
182
222
|
|
|
@@ -278,11 +318,11 @@ https://github.com/tats-u/markdown-cjk-friendly/blob/main/specification.md (Engl
|
|
|
278
318
|
## Related packages / <span lang="ja">関連パッケージ</span> / <span lang="zh-Hans-CN">相关包</span> / <span lang="ko">관련 패키지</span>
|
|
279
319
|
|
|
280
320
|
- [remark-cjk-friendly-gfm-strikethrough](https://npmjs.com/package/remark-cjk-friendly-gfm-strikethrough) [](https://npmjs.com/package/remark-cjk-friendly-gfm-strikethrough)  [](https://npmjs.com/package/remark-cjk-friendly-gfm-strikethrough) [](https://npmjs.com/package/remark-cjk-friendly-gfm-strikethrough) [](https://socket.dev/npm/package/remark-cjk-friendly-gfm-strikethrough) [\[Snyk Security\]](https://security.snyk.io/package/npm/remark-cjk-friendly-gfm-strikethrough)
|
|
281
|
-
- [mdast-util-to-markdown-cjk-friendly](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly) [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly)  [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly) [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly) [](https://socket.dev/npm/package/mdast-util-to-markdown-cjk-friendly) [\[Snyk Security\]](https://security.snyk.io/package/npm/mdast-util-to-markdown-cjk-friendly)
|
|
282
321
|
- [micromark-extension-cjk-friendly](https://npmjs.com/package/micromark-extension-cjk-friendly) [](https://npmjs.com/package/micromark-extension-cjk-friendly)  [](https://npmjs.com/package/micromark-extension-cjk-friendly) [](https://npmjs.com/package/micromark-extension-cjk-friendly) [](https://socket.dev/npm/package/micromark-extension-cjk-friendly) [\[Snyk Security\]](https://security.snyk.io/package/npm/micromark-extension-cjk-friendly)
|
|
283
322
|
- [micromark-extension-cjk-friendly-util](https://npmjs.com/package/micromark-extension-cjk-friendly-util) [](https://npmjs.com/package/micromark-extension-cjk-friendly-util)  [](https://npmjs.com/package/micromark-extension-cjk-friendly-util) [](https://npmjs.com/package/micromark-extension-cjk-friendly-util) [](https://socket.dev/npm/package/micromark-extension-cjk-friendly-util) [\[Snyk Security\]](https://security.snyk.io/package/npm/micromark-extension-cjk-friendly-util)
|
|
284
323
|
- [micromark-extension-cjk-friendly-gfm-strikethrough](https://npmjs.com/package/micromark-extension-cjk-friendly-gfm-strikethrough) [](https://npmjs.com/package/micromark-extension-cjk-friendly-gfm-strikethrough)  [](https://npmjs.com/package/micromark-extension-cjk-friendly-gfm-strikethrough) [](https://npmjs.com/package/micromark-extension-cjk-friendly-gfm-strikethrough) [](https://socket.dev/npm/package/micromark-extension-cjk-friendly-gfm-strikethrough) [\[Snyk Security\]](https://security.snyk.io/package/npm/micromark-extension-cjk-friendly-gfm-strikethrough)
|
|
285
|
-
|
|
324
|
+
- [mdast-util-to-markdown-cjk-friendly](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly) [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly)  [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly) [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly) [](https://socket.dev/npm/package/mdast-util-to-markdown-cjk-friendly) [\[Snyk Security\]](https://security.snyk.io/package/npm/mdast-util-to-markdown-cjk-friendly)
|
|
325
|
+
- [mdast-util-to-markdown-cjk-friendly-gfm-strikethrough](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough) [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough)  [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough) [](https://npmjs.com/package/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough) [](https://socket.dev/npm/package/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough) [\[Snyk Security\]](https://security.snyk.io/package/npm/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough)
|
|
286
326
|
- [markdown-it-cjk-friendly](https://npmjs.com/package/markdown-it-cjk-friendly) [](https://npmjs.com/package/markdown-it-cjk-friendly)  [](https://npmjs.com/package/markdown-it-cjk-friendly) [](https://npmjs.com/package/markdown-it-cjk-friendly) [](https://socket.dev/npm/package/markdown-it-cjk-friendly) [\[Snyk Security\]](https://security.snyk.io/package/npm/markdown-it-cjk-friendly)
|
|
287
327
|
- [marked-cjk-friendly](https://npmjs.com/package/marked-cjk-friendly) [](https://npmjs.com/package/marked-cjk-friendly)  [](https://npmjs.com/package/marked-cjk-friendly) [](https://npmjs.com/package/marked-cjk-friendly) [](https://socket.dev/npm/package/marked-cjk-friendly) [\[Snyk Security\]](https://security.snyk.io/package/npm/marked-cjk-friendly)
|
|
288
328
|
|
package/dist/bidi.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/bidi.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK).
|
|
4
|
+
*
|
|
5
|
+
* This plugin supports both parsing and serializing. If you want to support only one of them, it is recommended to import this plugin from `remark-cjk-friendly/parseOnly` or `remark-cjk-friendly/serializeOnly` instead to minimize bundled dependencies.
|
|
6
|
+
*/
|
|
7
|
+
declare function remarkCjkFriendly(this: unknown): void;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { remarkCjkFriendly as default };
|
package/dist/bidi.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import remarkCjkFriendly$1 from "./parseOnly.js";
|
|
2
|
+
import remarkCjkFriendly$2 from "./serializeOnly.js";
|
|
3
|
+
|
|
4
|
+
//#region src/bidi.ts
|
|
5
|
+
/**
|
|
6
|
+
* Make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK).
|
|
7
|
+
*
|
|
8
|
+
* This plugin supports both parsing and serializing. If you want to support only one of them, it is recommended to import this plugin from `remark-cjk-friendly/parseOnly` or `remark-cjk-friendly/serializeOnly` instead to minimize bundled dependencies.
|
|
9
|
+
*/
|
|
10
|
+
function remarkCjkFriendly() {
|
|
11
|
+
remarkCjkFriendly$1.call(this);
|
|
12
|
+
remarkCjkFriendly$2.call(this);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { remarkCjkFriendly as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK).
|
|
4
|
-
*
|
|
5
|
-
* This plugin supports both parsing and serializing. If you want to support only one of them, it is recommended to use {@linkcode remarkCjkFriendlyParseOnly} (`remark-cjk-friendly/parseOnly`) or {@linkcode remarkCjkFriendlySerializeOnly} (`remark-cjk-friendly/serializeOnly`) instead to minimize bundled dependencies.
|
|
6
|
-
*/
|
|
7
|
-
declare function remarkCjkFriendly(this: unknown): void;
|
|
8
|
-
//#endregion
|
|
1
|
+
import remarkCjkFriendly from "./bidi.js";
|
|
9
2
|
export { remarkCjkFriendly as default };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import remarkCjkFriendlySerializeOnly from "./serializeOnly.js";
|
|
1
|
+
import remarkCjkFriendly from "./bidi.js";
|
|
3
2
|
|
|
4
3
|
//#region src/index.ts
|
|
5
|
-
|
|
6
|
-
* Make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK).
|
|
7
|
-
*
|
|
8
|
-
* This plugin supports both parsing and serializing. If you want to support only one of them, it is recommended to use {@linkcode remarkCjkFriendlyParseOnly} (`remark-cjk-friendly/parseOnly`) or {@linkcode remarkCjkFriendlySerializeOnly} (`remark-cjk-friendly/serializeOnly`) instead to minimize bundled dependencies.
|
|
9
|
-
*/
|
|
10
|
-
function remarkCjkFriendly() {
|
|
11
|
-
remarkCjkFriendlyParseOnly.call(this);
|
|
12
|
-
remarkCjkFriendlySerializeOnly.call(this);
|
|
13
|
-
}
|
|
4
|
+
var src_default = remarkCjkFriendly;
|
|
14
5
|
|
|
15
6
|
//#endregion
|
|
16
|
-
export {
|
|
7
|
+
export { src_default as default };
|
package/dist/parseOnly.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK).
|
|
4
4
|
*
|
|
5
|
-
* This plugin only supports parsing. If you have been using
|
|
5
|
+
* This plugin only supports parsing. If you have been using `remark-cjk-friendly` since v2.0.1 or earlier, it is recommended to migrate to this to minimize bundled dependencies.
|
|
6
6
|
*/
|
|
7
|
-
declare function
|
|
7
|
+
declare function remarkCjkFriendly(this: unknown): void;
|
|
8
8
|
//#endregion
|
|
9
|
-
export {
|
|
9
|
+
export { remarkCjkFriendly as default };
|
package/dist/parseOnly.js
CHANGED
|
@@ -4,12 +4,12 @@ import { cjkFriendlyExtension } from "micromark-extension-cjk-friendly";
|
|
|
4
4
|
/**
|
|
5
5
|
* Make Markdown emphasis (`**`) in CommonMark more friendly with Chinese, Japanese, and Korean (CJK).
|
|
6
6
|
*
|
|
7
|
-
* This plugin only supports parsing. If you have been using
|
|
7
|
+
* This plugin only supports parsing. If you have been using `remark-cjk-friendly` since v2.0.1 or earlier, it is recommended to migrate to this to minimize bundled dependencies.
|
|
8
8
|
*/
|
|
9
|
-
function
|
|
9
|
+
function remarkCjkFriendly() {
|
|
10
10
|
const data = this.data();
|
|
11
11
|
(data.micromarkExtensions || (data.micromarkExtensions = [])).push(cjkFriendlyExtension());
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
|
-
export {
|
|
15
|
+
export { remarkCjkFriendly as default };
|
package/dist/serializeOnly.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This plugin only supports serializing.
|
|
6
6
|
*/
|
|
7
|
-
declare function
|
|
7
|
+
declare function remarkCjkFriendly(this: unknown): void;
|
|
8
8
|
//#endregion
|
|
9
|
-
export {
|
|
9
|
+
export { remarkCjkFriendly as default };
|
package/dist/serializeOnly.js
CHANGED
|
@@ -6,10 +6,10 @@ import { cjkFriendlyToMarkdown } from "mdast-util-to-markdown-cjk-friendly";
|
|
|
6
6
|
*
|
|
7
7
|
* This plugin only supports serializing.
|
|
8
8
|
*/
|
|
9
|
-
function
|
|
9
|
+
function remarkCjkFriendly() {
|
|
10
10
|
const data = this.data();
|
|
11
11
|
(data.toMarkdownExtensions || (data.toMarkdownExtensions = [])).push(cjkFriendlyToMarkdown());
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
|
-
export {
|
|
15
|
+
export { remarkCjkFriendly as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remark-cjk-friendly",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"description": "remark plugin to make Markdown emphasis (`**`) in CommonMark (and MDX) more friendly with Chinese, Japanese, and Korean (CJK)",
|
|
45
45
|
"sideEffects": false,
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
47
|
+
"mdast-util-to-markdown-cjk-friendly": "1.0.0",
|
|
48
|
+
"micromark-extension-cjk-friendly": "2.0.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@mdx-js/mdx": "^3.1.1",
|