Skip to content

Commit f8b02cd

Browse files
committed
fix: broaden dead-link stripping to cover plain-text links
The regex previously only matched <a> tags wrapping <code> content. Links from JSDoc {@link} references render as plain text and were missed — 26 broken links remained on openui5/1.149 after regeneration. Changes: - Widen the regex from (<code>[^<]+</code>) to ([\s\S]*?) so it catches any link content (plain text, code, or mixed). - Add pattern for namespaces/sap/README.html — the non-existent global sap namespace index page that some pages link to. All sap.ui.* global functions documented there are either deprecated or irrelevant for TypeScript users (sap.ui.define/require), so stripping these links is correct.
1 parent a81d8e8 commit f8b02cd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎scripts/generate-api-docs/generate.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,12 @@ function renderDir(dir) {
593593
);
594594

595595
// Strip links whose href points to dead targets (jQuery, QUnit, pseudo-types, nested namespaces)
596-
htmlFixed = htmlFixed.replace(/<a href="([^"]*)"[^>]*>(<code>[^<]+<\/code>)<\/a>/g, (match, href, content) => {
596+
htmlFixed = htmlFixed.replace(/<a href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/g, (match, href, content) => {
597597
if (DEAD_LINK_PATTERNS.some((p) => p.test(href))) return content;
598598
// Links with nested namespaces/ segments are always dead TypeDoc artifacts
599599
if ((href.match(/\/namespaces\//g) || []).length >= 2) return content;
600+
// Single namespaces/sap/README.html — the global namespace index that doesn't exist
601+
if (/\/namespaces\/sap\/README\.html$/.test(href)) return content;
600602
return match;
601603
});
602604

0 commit comments

Comments
 (0)