-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from gruntwork-io/yori-markdown-link-check
Markdown link check
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# OSX GUI apps do not pick up environment variables the same way as Terminal apps and there are no easy solutions, | ||
# especially as Apple changes the GUI app behavior every release (see https://stackoverflow.com/q/135688/483528). As a | ||
# workaround to allow GitHub Desktop to work, add this (hopefully harmless) setting here. | ||
export PATH=$PATH:/usr/local/bin | ||
|
||
if ! command -v markdown-link-check; then | ||
>&2 echo "markdown-link-check is not available on this system." | ||
>&2 echo "Please install it by running 'npm install -g markdown-link-check'" | ||
exit 1 | ||
fi | ||
|
||
# This is the recommended way to set the project root for properly resolving absolute paths. See | ||
# https://github.com/tcort/markdown-link-check/issues/16 for more info. | ||
TMP_CONFIG="$(mktemp)" | ||
cat > "$TMP_CONFIG" <<EOF | ||
{ | ||
"replacementPatterns": [ | ||
{ | ||
"pattern": "^/", | ||
"replacement": "file://$(pwd)/" | ||
} | ||
] | ||
} | ||
EOF | ||
|
||
for file in "$@"; do | ||
markdown-link-check -c "$TMP_CONFIG" "$file" | ||
done |