diff --git a/.github/config/.markdownlint-cli2.yaml b/.github/config/.markdownlint-cli2.yaml deleted file mode 100644 index 3b70078f11d4..000000000000 --- a/.github/config/.markdownlint-cli2.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md -# and https://github.com/DavidAnson/markdownlint-cli2 - -config: - ul-style: false - line-length: false - no-duplicate-heading: - siblings_only: true - ol-prefix: - style: ordered - no-inline-html: false - fenced-code-language: false - no-trailing-punctuation: - punctuation: ".,;:" # allowing exclamation points and question marks at end of sentences - -ignores: - - "**/build/**" - - "CHANGELOG.md" - - "licenses/licenses.md" diff --git a/.github/workflows/reusable-markdown-lint-check.yml b/.github/workflows/reusable-markdown-lint-check.yml index 7c60ede27731..2955fc11663c 100644 --- a/.github/workflows/reusable-markdown-lint-check.yml +++ b/.github/workflows/reusable-markdown-lint-check.yml @@ -12,6 +12,12 @@ jobs: steps: - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + - uses: jdx/mise-action@9dc7d5dd454262207dea3ab5a06a3df6afc8ff26 # v3.4.1 + - name: Run markdownlint run: | - npx markdownlint-cli2@0.17.1 --config .github/config/.markdownlint-cli2.yaml "**/*.md" + if ! mise run lint:markdown; then + echo "markdownlint failed. To auto-fix many issues locally, run:" + echo " mise run lint:markdown --fix" + exit 1 + fi diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 000000000000..fcc8d4d0a558 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,13 @@ +# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md +# and https://github.com/DavidAnson/markdownlint-cli2 + +ul-style: false +line-length: false +no-duplicate-heading: + siblings_only: true +ol-prefix: + style: ordered +no-inline-html: false +fenced-code-language: false +no-trailing-punctuation: + punctuation: ".,;:" # allowing exclamation points and question marks at end of sentences diff --git a/.mise/tasks/lint/markdown.sh b/.mise/tasks/lint/markdown.sh new file mode 100755 index 000000000000..95b7686488fd --- /dev/null +++ b/.mise/tasks/lint/markdown.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +#MISE description="Lint markdown files" +#MISE flag "--fix" help="Automatically fix issues" + +set -e + +if [ "${usage_fix}" = "true" ]; then + markdownlint-cli2 --fix "**/*.md" "#**/build" "#CHANGELOG.md" "#licenses/licenses.md" +else + markdownlint-cli2 "**/*.md" "#**/build" "#CHANGELOG.md" "#licenses/licenses.md" +fi diff --git a/mise.toml b/mise.toml index dd36de16dbfe..d4d921cbba00 100644 --- a/mise.toml +++ b/mise.toml @@ -1,5 +1,6 @@ [tools] lychee = "0.21.0" +markdownlint-cli2 = "0.17.1" [settings] # Only install tools explicitly defined in the [tools] section above