-
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
TOC in details #36896
TOC in details #36896
Conversation
Also, we need to adjust the stylesheet to the new DOM structure. You should replace Lines 475 to 477 in 1a0c5d5
with #toc > ul {
margin-top: 1.5rem;
} |
This PR breaks the script that generates the Lines 34 to 37 in 1a0c5d5
to const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ id="apicontent">/.exec(data);
contents += data.slice(0, match.index)
.replace(/[\s\S]*?id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*(<ul>\s*)?/, '') and Line 62 in 1a0c5d5
to const tocStart = /<\w+ id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*/.exec(all); |
I'm confused, why do you want to revert? |
Would it help if I push myself the changes I'm suggesting to your branch to make the CI content? |
@mattiapontonio you actually can add several files in one PR; if you want to do so from GitHub web UI, you need to visit the file on your branch (https://github.com/mattiapontonio/node/blob/patch-1/tools/doc/allhtml.js), click edit, and commit on the same |
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 stand by my original comment – repeating "Table of content" is not great, and we should have the open
attribute so the TOC is not hidden by default.
You are going to need to update the allhtml.js
file as described in my above comment, and also update the style.css
before this can land.
@mattiapontonio are you closing this because you don't want to work on it anymore or did you get block in the process? I hope my comments didn't discourage you, I'm convinced this PR could greatly improve our docs, especially for people browsing them on mobile, and I'm eager to help you land it – if you need or want any help. |
@aduh95 |
No, you need to change at least three files. But why is that stopping you? You can modify as many files as you want in one PR by adding more commits to the branch. |
I'm from a smartphone... |
You can do that from the GitHub web CI. I just added a commit to your branch using my smartphone. Try to follow this link and click the edit button: https://github.com/mattiapontonio/node/blob/patch-1/tools/doc/allhtml.js |
Yes but i don't want to do that, i want to wrap the TOC in a Lets wait CI for this commit. |
What's the reason you don't want that? Do you think it would look worse or you just don't want to touch the other files because it's not easy to do from a smartphone? |
The second one. Side issue |
OK, so are you OK if I push those changes to your branch myself? I'm afraid that's the only way to get a green CI if you change this part of the HTML. |
Yes but please let me see the change (for learning). |
You mean you'd prefer without the /cc @nodejs/documentation what are your thoughts on this? |
See MDN for a preview (Jump to section). |
Yes |
It's ok for me to leave this |
I'd be fine with that too. I was thinking maybe we could add a tiny JS script that automatically removes the |
Landed in 2ba8728 |
What landed means? |
I think is better to be consistent between HTMLs |
@mattiapontonio your patch has been applied on the HEAD of the master branch instead of performing a merge commit because merges break our tooling. |
Weird. So it's not deployed. And It Will not be? I'm from a smartphone, i can only screeshot what I see here. I'm expecting something like this |
It will be part of the next release (well not the next one, because v15.6.0 cut off date has already passed, so the one after that), and then the docs on nodejs.org will be updated with your change. You may use the build artefact from GitHub CI to see the result already: https://github.com/nodejs/node/suites/1829898807/artifacts/35314688 |
Ok 👍 |
One small issue this creates is that the triangle symbol now means different things (or at least behaves differently) in nearby places in the page. It's different in the version picker drop-down than it is for the table of contents. We might want to think about modifying the version picker slightly. |
Should be intresting to see this deployed not in nodejs.org |
Where is the HTML of that? |
No, it's not a details tag. <a href="#">View another version <span>▼</span></a> |
Apparently not even ToC. |
Fixes: #36885
Note: small change made via GitHub UI without ant locale testing.