1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        lint-md中文 Markdown 編寫格式規(guī)范的命令行工具

        聯(lián)合創(chuàng)作 · 2023-09-30 14:33

        lint-md

        用于檢查中文 markdown 編寫格式規(guī)范的命令行工具,基于 AST 開發(fā),且方便集成 ci。Cli tool to lint your markdown file for Chinese.

        安裝

        npm i -g lint-md

        使用

        Usage:[options]
        
        lint your markdown files
        
        Options:
          -v, --version                  output the version number
          -c, --config [configure-file]  use the configure file, default .lintmdrc
          -h, --help                     output usage information

        Example:

        lint-md README.md Document.md

        檢查類型

        檢查規(guī)則來源于 chinese-document-style-guide.

        規(guī)則 詳細描述 解決辦法
        space-round-alphabet 中文與英文之間需要增加空格 對應提示的位置增加空格
        space-round-number 中文與數(shù)字之間需要增加空格 對應提示的位置增加空格
        no-empty-code-lang 代碼語言不能為空 在代碼塊語法上增加語言
        no-empty-url 鏈接和圖片地址不能為空 填寫完整的 url,或者不使用鏈接和圖片語法
        no-empty-list List 內(nèi)容不能為空 List 語法中,填寫內(nèi)容
        no-empty-code 代碼塊內(nèi)容不能為空 刪除空的代碼塊,或者填充代碼內(nèi)容
        no-empty-blockquote blockquote 內(nèi)容不能為空 刪除空的 blockquote,或者填充內(nèi)容
        no-special-characters 文本中不能有特殊字符 可能是復制出來的特殊字符,刪除特殊字符即可
        use-standard-ellipsis 使用標準規(guī)范的省略號 使用標準規(guī)范的省略號‘……’ / ‘...’
        no-fullwidth-number 不能用全角數(shù)字 注意輸入法切換為半角輸入

        目前僅僅檢查了比較通用的類型,歡迎 pull request,在 rules 中增加自己的規(guī)則,開發(fā)約束:

        • 規(guī)則主要針對于中文 markdown 的編寫規(guī)范

        • 使用類 babel plugin 的方式來進行規(guī)則檢查,一個插件對應一個規(guī)則

        • 規(guī)則名稱對應和插件文件名保持一致

        • 先提 issue 進行討論

        • AST 工具,使用其中的 markdown AST 輔助開發(fā)插件

        配置

        默認所有的規(guī)則都是 error 類型,但是可以通過配置來指定規(guī)則類型。示例 .lintmdrc :

        {
          "excludeFiles": [],
          "rules": {
            "no-empty-code": 1
          }
        }

        通過 rules 來配置規(guī)則的等級。

        • 0:ignore 忽略不檢查該規(guī)則

        • 1:warning 警告,但不阻斷 ci

        • 2:error 錯誤,且阻斷 ci

        通過 excludeFiles 來忽略文件和目錄,glob 語法。

        ci 集成

        • Travis

        在 .travis.yml 文件中配置以下內(nèi)容。

        language: node_js
        node_js:
          - "10"
        before_install:
          - npm i -g lint-md
        script: lint-md README.md
        • lint-stage

        在 package.json 中增加以下配置。

        "lint-staged": {
          "src/**/*.{md,markdown}": [
            "lind-md"
          ]
        }

        License

        MIT@hustcc.

        瀏覽 13
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            国产尤物一区二区三区 | 豆花视频在线观看视频 | 日韩电影一区二区三区三线免费观看 | 黑人大群体交免费视频 | 欧美日韩第一视频 | 久久久久久国产精品免费免费沈阳 | 日本少妇久久久 | 91精品丝袜国产高跟在线 | 观看三级电影 | 青草天堂 |