From d3580edf96d654b03a6c6d9ba9c859e2d0678dd4 Mon Sep 17 00:00:00 2001 From: Tuomo Tanskanen Date: Wed, 24 Jan 2024 13:25:06 +0200 Subject: [PATCH] switch markdownlint container to markdownlint-cli2 Signed-off-by: Tuomo Tanskanen --- .markdownlint-cli2.yaml | 9 +++++++++ hack/markdownlint.sh | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .markdownlint-cli2.yaml diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..7811fc6 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,9 @@ +# Reference: https://github.com/DavidAnson/markdownlint-cli2#markdownlint-cli2yaml + +config: + ul-indent: + # Kramdown wanted us to have 3 earlier, tho this CLI recommends 2 or 4 + indent: 3 + +# Don't autofix anything, we're linting here +fix: false diff --git a/hack/markdownlint.sh b/hack/markdownlint.sh index c8c5b5c..5258d27 100755 --- a/hack/markdownlint.sh +++ b/hack/markdownlint.sh @@ -1,19 +1,20 @@ #!/bin/sh +# markdownlint-cli2 has config file(s) named .markdownlint-cli2.yaml in the repo set -eux IS_CONTAINER="${IS_CONTAINER:-false}" CONTAINER_RUNTIME="${CONTAINER_RUNTIME:-podman}" +# all md files, but ignore .github if [ "${IS_CONTAINER}" != "false" ]; then - TOP_DIR="${1:-.}" - find "${TOP_DIR}" -type d \( -path ./vendor -o -path ./.github \) -prune -o -name '*.md' -exec mdl --style all --warnings {} \+ + markdownlint-cli2 "**/*.md" "#.github" else "${CONTAINER_RUNTIME}" run --rm \ --env IS_CONTAINER=TRUE \ --volume "${PWD}:/workdir:ro,z" \ --entrypoint sh \ --workdir /workdir \ - docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 \ + docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c \ /workdir/hack/markdownlint.sh "$@" fi