From ae8c743ced00c03ab4aa63f23f9b36460d433e84 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 18 Jul 2021 06:59:55 -0700 Subject: [PATCH] tools: make internal link checker more robust The internal link checker was missing some broken links because it was being too restrictive about the characters it accepted as part of a link hash. Accept anything that isn't a terminating quotation mark. Refs: https://github.com/nodejs/node/pull/39426 Refs: https://github.com/nodejs/node/pull/39425 --- doc/api/http.md | 2 +- tools/doc/allhtml.mjs | 4 ++-- tools/doc/type-parser.mjs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index 84e98f5ff79d1e..a3e68aee4c6978 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -3183,7 +3183,7 @@ try { [`net.Socket`]: net.md#net_class_net_socket [`net.createConnection()`]: net.md#net_net_createconnection_options_connectlistener [`new URL()`]: url.md#url_new_url_input_base -[`outgoingMessage.socket`]: #http_outgoingMessage.socket +[`outgoingMessage.socket`]: #http_outgoingmessage_socket [`removeHeader(name)`]: #http_request_removeheader_name [`request.destroy()`]: #http_request_destroy_error [`request.end()`]: #http_request_end_data_encoding_callback diff --git a/tools/doc/allhtml.mjs b/tools/doc/allhtml.mjs index 54a51dd6316010..905ea5d3dd6c6f 100644 --- a/tools/doc/allhtml.mjs +++ b/tools/doc/allhtml.mjs @@ -76,13 +76,13 @@ fs.writeFileSync(new URL('./all.html', source), all, 'utf8'); // Validate all hrefs have a target. const ids = new Set(); -const idRe = / id="(\w+)"/g; +const idRe = / id="([^"]+)"/g; let match; while (match = idRe.exec(all)) { ids.add(match[1]); } -const hrefRe = / href="#(\w+)"/g; +const hrefRe = / href="#([^"]+)"/g; while (match = hrefRe.exec(all)) { if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`); } diff --git a/tools/doc/type-parser.mjs b/tools/doc/type-parser.mjs index 660a33e840466d..481a35ca330c80 100644 --- a/tools/doc/type-parser.mjs +++ b/tools/doc/type-parser.mjs @@ -97,7 +97,7 @@ const customTypesMap = { 'EcKeyImportParams': 'webcrypto.html#webcrypto_class_eckeyimportparams', 'HmacImportParams': 'webcrypto.html#webcrypto_class_hmacimportparams', 'AesImportParams': 'webcrypto.html#webcrypto_class_aesimportparams', - 'Pbkdf2ImportParams': 'webcrypto.html#webcrypto_class.pbkdf2importparams', + 'Pbkdf2ImportParams': 'webcrypto.html#webcrypto_class_pbkdf2importparams', 'HmacParams': 'webcrypto.html#webcrypto_class_hmacparams', 'EcdsaParams': 'webcrypto.html#webcrypto_class_ecdsaparams', 'RsaPssParams': 'webcrypto.html#webcrypto_class_rsapssparams',