markdownlint 预提交错误地删除了快捷方式链接

问题描述 投票:0回答:1

背景

使用 mkdocs markdown 语法创建信息框 - 以及快捷方式链接:

test.md

??? infobox "example"

    example shortcut link --> [Buuntu/fastapi-react]

[Buuntu/fastapi-react]: https://github.com/Buuntu/fastapi-react

通过 pre-commit(详情如下)执行 markdownlint,链接将被删除,结果是:

test.md

??? infobox "example"

    example shortcut link --> [Buuntu/fastapi-react]

我尝试修改MD053,但它似乎没有做任何事情...所以我显然在规则定义中遗漏了一些东西

问题:哪个规则造成了这种不需要的更改?

实施

.markdownlint.jsonc

{
  "default": true,
  "MD003": { "style": "atx" },
  "MD007": { "indent": 4 },
  "MD013": {
    "line_length": 80,
    "heading_line_length": 80,
    "code_block_line_length": 80,
    "code_blocks": true,
    "tables": true,
    "headings": true,
    "headers": true,
    "strict": false,
    "stern": false
  },

  "no-hard-tabs": false,
  "whitespace": false,
  "MD053": {                // <-- added rule modification
    "ignored_definitions":
      ["full", "collapsed", "shortcut"]
  }
}

.pre-commit-config.yaml

- repo: https://github.com/igorshubovych/markdownlint-cli
  rev: v0.32.2
  hooks:
  - id: markdownlint
    args:
    - --fix
    verbose: true
    entry: bash -c 'markdownlint "$@" || true' --
git markdown mkdocs
1个回答
0
投票

在 VSCode 的 settings.json 中,这对我有用:

    "markdownlint.config": {
        "link-image-reference-definitions": false,
    },

在 .markdownlint.yaml 中:

MD053: false

或者:

link-image-reference-definitions: false
© www.soinside.com 2019 - 2024. All rights reserved.