diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc index 26f1dd119..974ede20f 100644 --- a/.markdownlint-cli2.jsonc +++ b/.markdownlint-cli2.jsonc @@ -5,6 +5,10 @@ "MD041": false }, + "globs": [ + "**/*.md" + ], + "ignores": [ "doc/api/" ] diff --git a/tool/check_markdown_links.sh b/tool/check_markdown_links.sh new file mode 100755 index 000000000..e3505a075 --- /dev/null +++ b/tool/check_markdown_links.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Copyright (C) 2023 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause +# +# check_markdown_links.sh +# Check Markdown links. +# +# 2023 February 23 +# Author: Chykon + +set -euo pipefail + +config_file='.github/configs/mlc_config.json' +markdown_files=$(find . -path './doc/api' -prune -false -or -type f -name '*.md') + +echo "${markdown_files}" | xargs npx markdown-link-check --quiet --config ${config_file} diff --git a/tool/lint_markdown_files.sh b/tool/lint_markdown_files.sh new file mode 100755 index 000000000..89a7000e2 --- /dev/null +++ b/tool/lint_markdown_files.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Copyright (C) 2023 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause +# +# lint_markdown_files.sh +# Lint Markdown files. +# +# 2023 February 23 +# Author: Chykon + +set -euo pipefail + +npx markdownlint-cli2 diff --git a/tool/run_checks.sh b/tool/run_checks.sh index 5643e5296..f4c597aba 100755 --- a/tool/run_checks.sh +++ b/tool/run_checks.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2022 Intel Corporation +# Copyright (C) 2022-2023 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # # run_checks.sh @@ -8,7 +8,6 @@ # # 2022 October 11 # Author: Chykon -# set -euo pipefail @@ -31,6 +30,14 @@ trap trap_error ERR printf '\n%s\n' "${form_bold}${color_yellow}Running local checks...${text_reset}" +# Lint Markdown files +print_step 'Lint Markdown files' +tool/lint_markdown_files.sh + +# Check Markdown links +print_step 'Check Markdown links' +tool/check_markdown_links.sh + # Install project dependencies print_step 'Install project dependencies' tool/gh_actions/install_dependencies.sh