check-markdown.sh 1.0 KB

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. set -eo pipefail
  3. script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  4. cd "${script_path}/.."
  5. if [ -z "${MARKDOWN_CHECK_BINARY:-}" ] ; then
  6. if ! [ -d Build/lagom/ ] ; then
  7. echo "Directory Build/lagom/ does not exist. Skipping markdown check."
  8. exit 0
  9. fi
  10. if ! [ -r Build/lagom/bin/markdown-check ] ; then
  11. echo "Lagom executable markdown-check was not built. Skipping markdown check."
  12. echo "To enable this check, you may need to run './Meta/ladybird.sh build' first."
  13. exit 0
  14. fi
  15. MARKDOWN_CHECK_BINARY="Build/lagom/bin/markdown-check"
  16. fi
  17. if [ -z "$LADYBIRD_SOURCE_DIR" ] ; then
  18. LADYBIRD_SOURCE_DIR=$(pwd -P)
  19. export LADYBIRD_SOURCE_DIR
  20. fi
  21. # shellcheck disable=SC2086 # Word splitting is intentional here
  22. find AK Base Documentation Meta Tests Userland -path Tests/LibWeb/WPT/wpt -prune -o -type f -name '*.md' -print0 | xargs -0 "${MARKDOWN_CHECK_BINARY}" -b "${LADYBIRD_SOURCE_DIR}/Base" $EXTRA_MARKDOWN_CHECK_ARGS README.md CONTRIBUTING.md