From 812570799d3db3c94bb0484ebac349d83baab2d0 Mon Sep 17 00:00:00 2001 From: Howard Edwards Date: Mon, 25 Sep 2023 09:28:23 -0500 Subject: [PATCH] Check if any of the known page ids include the hash being checked for --- scripts/link-checker.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/link-checker.js b/scripts/link-checker.js index 2cf249d217..001149f9ad 100644 --- a/scripts/link-checker.js +++ b/scripts/link-checker.js @@ -227,7 +227,7 @@ async function checkLinks() { let matchesHash = true; if (hash) { - matchesHash = !!matchingPage?.ids.includes(hash); + matchesHash = !!matchingPage?.ids.some((id) => id.includes(hash)); } const isLinkBroken = !( @@ -274,7 +274,11 @@ async function checkLinks() { hrefOrSrc.match(pattern) ); - if (!isHashCheckingDisabled && hash && !pageData.ids.includes(hash)) { + if ( + !isHashCheckingDisabled && + hash && + !pageData.ids.some((id) => id.includes(hash)) + ) { consoleError( `Found broken external link on ${htmlPath}:${lineNumber}:${columnNumber}, ` + 'hash not found on page'