-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools: validate apidoc links #21889
tools: validate apidoc links #21889
Conversation
tools/doc/allhtml.js
Outdated
@@ -73,3 +73,13 @@ all = all.slice(0, apiStart.index + apiStart[0].length) + | |||
|
|||
// Write results. | |||
fs.writeFileSync(source + '/all.html', all, 'utf8'); | |||
|
|||
// Validate all hrefs have a target | |||
const ids = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a Set
for this? I think that might be a tad more natural 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but agreed on using a Set
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Glad to see this automated.
tools/doc/allhtml.js
Outdated
@@ -73,3 +73,13 @@ all = all.slice(0, apiStart.index + apiStart[0].length) + | |||
|
|||
// Write results. | |||
fs.writeFileSync(source + '/all.html', all, 'utf8'); | |||
|
|||
// Validate all hrefs have a target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: a period in the end.
This comment has been minimized.
This comment has been minimized.
Ignorable nit: not sure if this |
Just wanted to say thank you – this is super awesome ❤️ |
tools/doc/allhtml.js
Outdated
|
||
const href_re = / href="#(\w+)"/g; | ||
while (match = href_re.exec(all)) { | ||
if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think efficiency is a concern here... it will only be retrieved twice at most one time per run, and only if an error is thrown.
This comment has been minimized.
This comment has been minimized.
tools/doc/allhtml.js
Outdated
|
||
// Validate all hrefs have a target. | ||
const ids = new Set(); | ||
const id_re = / id="(\w+)"/g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can we use camel case?
PR-URL: #21889 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Landed in 78039b5 |
PR-URL: #21889 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]>
When an API signature changes, it may break a link made to it in another part of the documentation. As a part of the generation of
all.html
, check all such links to make sure that they have a valid target.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes