Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable some rules for glob pattern? #328

Closed
mgzenitech opened this issue Feb 23, 2024 · 4 comments
Closed

How to disable some rules for glob pattern? #328

mgzenitech opened this issue Feb 23, 2024 · 4 comments
Labels

Comments

@mgzenitech
Copy link

mgzenitech commented Feb 23, 2024

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
Copy link
Owner

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
Copy link
Author

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...

Repository owner deleted a comment from MOHAMMADALDREAI Mar 4, 2024
@DavidAnson
Copy link
Owner

This is a duplicate of DavidAnson/markdownlint#666

@DavidAnson DavidAnson closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
@MOHAMMADALDREAI
Copy link

Hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants