DavidAnson / vscode-markdownlint

Markdown linting and style checking for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
MIT License
930 stars 170 forks source link

How to disable some rules for glob pattern? #328

Closed mgzenitech closed 7 months ago

mgzenitech commented 7 months ago

So my situation is pretty simple. In one directory I have:

README.md
README.0.md
README.1.md
README.2.md

Basically what happens is that there's a script that combines all of the .*.md files into README.md.

This is my current config in settings.json:

{
  "[markdown]": {
    "editor.tabSize": 4
  },
  "markdownlint.config": {
    "MD003": {
      "style": "atx"
    },
    "MD004": {
      "style": "asterisk"
    },
    "MD007": {
      "indent": 4
    },
    "MD009": {
      "strict": true
    },
    "MD010": {
      "spaces_per_tab": 4
    },
    "MD013": {
      "code_block_line_length": 120,
      "heading_line_length": 120,
      "line_length": 120,
      "stern": true
    },
    "MD029": {
      "style": "one"
    },
    "MD033": {
      "allowed_elements": [
        "br"
      ]
    },
    "MD035": {
      "style": "---"
    },
    "MD043": false,
    "MD044": {
      "code_blocks": false,
      "names": [
        "Bash",
        "DevOps",
        "JSON",
        "Oh-My-Posh",
        "OSS",
        "PATH",
        "Poetry",
        "Pyenv",
        "Python",
        "README",
        "Visual Studio Code",
        "VSCode Marketplace",
        "VSCode",
        "VSCodium",
        "Zenitech"
      ]
    },
    "MD045": false,
    "MD046": {
      "style": "fenced"
    },
    "MD048": {
      "style": "backtick"
    },
    "MD049": {
      "style": "asterisk"
    },
    "MD050": {
      "style": "asterisk"
    },
    "MD054": {
      "autolink": false,
      "collapsed": false,
      "full": false,
      "shortcut": false
    },
    "MD055": {
      "style": "leading_and_trailing"
    }
  }
}

How would I setup config here to disable MD041 only for README.*.md files?

DavidAnson commented 7 months ago

I would suggest putting the following at the bottom of each of the numbered files: <!-- markdownlint-disable-file MD041 --> And remove that line in the script that merges them.

If you don't want to make changes during the merge, put markdownlint-disable comments at the top of each numbered file. It doesn't matter if that ends up in the final version because MD041 looks at the top of the document and these comments only apply to the lines that follow.

mgzenitech commented 7 months ago

I would suggest putting the following at the bottom of each of the numbered files: <!-- markdownlint-disable-file MD041 --> And remove that line in the script that merges them.

If you don't want to make changes during the merge, put markdownlint-disable comments at the top of each numbered file. It doesn't matter if that ends up in the final version because MD041 looks at the top of the document and these comments only apply to the lines that follow.

Would it be possible to expose it via config file or directly in settings.json?

It is just an example, potentially there can be a lot of files added by multiple people. Now if there's no setting in config then it means all of them will have to be informed when creating these files. It would be way better if I could just set it in vscode so that anyone loading the project would be able to just kick start doing things...

DavidAnson commented 7 months ago

This is a duplicate of https://github.com/DavidAnson/markdownlint/issues/666

MOHAMMADALDREAI commented 5 months ago

Hi