textlint-rule-preset-zh-technical-writing 提供的适用于中文技术文档写作的 textlint 规则,用于检测文本中多余的空格。
本规则可被自动修复,可以向 textlint 传递 --fix
参数来自动修复文本中出现的错误。
已经 200% 了
哇浪,test sentence 喔!
本句没有空格,何来多余一说?
打 字 带 空 格
他说:“I don't speak English”
暂无。
如果你在使用本规则的过程中出现了误报,或者对本规则有任何疑问或者改进意见,欢迎提出 issue。
这是最简单的方法,参见 textlint-rule-preset-zh-technical-writing 的 README。
使用 npm 安装:
npm install -g textlint-rule-zh-core textlint-rule-zh-no-redundant-space-around-token
创建 entry.js
,名称任意:
const { withRules } = require('textlint-rule-zh-core');
const correctlyOrderedPairs = require('textlint-rule-zh-no-redundant-space-around-token');
// 这里 withRule(...) 的返回值就是你可以提供给 textlint 的 rule 对象
module.exports = withRules([correctlyOrderedPairs]);
运行 textlint:
textlint --rulesdir <entry.js所在的文件夹路径> [其他参数] <要lint的文件名>