youngtailors/vuepress-plugin-component-docgen

Custom Sidebar is overriden by the plugins

flozero opened this issue ยท 9 comments

Hello ! First thank's a lot for your work ! :)

I am facing two problems:

when we are using your component it broke every sidebar we make. Maybe i should just add another nav ?

sidebar: {
      "/guide/": [
        {
          title: "Guide",
          collapsable: false,
          children: ["", "getting-started", "colors", "borders", "fonts", "filters"]
        },
        {
          title: "Components",
          collapsable: false,
          children: ["components/buttons", "components/modals"]
        }
      ]
    }

It seem to break all sidebar navigation because the Home / Components

We can't use all vue-docgen-api when i want to use slot comment emit comment and class description maybe it's a choice ?

link to the issue

This issue belongs to this code:

componentContextMap: Map<string, IComponentContext[]>
}) => {
const sidebar: string[] = ['/']
for (const componentContexts of componentContextMap.values()) {
componentContexts.forEach(context => {
sidebar.push(context.link)
})
}
return sidebar
}
export default ({
componentContextMap,
}: {
componentContextMap: Map<string, IComponentContext[]>
}) => {
const sidebar = buildSidebar({ componentContextMap })
return {
name: 'docgen-enhancer',
content: `
export default ({ siteData }) => {
const sidebar = ${JSON.stringify(sidebar)}
siteData.themeConfig.sidebar = sidebar
}
`,
}

So, can you create PR to fix this?

Because I use the sidebar to show list components, so your sidebar had broken. I think we need an individual page to show list component, instead of sidebar

Sure i will try to this tonight ๐Ÿ‘

Did you change something ?

Sorry I'm busy with some other projects, and preparing for Tet holiday (in my country - Vietnam), so I will see it soon. It's a blessing if you can help me.

https://github.com/f3ltron/vuepress-plugin-component-docgen. I Am working on ^^. I added some comments on codes and add an example directory to working on. And analyze a bit your code.

I think yeah we should create a totally new page with additionalPages ?

Actually we use enhanceAppFiles i added a new children that is work but sidebar options car be array nester array of object, objects. so yeah i dont know what is the best on it

Update:
I make it working with both groups sections sidebar and basic sidebar navigation.

Need improvement:

  • Messy code
  • work well when one depth folder archi from components.

archi components working

src/
  components/
            Test.vue // making the nav but not taking the good md
             // Working Actually
            Comp/
                 Comp.vue
                 SubComp/
                      SubComp.vue
            Comp2/
                 Comp2.vue

maybe nest sub Component should not work

edit: It should work i think because the good practice you should create one folder by component or create one folder by theme of components

Pull request created: Here