fix: strip broken links from generated API docs#602
Conversation
Address 2,235 broken links (1.46% of all local links) found by the link checker. The problems are systematic TypeDoc artifacts: - Remove cross-library module augmentation blocks in preprocessing so TypeDoc generates content in the canonical library (e.g. sap/tnt/library in sap.tnt, not sap.f) — fixes 40 broken links - Strip <a> tags pointing to ClassInfo type alias (no useful page) — 1,677 - Strip links to jQuery/QUnit types (correctly excluded pages) — ~265 - Strip links to pseudo-types int/float (UI5 aliases for number) — 93 - Strip links with nested namespaces/ segments (dead TypeDoc paths) — ~50 - Remove TypeDoc 'References' section from library READMEs — ~88 - Prune README list entries whose target page was not generated — ~38
There was a problem hiding this comment.
Pull request overview
This PR updates the API docs generation pipeline to remove or rewrite systematic TypeDoc-generated link targets that are known to be dead, reducing broken-link noise in the published HTML output.
Changes:
- Preprocess
.d.tsinputs to remove cross-library module augmentation blocks so TypeDoc generates content in the canonical library. - Post-process rendered HTML to strip anchors that point to known-dead TypeDoc targets (e.g.
ClassInfo, jQuery/QUnit,int/float, nested namespaces) and to remove the “References” section. - Post-process output to prune README list entries whose targets were not generated.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/generate-api-docs/generate.mjs | Adds .d.ts augmentation stripping and multiple HTML/README post-processing steps to eliminate broken links in generated API docs. |
| .changeset/fix-apidoc-broken-links.md | Adds an empty changeset to satisfy required checks without bumping packages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Guard against missing opening brace in augmentation removal (indexOf returning -1 would corrupt the file) - Fix References section regex: htmlFixed is raw content before template wrapping, so <footer> lookahead never matched; strip to end of string
- namespaces/JQuery[./] matches both .html and /subpath variants - Add interfaces/JQuery, /JQueryStatic, JQueryPromise patterns to strip links to pages excluded by EXCLUDE_PATTERNS - namespaces/QUnit[./] covers QUnit.html as well as subpages
…emoval The brace-depth parser that finds the end of a declare module block now skips // line comments, /* block comments */ (including JSDoc), and double-quoted string literals. This prevents unbalanced braces inside JSDoc (e.g. @example code with object literals) from causing incorrect block boundaries.
|
Initial run https://github.com/UI5/typescript/actions/runs/27960044085 should abort as the version already exists, removing the .version file now... |
|
https://github.com/UI5/typescript/actions/runs/27960529357 |
|
@codeworrior according to local html tree scan, we are down from 1931 broken to 26 broken in the openui5/1.149 subfolder. |
Address 2,235 broken links (1.46% of all local links) found by the link checker. The problems are systematic TypeDoc artifacts: