format-code: enable markdownlint

Enable markdownlint but allow it to always pass.  This will allow
maintainers the opportunity to run the tools and fix up their own
markdown before we enable this globally.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie397a72ca4ef113cdbe433d263ccf3bd5063cf4b
diff --git a/.markdownlint.yaml b/.markdownlint.yaml
new file mode 120000
index 0000000..56c55a2
--- /dev/null
+++ b/.markdownlint.yaml
@@ -0,0 +1 @@
+config/markdownlint.yaml
\ No newline at end of file
diff --git a/README.md b/README.md
index e77caf2..39900d0 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,3 @@
+# openbmc-build-scripts
+
 Build script for CI jobs in Jenkins.
diff --git a/config/markdownlint.yaml b/config/markdownlint.yaml
new file mode 100644
index 0000000..15c9e81
--- /dev/null
+++ b/config/markdownlint.yaml
@@ -0,0 +1,3 @@
+default: true
+MD024:
+    siblings_only: true
diff --git a/jenkins/README.md b/jenkins/README.md
index 89be34d..14cf4d3 100644
--- a/jenkins/README.md
+++ b/jenkins/README.md
@@ -1,3 +1,5 @@
+# Jenkins
+
 These are the top level scripts launched by the
 [OpenBMC Jenkins instance](https://jenkins.openbmc.org):
 
diff --git a/scripts/build-unit-test-docker b/scripts/build-unit-test-docker
index c7bb94a..c52fad4 100755
--- a/scripts/build-unit-test-docker
+++ b/scripts/build-unit-test-docker
@@ -859,6 +859,7 @@
 
 RUN npm install -g \
         eslint@latest eslint-plugin-json@latest \
+        markdownlint-cli@latest \
         prettier@latest
 """
 
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
index f6eaacc..9a1eb16 100755
--- a/scripts/format-code.sh
+++ b/scripts/format-code.sh
@@ -34,6 +34,7 @@
         eslint \
         flake8 \
         isort \
+        markdownlint \
         prettier \
         shellcheck \
     )
@@ -209,6 +210,16 @@
     isort --profile black "$@"
 }
 
+LINTER_REQUIRE+=([markdownlint]="markdownlint;.markdownlint.yaml;${CONFIG_PATH}/markdownlint.yaml")
+LINTER_IGNORE+=([markdownlint]=".markdownlint-ignore")
+LINTER_TYPES+=([markdownlint]="markdown")
+function do_markdownlint() {
+    markdownlint --config "${LINTER_CONFIG[markdownlint]}" \
+        --disable line-length -- "$@" || \
+        echo -e "    ${YELLOW}Failed markdownlint; temporarily ignoring."
+    # We disable line-length because prettier should handle prose wrap for us.
+}
+
 LINTER_REQUIRE+=([prettier]="prettier;.prettierrc.yaml;${CONFIG_PATH}/prettierrc.yaml")
 LINTER_IGNORE+=([prettier]=".prettierignore")
 LINTER_TYPES+=([prettier]="json;markdown;yaml")