docs icon indicating copy to clipboard operation
docs copied to clipboard

Add Pre-commit of Markdownlint

Open Liyulingyue opened this issue 2 years ago • 7 comments

Motivation

Some displayed content of markdown pages are incorrect, such as https://www.paddlepaddle.org.cn/documentation/docs/en/develop/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.stft.html provided by @GreatV .

Solution

Add Markdownlint2 into pre-commit.

About markdownlint2

markdownlint2 is a Node.js style checker and lint tool for Markdown/CommonMark files. See https://github.com/DavidAnson/markdownlint for more details.

The rules of the checker are shown in https://github.com/DavidAnson/markdownlint/blob/main/README.md#rules--aliases

How to add it to pre-commit and pick rules

  1. Add the following codes in .pre-commit-config.yaml
-   repo: https://github.com/DavidAnson/markdownlint-cli2
    rev: v0.11.0
    hooks:
    -   id: markdownlint-cli2
        args: ["--fix", "--config .markdownlint.json"]
  1. enable the rules in .markdownlink.json
{
  "default": true,
  "MD013": false
}

In above, default sets all rules be True, but MD013 is enabled. If you wanna disable/enable a new rule, juet write the rule name and set the false/true in a new line.

Liyulingyue avatar Dec 06 '23 05:12 Liyulingyue

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6351.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html 预览工具的更多说明,请参考:飞桨文档预览工具

paddle-bot[bot] avatar Dec 06 '23 05:12 paddle-bot[bot]

之前的文档得批量处理一下

GreatV avatar Dec 06 '23 05:12 GreatV

之前的文档得批量处理一下

可以先评审一下这个工具要不要引入/doge

批处理的话,这个工具部分可以直接修复,部分可能还得手动处理。

Liyulingyue avatar Dec 06 '23 05:12 Liyulingyue

这个我之前用过,感觉不太好用。

GreatV avatar Dec 06 '23 05:12 GreatV

这个我之前用过,感觉不太好用。

不太好用是指绘漏改嘛?还是会错改

sunzhongkai588 avatar Dec 06 '23 07:12 sunzhongkai588

可以先评审一下这个工具要不要引入/doge

得挨个看看各个检查项是否有必要.. @SigureMo @ooooo-create 怎么看

sunzhongkai588 avatar Dec 06 '23 07:12 sunzhongkai588

ci 没有 Node.js 环境,如果有,不如直接 prettier

SigureMo avatar Dec 06 '23 10:12 SigureMo