Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Description
Docusaurus currently allows manually altering (and even outright replacing) the ToC in Docs, as per #3915 (comment), but this is not documented.
This issue is as much a question on whether this is something we can expect to rely on, as a request to document it if the answer is "yes".
Has this been requested on Canny?
No response
Motivation
This is useful for documentation that is generated from other sources (in this case, a man
page): while the HTML can be injected, the ToC does not follow suit (and I wouldn't expect it to. Or is that preferable?).
API design
Here is a doc which largely consists of externally-generated HTML, for which we additionally generate the ToC via a script.
# rgbds(5) — object file format documentation
import generated from '!!raw-loader!./rgbds.5.html';
<div className="manual-text" dangerouslySetInnerHTML={{ __html: generated }} />
export const toc = [
{
"value": "DESCRIPTION",
"id": "DESCRIPTION",
"level": 2,
},
{
"value": "FILE STRUCTURE",
"id": "FILE_STRUCTURE",
"level": 2,
},
{
"value": "Header",
"id": "Header",
"level": 3,
},
{
"value": "Source file info",
"id": "Source_file_info",
"level": 3,
},
{
"value": "Symbols",
"id": "Symbols",
"level": 3,
},
{
"value": "Sections",
"id": "Sections",
"level": 3,
},
{
"value": "Assertions",
"id": "Assertions",
"level": 3,
},
{
"value": "RPN EXPRESSIONS",
"id": "RPN_EXPRESSIONS",
"level": 3,
},
{
"value": "SEE ALSO",
"id": "SEE_ALSO",
"level": 2,
},
{
"value": "HISTORY",
"id": "HISTORY",
"level": 2,
},
];
Have you tried building it?
If the existing behavior is to be accepted as official, then nothing needs to be built; otherwise, what replacement API is deemed better will need to be discussed first.
Self-service
- I'd be willing to contribute this feature to Docusaurus myself.