Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vincentbel/remark-pangu

给 Markdown 中英文自动插入空格的 remark 插件
https://github.com/vincentbel/remark-pangu

pangu remark remark-plugin text-spacing

Last synced: 4 days ago
JSON representation

给 Markdown 中英文自动插入空格的 remark 插件

Awesome Lists containing this project

README

        

# remark-pangu

[![travis build](https://img.shields.io/travis/VincentBel/remark-pangu.svg?style=flat-square)](https://travis-ci.org/VincentBel/remark-pangu)
[![version](https://img.shields.io/npm/v/remark-pangu.svg?style=flat-square)](http://npm.im/remark-pangu)
[![MIT License](https://img.shields.io/npm/l/remark-pangu.svg?style=flat-square)](http://opensource.org/licenses/MIT)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](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)