@@ -5,13 +5,14 @@ PWD := $(shell pwd)
5
5
# Determine OS & Arch for specific OS only tools on Unix based systems
6
6
OS := $(shell uname | tr '[:upper:]' '[:lower:]')
7
7
ifeq ($(OS ) ,darwin)
8
- SED : = gsed
8
+ SED ? = gsed
9
9
else
10
- SED : = sed
10
+ SED ? = sed
11
11
endif
12
12
13
13
TOOLS_DIR := $(PWD ) /internal/tools
14
14
15
+ MARKDOWN_LINK_CHECK_ARG = # pass extra arguments such as --exclude '^http'
15
16
MISSPELL_BINARY=bin/misspell
16
17
MISSPELL = $(TOOLS_DIR ) /$(MISSPELL_BINARY )
17
18
@@ -66,14 +67,27 @@ misspell: $(MISSPELL)
66
67
misspell-correction : $(MISSPELL )
67
68
$(MISSPELL ) -w $(ALL_DOCS )
68
69
70
+ .PHONY : normalized-link-check
71
+ # NOTE: we check `model/[a-z]*` to avoid `model/README.md`, which contains
72
+ # valid occurrences of `../docs/`.
73
+ normalized-link-check :
74
+ @if grep -R ' \.\./docs/' docs model/[a-z]* ; then \
75
+ echo " \nERROR: Found occurrences of '../docs/'; see above." ; \
76
+ echo " Remove the '../docs/' from doc page links referencing doc pages." ; \
77
+ exit 1; \
78
+ else \
79
+ echo " Normalized-link check passed." ; \
80
+ fi
81
+
69
82
.PHONY : markdown-link-check
70
- markdown-link-check :
83
+ markdown-link-check : normalized-link-check
71
84
docker run --rm \
72
85
--mount ' type=bind,source=$(PWD),target=/home/repo' \
73
86
lycheeverse/lychee \
74
87
--config home/repo/.lychee.toml \
75
88
--root-dir /home/repo \
76
89
--verbose \
90
+ $(MARKDOWN_LINK_CHECK_ARG ) \
77
91
home/repo
78
92
79
93
.PHONY : markdown-link-check-changelog-preview
0 commit comments