vuepress-jsdoc
vuepress-jsdoc copied to clipboard
Vuepress 2 support
Is your feature request related to a problem? Please describe. The sidebar config has changed slightly in Vuepress v2, which means that this library no longer generates a sidebar config that is compatible with Vuepress 2.
The docs for v2 are here: https://v2.vuepress.vuejs.org/reference/default-theme/config.html#sidebar
Firstly, the title
property has been changed to text
.
Another issue, that doesn't appear to be documented, is that the link strings need to be the full path, rather than just the relative path.
With a structure like:
/code/
- file-a.md
- file-b.md
sub-directory/
- file-c.md
The sidebar is currently generated as:
{
'/code/': [
{
title: 'Code',
children: [['', '' + title + ''], 'file-a', 'file-b'],
}
{
title: 'sub-directory',
children: ['sub-directory/file-c'],
}
],
}
When navigating into the sub-directory, the links to the root directory get changed like sub-directory/file-a
, which is broken.
To fix it, it needs to be like this:
{
'/code/': [
{
text: 'Code',
children: [{link: '/code/', text: '' + title + ''}, '/code/file-a', '/code/file-b'],
}
{
text: 'sub-directory',
children: ['/code/sub-directory/file-c'],
}
],
}
Note above that the root level first link has also been changed to an object - it looks like the array style used before also no longer works.
Describe the solution you'd like For the library to export the config in a way that is compatible with VuePress v2.
Describe alternatives you've considered I'm not really sure there are other alternatives :shrug:
Additional context I would be happy to work on a PR for this, but I've not used Typescript before, so It could take a while to figure out how. I'm guessing that it's this file that needs modifying? https://github.com/ph1p/vuepress-jsdoc/blob/21823a1c56b0fa29c2077321203a9a4556b8e210/src/lib/vue-sidebar.ts