iPeng6 / docsify-sidebar-collapse

a docsify plugin, support sidebar catalog expand and collapse
MIT License
176 stars 37 forks source link

Doesn't do anything when used with the latest docsify #1

Closed oeway closed 5 years ago

oeway commented 5 years ago

Hi, thanks for making this plugin. However, I cannot make it work by either add the script or copy your js/css code directly in plugins.

iPeng6 commented 5 years ago

Hi, thanks for making this plugin. However, I cannot make it work by either add the script or copy your js/css code directly in plugins.

Hi, Make sure that the loadSidebar config is enabled,and the Markdown file _sidebar.md is provided in the root directory. eg:

 <script>
      window.$docsify = {
        loadSidebar: true,
        alias: {
          '/.*/_sidebar.md': '/_sidebar.md',
        },
        subMaxLevel: 3,
       ...
      }
    </script>
    <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>

    <!-- plugins -->
    <script src="//unpkg.com/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js">
oeway commented 5 years ago

Hi, thanks for your quick response. I think we did exactly as you mentioned, but still cannot get it to work. Could you please have a look at our implementation here: https://github.com/muellerflorian/ImJoy/tree/docs-sidebar-collapse/docs

Thanks a lot.

iPeng6 commented 5 years ago

Hi, thanks for your quick response. I think we did exactly as you mentioned, but still cannot get it to work. Could you please have a look at our implementation here: https://github.com/muellerflorian/ImJoy/tree/docs-sidebar-collapse/docs

Thanks a lot.

Do you mean this website https://imjoy.io ?Its source code is always referenced here? https://github.com/oeway/ImJoy/blob/master/docs/index.html

and your code is on the branch docs-sidebar-collapse , Will it be deployed successfully?

oeway commented 5 years ago

Yes, ultimately we want to apply your plugin to https://imjoy.io/docs. But for now we use this branch for testing purpose. So please take a look at the testing branch to see if there is anything we missed. To reproduce the problem, you can download the zip file from here and run a http server with the docs folder.

iPeng6 commented 5 years ago

Your catalog has only one level, so it doesn't show any effect. Your can try it like:

- [Overview](README.md)
  - [Getting Started](getting_started.md)
    - [User Manual](user_manual.md)
    - [Development](development.md)
  - [ImJoy API](api.md)
- [Demos](demos.md)

This plugin will hide the subdirectories by default if there is no active article,but the active one's directory node is still open include the table of content.

I'm sorry for the confusion caused by the working mechanism of this plugin.

oeway commented 5 years ago

I see, thanks for explanation.

Would it be possible for your plugin to support collapsing the different levels inside the same md file? We would like to reduce the number of files but still be able to collapse them in the table of content.

iPeng6 commented 5 years ago

Try this version and have a look at if it meets your needs.

oeway commented 5 years ago

Hey, we just tried, it works! Thanks a lot.

Not sure if it's possible, but would be great to make the feature even more complete -- when clicking on a subheading which is already open, collapse it. This would be consistent with the high level headings. Forget this If it's too hard to implement.

iPeng6 commented 5 years ago

ok, done!

oeway commented 5 years ago

Great, thanks again, we will try it soon.

muellerflorian commented 5 years ago

This is perfect! Thanks a lot! This should be part of the docsify package.