-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
doc: use .md extension for internal links #35191
Conversation
Review requested:
|
00dc849
to
53a8ef3
Compare
5c545c2
to
a9ad531
Compare
Yikes, there are already conflicts… I'll resolve them as soon as I have a moment. @DerekNonGeneric, would you kindly ping @nodejs/documentation as well? Their input would be valuable given the size of the change. |
Oh hmm, the bot should have done that. Wish we had that awaiting feedback label that was proposed recently. /cc @nodejs/documentation |
@aduh95 You need to rebase. |
a9ad531
to
8d27d13
Compare
Since my changes caused the conflicts, I resolved them and force-pushed. |
If the bot pinged the documentation team on changes to doc files, they'd probably be pinged on around half of the PRs in the repo. (Same for the testing team.) Since the auto-pinging is a new thing, I'm guessing the idea has been to roll it out slowly and not overwhelm large-ish teams with pings. |
3c37b95
to
0677bbd
Compare
93ae3d2
to
ccbda32
Compare
Rebased and split into 3 commits because #35224 landed before this one. PTAL |
45e287d
to
c8d000b
Compare
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.
This looks good overall. I just have a couple of questions.
}; | ||
|
||
function replaceLinks({ filename, linksMapper }) { | ||
return (tree) => { | ||
const fileHtmlUrls = linksMapper[filename]; | ||
|
||
visit(tree, (node) => { |
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 you link to this API's docs?
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 have just copied the code below, I haven't used the API docs nor do I know where to find it.
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.
From what I was able to find out, unist-util-visit uses the Universal Syntax Tree.
@wooorm might be able to clue us in on whether there are additional learning resources, but so far this code seems to be fully functional to me. It would be nice to get a better understanding of how this works though.
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.
readme for unist-util-visit(-parents) should have enough info. There are also some recipes on the website of unified.
@@ -0,0 +1,47 @@ | |||
'use strict'; |
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.
What's the command you ran to make this test run?
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.
make test-doc
Line 606 in 7390098
$(PYTHON) tools/test.py $(PARALLEL_ARGS) doctool; \ |
const gtocMD = fs.readFileSync(gtocPath, 'utf8').replace(/^<!--.*?-->/gms, ''); | ||
const gtocMD = fs.readFileSync(gtocPath, 'utf8') | ||
.replace(/\(([^#?]+?)\.md\)/ig, (_, filename) => `(${filename}.html)`) | ||
.replace(/^<!--.*?-->/gms, ''); |
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.
Do you recall what this replacement was for?
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.
To remove HTML comments it seems. I haven't looked into it though.
}; | ||
|
||
function replaceLinks({ filename, linksMapper }) { | ||
return (tree) => { | ||
const fileHtmlUrls = linksMapper[filename]; | ||
|
||
visit(tree, (node) => { | ||
if (node.url) { |
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 would like to know what this data structure looks like.
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.
Here's the result of a console.log(node)
here:
{
type: 'link',
title: null,
url: '#cli_diagnostic_dir_directory',
children: [ { type: 'text', value: '--diagnostic-dir', position: [Position] } ],
position: Position {
start: { line: 131, column: 1, offset: 3405 },
end: { line: 131, column: 50, offset: 3454 },
indent: []
}
}
6388632
to
844ed1b
Compare
Rebased to solve conflict. If everyone is happy with the current code, I'd like to have it landed before other conflicts arise. @DerekNonGeneric my understanding is that none of your comments are blocking, is that right? |
844ed1b
to
4605a10
Compare
This helps catch broken links as part of the test suite. This also improves the user experience when browsing the markdown files. PR-URL: nodejs#35191 Fixes: nodejs#35189 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Refs: nodejs#35244 PR-URL: nodejs#35191 Fixes: nodejs#35189 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Fixes: nodejs#35189 PR-URL: nodejs#35191 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
4605a10
to
91837e9
Compare
Landed in 726143e...91837e9 |
This helps catch broken links as part of the test suite. This also improves the user experience when browsing the markdown files. PR-URL: #35191 Fixes: #35189 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This helps catch broken links as part of the test suite. This also improves the user experience when browsing the markdown files. PR-URL: nodejs#35191 Fixes: nodejs#35189 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Refs: nodejs#35244 PR-URL: nodejs#35191 Fixes: nodejs#35189 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Fixes: nodejs#35189 PR-URL: nodejs#35191 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This helps catch broken links as part of the test suite. This also
improves the user experience when browsing the markdown files.
Fixes: #35189
This is currently blocked by #35182.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes