docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

Generate index page with table of content

Open Roiocam opened this issue 2 years ago • 5 comments

Have you read the Contributing Guidelines on issues?

Description

Generate index page with optional table of content, which namely adding some list <a> on here: https://github.com/facebook/docusaurus/blob/d07567e411410e6b7f14ca8f7c2c3b501f58b9ad/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx#L62-L68

And here should be adding extra table of content of some document links on return:

https://github.com/facebook/docusaurus/blob/d07567e411410e6b7f14ca8f7c2c3b501f58b9ad/packages/docusaurus-theme-common/src/utils/docsUtils.tsx#L118

Prevents me from raising an ISSUE instead of PR is the second point.

Has this been requested on Canny?

No response

Motivation

The original generated index is fine for link, but not good for doucment.

Because the document title should enough summarize topic of this section doucment, you may want get more information form this page, otherwise this page was no that useful, opinion only of mine.

This is a example likes this ISSUE:

截屏2023-10-25 22 37 33

API design

No response

Have you tried building it?

No response

Self-service

  • [ ] I'd be willing to contribute this feature to Docusaurus myself.

Roiocam avatar Oct 25 '23 14:10 Roiocam

This is non-trivial because each page is not aware of the TOC of another page. Although it's not impossible, I think, because the TOC is still exposed as a separate variable from each page's chunk, I'm not sure if it's easy to implement.

Josh-Cena avatar Nov 15 '23 18:11 Josh-Cena