DavidAnson / vscode-markdownlint

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

Document how to ignore linting without deprecated `markdownlint.ignore` #337

Closed pbodnar closed 2 months ago

pbodnar commented 2 months ago

"markdownlint.ignore" got deprecated in version 0.55 (see https://github.com/DavidAnson/vscode-markdownlint/commit/dce78f9ce714e8538f50d519aa51fd16af89eeba). Can you please add a corresponding documentation of how to exclude files from linting via other means. There is just this:

"markdownlint.ignore": {
    "description": "Array or file of glob expressions to ignore when linting",
    "deprecationMessage": "Deprecated, use .markdownlint-cli2.{jsonc,yaml,cjs,mjs} and set 'gitignore' or 'ignores'",

This doesn't help much to a regular user (like me) - it is not clear what to set and where.

DavidAnson commented 2 months ago

Direct link: https://github.com/DavidAnson/markdownlint-cli2?tab=readme-ov-file#configuration

For the most part, I try not to duplicate documentation at the extension level, so for things like this I want people to look at the underlying source.

I will be removing that extension configuration entirely in the next release.

pbodnar commented 2 months ago

@DavidAnson, thanks for your response - the information really is there in the READMEs of the projects.

Yet, I would have another question: While creating e.g. .markdownlint-cli2.yaml in a project folder does work, it seems impossible to have it defined globally (as discussed at #279), which I think is a bit unfortunate and seems to be contrary to what is written in the README of this project:

Note: When no folder is open, configuration and options are loaded from the user's home directory (e.g., %USERPROFILE% on Windows or $HOME on macOS/Linux). Because JavaScript code is cached after being loaded, edits to .markdownlint.cjs/.markdownlint.mjs/.markdownlint-cli2.cjs/.markdownlint-cli2.mjs require a restart of VS Code.

Note that I have even intentionally tried with not having any folder/workspace open in VS Code, yet the files in my user home got ignored when editing a .md file.

Here is a sample .markdownlint-cli2.yaml which is honored when in a project folder, but not when in my user home:

ignores:
  - "**/README.md"
config:
  "MD013": true
DavidAnson commented 2 months ago

From what I can tell on my phone right now, that behavior changed in 2021 as part of the move to VS Code's file system wrapper. All file system access should go through that (it's necessary for remote scenarios) and the wrapper may not have access to the user's home directory. I'll need to experiment to see if this could be made to work opportunistically.

DavidAnson commented 2 months ago

Closing this issue as the original documentation topic was addressed. I've updated the README for the second issue raised to clarify the current (since 2021) behavior of the extension.