Skip to content

Commit

Permalink
add markdownlint-cli2 for linting markdown
Browse files Browse the repository at this point in the history
Signed-off-by: Tuomo Tanskanen <tuomo.tanskanen@est.tech>
  • Loading branch information
tuminoid committed Jan 24, 2024
1 parent fbcad1a commit a2099d1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Metal3 Ironic Client Container
==============================
# Metal3 Ironic Client Container

This repo contains the files needed to build a container image with the Ironic CLI utilities, which are useful for debugging via Ironic APIs.
This repo contains the files needed to build a container image with the Ironic
CLI utilities, which are useful for debugging via Ironic APIs.

Description
-----------
## Description

When updated, builds are automatically triggered on https://quay.io/repository/metal3-io/ironic-client
When updated, builds are automatically triggered on
[Quay](https://quay.io/repository/metal3-io/ironic-client).
20 changes: 20 additions & 0 deletions hack/markdownlint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +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
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-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c \
/workdir/hack/markdownlint.sh "$@"
fi

0 comments on commit a2099d1

Please sign in to comment.