remark-pangu
Version:
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
61 lines (44 loc) • 1.46 kB
Markdown
# remark-pangu
[](https://travis-ci.org/VincentBel/remark-pangu)
[](http://npm.im/remark-pangu)
[](http://opensource.org/licenses/MIT)
[](https://github.com/semantic-release/semantic-release)
给 Markdown 中英文自动插入空格的 [remark](https://github.com/wooorm/remark) 插件(使用 [pangu.js](https://github.com/vinta/pangu.js))。
## Install
```bash
npm install remark-pangu
```
## Usage
```js
remark().use(pangu)
```
```js
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` 开启处理:
```js
remark().use(pangu, {
inlineCode: true
})
```
#### Default Options
```js
{
text: true,
inlineCode: false,
link: true,
image: true,
imageReference: true,
definition: true,
}
```
## LICENSE
[MIT](./LICENSE)