markdown-lint
markdown-lint copied to clipboard
Switch from markdownlint-cli to markdownlint-cli2
Is your feature request related to a problem?
markdown-lint supports configuration files per directory.
Example:
root directory
default: true
MD013: false
sub directory docs/decisions
default: true
MD013: false
MD024: false
When running on such a repository and a file in docs/decisions violates MD024, markdown-cli reports an error:
$ npx markdownlint-cli '**/*.md' --ignore node_modules
docs/decisions/0010-support-categories.md:103 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "#### Examples"]
docs/decisions/0015-include-consulting-informed-of-raci.md:32 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Include "Consulted" and "I..."]
Since this action is based on markdownlint-cli, it does not support multiple markdownlint configuration files - and thus also reports errors.
When running markdown-cli2, no error is reported:
$ npx markdownlint-cli2 "**/*.md" "#node_modules"
markdownlint-cli2 v0.4.0 (markdownlint v0.25.1)
Finding: **/*.md !node_modules
Linting: 31 file(s)
Summary: 0 error(s)
Describe the solution you'd like
Change from markdownlint-cli to markdown-cli2.
Additional context
Blog post on markdownlint-cli2: https://dlaa.me/blog/post/markdownlintcli2
I drafted a PR at https://github.com/koppor/markdown-lint/pull/1. Will create a PR to this repository as soon as upstream issues are fixed.
@koppor
I apologize for the long answer.
Did I understand you correctly.
In this issue, you suggest switching to the official image davidanson/markdownlint-cli2
Now the check will go through the configuration file inside the checked directory.
For example:
src/
├─ docs/
│ └─ api/
│ ├─ changelog.yaml
│ ├─ README.md
│ ├─ API.md
│ ├─ UPDATES.md
│ └─ version2/
│ ├─ changelog.yaml
│ ├─ VERSION_2.md
│ └─ TO_UPDATE/
│ └─ UPDATES_V2.md
├─ changelog.yaml
└─ CHANGELOG.md
Directory /src
CHANGELOG.mduses./src/changelog.yaml
Directory /src/docs/api
README.mduses./src/docs/api/changelog.yamlAPI.mduses./src/docs/api/changelog.yamlUPDATES.mduses./src/docs/api/changelog.yaml
Directory /src/docs/api/version2
VERSION_2.mduses./src/docs/api/version2/changelog.yaml
Directory /src/docs/api/version2/TO_UPDATE
UPDATES_V2.mduses./src/docs/api/version2/changelog.yaml
@eldario Partially. The configuration file is .markdownlint.yaml if not configured differently. Thus, directory /src/docs/api/version2/TO_UPDATE tries to read src/docs/api/version2/TO_UPDATE/.markdownlint.yaml. If that does not exist, it tries to read src/docs/api/version2/markdownlint.yaml.
I still need to work on https://github.com/DavidAnson/markdownlint-cli2/issues/49 and https://github.com/DavidAnson/markdownlint-cli2/issues/50 to be able to get markdownlint-cli2 running "properly" with this custom CHANGELOG configurations. In my draft-PR, I need to copy configurations files back and forth. E.g., https://github.com/koppor/markdown-lint/blob/c2a97fcebfb4d65d83ffc2be13fb6f6d76675d0a/.github/workflows/ci.yml#L31
@koppor @eldario shall we close this issue?
You can close this issue. The work-around is to use this action for validating CHANGELOG.md files and markdownlint-cli2-action for validating all other Markdown files.