From 3173060c3dff5179608a3242dbe22cf22af61a26 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Wed, 11 Jan 2023 14:01:15 +0000 Subject: [PATCH] Allow leading spaces for reference links Some of the sites that get pulled in use a mix of inline and reference links. Reference links are expected to have the format of the link reference name in brackets, starting at the beginning of the line, followed by a colon and then the linked target. Some of the external sites have been found to have some variation on this format though. While markdown references show the format as above, it does work when these link references have leading spacing before the opening bracket. This has caused [broken slack links](https://github.com/kubernetes/community/issues/6934), as one example. This change updates the regex for identifying these reference links in the get-content script to allow for leading spaces. Signed-off-by: Sean McGinnis --- hack/gen-content.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/gen-content.sh b/hack/gen-content.sh index 3fe2a103d..2973a6442 100755 --- a/hack/gen-content.sh +++ b/hack/gen-content.sh @@ -115,7 +115,7 @@ process_content() { fi mapfile -t ref_link_matches < \ - <(grep -o -i -P '^\[.+\]:\s*(?!mailto|\S+?@|<|>|\?|\!|@|#|\$|%|\^|&|\*)\K\S+$' "$1") + <(grep -o -i -P '^\s+\[.+\]:\s*(?!mailto|\S+?@|<|>|\?|\!|@|#|\$|%|\^|&|\*)\K\S+$' "$1") if [[ -v ref_link_matches ]]; then for match in "${ref_link_matches[@]}"; do