Sidebar item's id not exist
AbbottMc opened this issue · comments
What package is the bug related to?
docusaurus-plugin-typedoc
Describe the issue
Auto-generated sidebar item's id not exist.
When I replaced all the "\" char to "/", it then initialized successfully
BUT, then it reported the problem of the inline link can't be resolved:
TypeDoc configuration
package version:
{
"docusaurus-plugin-typedoc": "^1.0.0",
"typedoc-plugin-markdown": "^4.0.0",
}
configurations:
const minecraftTypeNames = [
'common',
'server',
'server-ui',
'server-admin',
'server-net',
'server-editor',
'server-gametest',
];
// ...
{
// ...
plugins: [
...minecraftTypeNames.map((typeName) => {
return [
'docusaurus-plugin-typedoc',
/** @type {import("docusaurus-plugin-typedoc").PluginOptions} */
{
id: `preview-${typeName}`,
entryPoints: [`./static/typedoc/preview/${typeName}.d.ts`],
tsconfig: './static/typedoc/preview/tsconfig.json',
out: `./docs/sapi/en/preview/${typeName}`,
sanitizeComments: true,
// publicPath: './sapi/',
sidebar: {
pretty: true
}
}
];
}),
...minecraftTypeNames.map((typeName) => {
return [
'docusaurus-plugin-typedoc',
// Plugin / TypeDoc options
{
id: `stable-${typeName}`,
entryPoints: [`./static/typedoc/stable/${typeName}.d.ts`],
tsconfig: './static/typedoc/stable/tsconfig.json',
out: `./docs/sapi/en/stable/${typeName}`,
sanitizeComments: true,
// publicPath: './sapi/',
sidebar: {
pretty: true
}
}
];
})
],
}
Sidebar configurations:
const importSapiModuleSidebar = (path, moduleName) => {
return {
type: 'category',
label: '@minecraft/' + moduleName,
items: require(`./docs/sapi/en/${path}/${moduleName}/typedoc-sidebar.cjs`)
}
};
const sapiModuleSidebarGenerator = function (isStable) {
const path = isStable ? 'stable' : 'preview';
const ret = [];
for (const moduleNamesKey in moduleNames) {
ret.push(importSapiModuleSidebar(path, moduleNamesKey));
}
return ret;
};
const sidebars = {
sapiPreviewSidebar: [
...sapiModuleSidebarGenerator(false)
],
sapiStableSidebar: [
...sapiModuleSidebarGenerator(true)
],
};
Expected behavior
- The automatic generated sidebar configs can be used directly, or provide auto-generate category config json files for every child folder, just like the old version did
- Inline link can be generated correctly
thanks @AbbottMc
I have fixed the ids issue (issue handling windows path separators) - i'll add it to next patch release.
The automatic generated sidebar configs can be used directly, or provide auto-generate category config json files for every child folder, just like the old version did
I am hoping once this bug is fixed you'll be happy with the new config. The problem with the auto generated sidebar is that it was difficult customize for things like ordering etc and required frontmatter for sidebar labels.
Inline link can be generated correctly
I have not been able to replicate the resolving link issue. Have you introduced versioning to your docs? Would you be able to share your branch so i can investigate further?
fix in docusaurus-plugin-typdoc@1.0.1