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: remove TOC summary for pages with no TOC #37043
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -382,13 +382,19 @@ function buildToc({ filename, apilinks }) { | |||||
node.children.push({ type: 'html', value: anchor }); | ||||||
}); | ||||||
|
||||||
file.toc = unified() | ||||||
.use(markdown) | ||||||
.use(gfm) | ||||||
.use(remark2rehype, { allowDangerousHtml: true }) | ||||||
.use(raw) | ||||||
.use(htmlStringify) | ||||||
.processSync(toc).toString(); | ||||||
if (toc !== '') { | ||||||
file.toc = '<details id="toc" open><summary>Table of contents</summary>' + | ||||||
unified() | ||||||
.use(markdown) | ||||||
.use(gfm) | ||||||
.use(remark2rehype, { allowDangerousHtml: true }) | ||||||
.use(raw) | ||||||
.use(htmlStringify) | ||||||
.processSync(toc).toString() + | ||||||
'</details>'; | ||||||
} else { | ||||||
file.toc = '<!-- TOC -->'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternatively, we could rollback to
Suggested change
It would let us revert the changes in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
} | ||||||
}; | ||||||
} | ||||||
|
||||||
|
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 PR also removes the capitalisation of
Contents
. That's fine with me, but I wanted to point it out in case it was not on purpose. Other occurrences uses the capitalization:node/doc/guides/cpp-style-guide.md
Line 6 in 7794d36
node/doc/guides/releases.md
Line 8 in 4d3e87d
node/doc/guides/writing-and-running-benchmarks.md
Line 3 in 860c18b
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.
It was indeed on purpose. Our documentation style guide indicates the use of sentence case for document headings. This isn't exactly a heading (but the other things you point to are). However, the style guide also says to refer to Microsoft's style guide for things it (our style guide) doesn't cover, and Microsoft's style guide recommends sentence case for situations like this.