中文 markdown 格式校验 lint-md v0.1.0,支持 --fix 参数

  

用于检查中文 markdown 编写格式规范的命令行工具,基于 AST 开发,且方便集成 ci;同时提供 API 方法调用。Cli tool to lint your markdown file for Chinese.

安装

npm i -g lint-md

使用

Usage: <lint-md> <files...> [options]

lint your markdown files

Options:
  -v, --version                  output the version number
  -c, --config [configure-file]  use the configure file, default .lintmdrc
  -f, --fix                      fix the errors automatically
  -h, --help                     output usage information
  • 校验 lint

lint-md README.md Document.md
  • 修复 fix

lint-md README.md Document.md --fix

API 调用

import { lint, fix, getDescription } from 'lint-md';

// get the markdown 's style errors
const errors = lint(markdown, rules);

// get the error type description
const describe = getDescription(type[, lang = 'en_US']);

// fix the markdown
const fixed = fix(markdown);
  • lint(markdown, rules):通过 API 方式来校验 markdown 文本;

  • fix(markdown):通过 API 方式来修复文本;

  • getDescription(type):获取错误类型的文本描述,包含多语言;

  • version:获得模块的版本号;

其他相关

  • vscode 插件:在 vscode 中使用 lint-md 工具。

  • 语雀 lint 服务:利用语雀的 webhook 自动校验提交的文档格式并做提醒。

    扫描二维码关注公众号,回复: 4717841 查看本文章

License

MIT@hustcc.

猜你喜欢

转载自www.oschina.net/news/103179/lint-md-0-1-0-released