用於檢查中文 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 filesOptions: -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-md README.md Document.md
lint-md README.md Document.md --fix
import { lint, fix, getDescription } from 'lint-md';// get the markdown 's style errorsconst errors = lint(markdown, rules);// get the error type descriptionconst describe = getDescription(type[, lang = 'en_US']);// fix the markdownconst fixed = fix(markdown);
lint(markdown, rules):通過 API 方式來校驗 markdown 文本;
fix(markdown):通過 API 方式來修復文本;
getDescription(type):獲取錯誤類型的文本描述,包含多語言;
version:獲得模塊的版本號;
MIT@hustcc.