npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lintmd-tools

v0.1.5

Published

Cli tool to lint your markdown file for Chinese.

Downloads

1

Readme

@lint-md/cli

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

npm npm

安装

npm i -g @lint-md/cli

使用

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

检查类型

基于 lint-md,具体支持的检查类型,请到该项目查看。

配置

默认所有的规则都是 error 类型,但是可以通过配置来指定规则类型。示例 .lintmdrc

{
  "excludeFiles": [],
  "rules": {
    "no-empty-code": 1,
    "no-long-code": [
      2,
      {
        "length": 100,
        "exclude": [
          "dot"
        ]
      }
    ]
  }
}
  • 通过 rules 来配置规则。参考 lint-md 文档说明。
  • 通过 excludeFiles 来忽略文件和目录,glob 语法。

ci 集成

  • Travis

.travis.yml 文件中配置以下内容。

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

package.json 中增加以下配置。

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

基于 Docker

假设当前目录有一文件名为 README.md,可在本地使用以下命令:

docker run --rm -it -v$(pwd):/docs yuque/lint-md:cli /docs/README.md # 也可直接带其它参数

其中:

  • --rm 表示在运行完毕后直接销毁容器。
  • -it 表示交互式 TTY,你可以理解为进入容器终端。
  • -v$(pwd)/docs 表示将当前目录「挂载」至容器内部的 /docs 目录。

另外,在基于 Docker 的 CI/CD 平台上,也可使用 yuque/lint-md 镜像。例如 GitLab CI/CD:

lint:
  image: yuque/lint-md:cli
  script:
    - lint-md README.md # 或其它文件

Circle CI:

version: 2
jobs:
  lint:
    docker:
      - image: yuque/lint-md:cli
    steps:
      - checkout
      - run: lint-md README.md # 或其它文件

利用 Docker 作为 CI 的基础环境通常更有优势,不必每次构建都执行 yarn install;资源节省,速度也会更快些。

License

MIT@hustcc.