@@ -51,11 +51,22 @@ function main() {
5151 ;;
5252 esac
5353
54- if [ -n " $files " ]; then
54+ specfiles=$( echo " $files " | grep ' ^specification/' ) || true
55+ otherfiles=$( echo " $files " | grep -v ' ^specification/' ) || true
56+
57+ if [ -n " $specfiles " ]; then
58+ if command -v markdownlint > /dev/null 2>&1 && ! is-arg-true " ${FORCE_USE_DOCKER:- false} " ; then
59+ files=" $specfiles " config=" specification/.markdownlint.json" run-markdownlint-natively
60+ else
61+ files=" $specfiles " config=" specification/.markdownlint.json" run-markdownlint-in-docker
62+ fi
63+ fi
64+
65+ if [ -n " $otherfiles " ]; then
5566 if command -v markdownlint > /dev/null 2>&1 && ! is-arg-true " ${FORCE_USE_DOCKER:- false} " ; then
56- files=" $files " run-markdownlint-natively
67+ files=" $otherfiles " config= " .markdownlint.jsonc " run-markdownlint-natively
5768 else
58- files=" $files " run-markdownlint-in-docker
69+ files=" $otherfiles " config= " .markdownlint.jsonc " run-markdownlint-in-docker
5970 fi
6071 fi
6172}
@@ -68,7 +79,7 @@ function run-markdownlint-natively() {
6879 # shellcheck disable=SC2086
6980 markdownlint \
7081 $files \
71- --config " $PWD /scripts/ config/markdownlint.yaml "
82+ --config " $config "
7283}
7384
7485# Run markdownlint in a Docker container.
@@ -86,7 +97,7 @@ function run-markdownlint-in-docker() {
8697 --volume " $PWD " :/workdir \
8798 " $image " \
8899 $files \
89- --config /workdir/scripts/ config/markdownlint.yaml
100+ --config " $ config"
90101}
91102
92103# ==============================================================================
0 commit comments