remark-pangu

Remark plugin to Automatically insert whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols) by using pangu.js

Usage no npm install needed!

<script type="module">
  import remarkPangu from 'https://cdn.skypack.dev/remark-pangu';
</script>

README

remark-pangu

travis build version MIT License semantic-release

给 Markdown 中英文自动插入空格的 remark 插件(使用 pangu.js)。

Install

npm install remark-pangu

Usage

remark().use(pangu)
const remark = require('remark')
const pangu = require('remark-pangu')

const doc = '中文abc中文';
remark().use(pangu).process(doc, (err, file) => {
  console.log(String(file));
});
// => 中文 abc 中文

Options

可以通过设置 options 控制是否处理不同类型的 Markdown 节点。

例如,此插件默认不处理 inline code,可以设置 inlineCode: true 开启处理:

remark().use(pangu, {
  inlineCode: true
})

Default Options

{
  text: true,
  inlineCode: false,
  link: true,
  image: true,
  imageReference: true,
  definition: true,
}

LICENSE

MIT