A markdown-it plugin to make Markdown emphasis (**
) in CommonMark compatible with Chinese and Japanese.
CommonMarkの強調記号(**
)を中国語・日本語にきちんと対応させるためのmarkdown-itプラグイン
一个 markdown-it 插件,用于使 CommonMark 的强调标记(**
)能够正确支持中文和日语文本。
CommonMark has a problem that the following emphasis marks **
are not recognized as emphasis marks in Japanese and Chinese.
CommonMarkには、日本語・中国語内の次のような強調記号(**
)が強調記号として認識されない問題があります。
CommonMark存在以下问题:在中文和日语文本中,强调标记**不会被识别为强调标记。
**このアスタリスクは強調記号として認識されず、そのまま表示されます。**この文のせいで。
**该星号不会被识别,而是直接显示。**这是因为它没有被识别为强调符号。
This problem occurs because the character just inside the **
is a (Japanese or Chinese) punctuation mark (。) and the character just outside is not a space or punctuation mark.
これが起こった原因は、終了側の**
のすぐ内側が約物(。)、かつ外側が約物や空白以外の文字であるためです。
这个问题是因为在**
的结束部分,内侧字符是中文或日文的标点符号(。),而外侧字符不是空格或标点符号。
Of course, not only the end side but also the start side has the same issue.
もちろん終了側だけでなく、開始側も同様の問題が存在します。
当然,不仅是结束侧,开始侧也存在同样的问题。
Install markdown-it-cj-friendly
via npm:
markdown-it-cj-friendly
をnpmでインストールしてください。
通过 npm 安装 markdown-it-cj-friendly
。
npm install markdown-it-cj-friendly
If you use another package manager, please replace npm
with the command of the package manager you use (e.g. pnpm
).
npm以外のパッケージマネージャを使う場合は、npm
を当該パッケージマネージャのコマンド(例:pnpm
)に置き換えてください。
如果使用其他包管理器,请将 npm
替换为当时包管理器的命令(例如:pnpm
)。
Import markdown-it
and markdown-it-cj-friendly
, and use the plugin as follows:
markdown-it
とmarkdown-it-cj-friendly
をインポートし、次のようにプラグインを使用してください。
通过 markdown-it
和 markdown-it-cj-friendly
导入,然后使用插件如下:
import MarkdownIt from "markdown-it";
import markdownItCjFriendly from "markdown-it-cj-friendly";
const md = MarkdownIt();
md.use(markdownItCjFriendly);
Install the dependencies:
pnpm install
Build the library:
pnpm build
Build the library in watch mode:
pnpm dev