unified

Project: laysent/remark-lint-plugins

Package: remark-lint-spaces-around-word@0.1.2

  1. Dependents: 0
  2. remark lint plugin that checks if there are spaces between English word and Chinese
  1. remark 214
  2. lint 80
  3. rule 75
  4. remark-lint 11

remark-lint-spaces-around-word

According to chinese-document-style-guide, there should be spaces between English word and Chinese characters. This lint will warn when space is missing in such cases.

Example

valid.md

In

这是一份中文 API 文档。

Out

No messages.

invalid.md

In

这是一份中文API文档。

Out

input.md:1:7-1:9: Should have spaces around "API"

Install

npm install remark-lint-spaces-around-word

Usage

You probably want to use it on the CLI through a config file:

 ...
 "remarkConfig": {
   "plugins": [
     ...
     "remark-lint",
+    "remark-lint-spaces-around-word",
     ...
   ]
 }
 ...

Or use it on the CLI directly

remark -u remark-lint -u remark-lint-spaces-around-word readme.md

Or use this on the API:

 var remark = require('remark');
 var report = require('vfile-reporter');

 remark()
   .use(require('remark-lint'))
+  .use(require('remark-lint-spaces-around-word'))
   .process('_Emphasis_ and **importance**', function (err, file) {
     console.error(report(err || file));
   });

License

MIT © LaySent