GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TOC in details · Pull Request #36896 · nodejs/node

Conversation

@ghost

@ghost ghost commented Jan 12, 2021 •
edited by aduh95
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Fixes: #36885

Note: small change made via GitHub UI without ant locale testing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to Node.js documentation. label Jan 12, 2021
aduh95
aduh95 reviewed Jan 12, 2021
View reviewed changes
Comment thread doc/template.html Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 12, 2021

Copy link
Copy Markdown
Contributor

Also, we need to adjust the stylesheet to the new DOM structure. You should replace

node/doc/api_assets/style.css

Lines 475 to 477 in 1a0c5d5

#toc h2 {
margin: 1.5rem 0;
}

with

#toc > ul {
  margin-top: 1.5rem;
}
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 12, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR breaks the script that generates the all.html page. I'm suggesting changing

node/tools/doc/allhtml.js

Lines 34 to 37 in 1a0c5d5

const match = /(<\/ul>\s*)?<\/div>\s*<div id="apicontent">/.exec(data);
contents += data.slice(0, match.index)
.replace(/[\s\S]*?<div id="toc">\s*<h2>.*?<\/h2>\s*(<ul>\s*)?/, '');

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

node/tools/doc/allhtml.js

Line 62 in 1a0c5d5

const tocStart = /<div id="toc">\s*<h2>.*?<\/h2>\s*/.exec(all);

to

const tocStart = /<\w+ id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*/.exec(all);
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 12, 2021

Copy link
Copy Markdown
Contributor

Keep Calm. Lets revert last One first.

I'm confused, why do you want to revert?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 12, 2021

Copy link
Copy Markdown
Contributor

Would it help if I push myself the changes I'm suggesting to your branch to make the CI content?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Jan 12, 2021
View reviewed changes
@aduh95

aduh95 commented Jan 12, 2021

Copy link
Copy Markdown
Contributor

@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 patch-1 branch.
Don't worry about the number of commits in the branch either, our policy is to squash all of them in one commit when merging; and in order to merge a PR the last commit must have a green CI, it doesn't matter if there are red CI commits in the middle.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 requested changes Jan 12, 2021
View reviewed changes

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ghost ghost closed this Jan 13, 2021
@aduh95

aduh95 commented Jan 13, 2021

Copy link
Copy Markdown
Contributor

@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.

gireeshpunathil reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost reopened this Jan 13, 2021
@ghost ghost closed this Jan 13, 2021
@ghost
ghost deleted the patch-1 branch January 13, 2021 11:13
@ghost

ghost commented Jan 13, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

@mattiapontonio I hope my comments didn't discourage you

@aduh95
But can you do this fix by touching only one file?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost
ghost restored the patch-1 branch January 13, 2021 11:24
@ghost ghost reopened this Jan 13, 2021
@ghost
ghost requested a review from aduh95 January 13, 2021 11:24
@aduh95

aduh95 commented Jan 13, 2021

Copy link
Copy Markdown
Contributor

But can you do this fix by touching only one file?

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 13, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

I'm from a smartphone...
That's why i opened the issue.
The first CI passed... It was a straight to the point edit, a simple wrapping...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 13, 2021

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 13, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

Yes but i don't want to do that, i want to wrap the TOC in a details...

Lets wait CI for this commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 13, 2021

Copy link
Copy Markdown
Contributor

Yes but i don't want to do that, i want to wrap the TOC in a details...

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 13, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

The second one.

Side issue
Markdown should support <select /> and <input type=radio>.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 13, 2021

Copy link
Copy Markdown
Contributor

The second one

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 13, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

Yes but please let me see the change (for learning).
If You can merge merge no problem.
Keep the <details/> closed by default for me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 13, 2021

Copy link
Copy Markdown
Contributor

Keep the <details/> closed by default for me.

You mean you'd prefer without the open attribute? I'm open to have my mind changed, but I'm afraid that might be a surprising change to the docs – there always has been a visible TOC on our docs, hiding it by default would be weird.

/cc @nodejs/documentation what are your thoughts on this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 approved these changes Jan 13, 2021
View reviewed changes
@ghost

ghost commented Jan 13, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

See MDN for a preview (Jump to section).
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 13, 2021

Copy link
Copy Markdown
Author

You mean you'd prefer without the open attribute?

Yes

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aymen94
aymen94 approved these changes Jan 14, 2021
View reviewed changes
@ghost

ghost commented Jan 14, 2021

Copy link
Copy Markdown
Author

It's ok for me to leave this open but in the future i could open a new issue about this after testing as a user.

aduh95 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 14, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

It's ok for me to leave this open but in the future i could open a new issue about this after testing as a user.

I'd be fine with that too. I was thinking maybe we could add a tiny JS script that automatically removes the open attribute on the <details> element if the user is visiting from a mobile phone on a follow up PR (based on the assumption that scrolling past the TOC is more a concern on smaller screens, but let's see it in practice).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 14, 2021

Copy link
Copy Markdown
Contributor

Lite CI: https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/4215/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95 aduh95 added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Jan 14, 2021
Mattia Pontonio @aduh95
doc: wrap TOC in a <details> tag
2ba8728
PR-URL: #36896
Fixes: #36885
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@aduh95

aduh95 commented Jan 14, 2021

Copy link
Copy Markdown
Contributor

Landed in 2ba8728

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95 aduh95 closed this Jan 14, 2021
@ghost

ghost commented Jan 14, 2021

Copy link
Copy Markdown
Author

Screenshot_20210114-165934.png

This Is closed not merged 🤔

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 14, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

Landed in 2ba8728

What landed means? ✈️🛬🤔

Screenshot_20210114-170838.png

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 14, 2021

Copy link
Copy Markdown
Author

add a tiny JS script that automatically removes the open attribute on the <details> element if the user is visiting from a mobile phone

I think is better to be consistent between HTMLs

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@RaisinTen

RaisinTen commented Jan 14, 2021

Copy link
Copy Markdown
Member

@mattiapontonio your patch has been applied on the HEAD of the master branch instead of performing a merge commit because merges break our tooling.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 14, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

@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?
In never comes in this practice / case

I'm from a smartphone, i can only screeshot what I see here.

Screenshot_20210114-171404.png

I'm expecting something like this

Screenshot_20210114-171527.png

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 14, 2021

Copy link
Copy Markdown
Contributor

So it's not deployed. And It Will not be?

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 14, 2021

Copy link
Copy Markdown
Author

So it's not deployed. And It Will not be?

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 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jan 14, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 14, 2021

Copy link
Copy Markdown
Author

https://github.com/nodejs/node/suites/1829898807/artifacts/35314688

Should be intresting to see this deployed not in nodejs.org

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Jan 14, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

We might want to think about modifying the version picker slightly.

Where is the HTML of that?
Is a <details> tag?
I meant <details> tag for both.
Disclosure means open and close things, right?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost mentioned this pull request Jan 18, 2021
Jump to section => Table of contents mdn/content#1371
Closed
ruyadorno pushed a commit that referenced this pull request Jan 22, 2021
Mattia Pontonio @ruyadorno
doc: wrap TOC in a <details> tag
f99b38f
PR-URL: #36896
Fixes: #36885
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Jan 22, 2021
v15.7.0 proposal #37020
Merged
@Trott

Trott commented Feb 23, 2021

Copy link
Copy Markdown
Member

We might want to think about modifying the version picker slightly.

Where is the HTML of that?
Is a <details> tag?
I meant <details> tag for both.
Disclosure means open and close things, right?

No, it's not a details tag.

<a href="#">View another version <span>▼</span></a>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Feb 23, 2021

Copy link
Copy Markdown
Author

We might want to think about modifying the version picker slightly.

Where is the HTML of that?
Is a <details> tag?
I meant <details> tag for both.
Disclosure means open and close things, right?

No, it's not a details tag.

<a href="#">View another version <span>▼</span></a>

Apparently not even ToC.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost mentioned this pull request Feb 23, 2021
Table of contents in a <details> #36885
Closed
targos pushed a commit that referenced this pull request May 1, 2021
Mattia Pontonio @targos
doc: wrap TOC in a <details> tag
583b219
PR-URL: #36896
Fixes: #36885
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@danielleadams danielleadams mentioned this pull request May 3, 2021
v14.17.0 proposal #38507
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. doc Issues and PRs related to Node.js documentation.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Table of contents in a <details>

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@aduh95 @RaisinTen @Trott @jasnell @aymen94 @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.