docsify icon indicating copy to clipboard operation
docsify copied to clipboard

Resizable sidebar

Open Soneji opened this issue 5 years ago • 4 comments

Feature request

What problem does this feature solve?

Sometimes I have long headings which can get cut off on my sidebar. A resizable sizebar would be handy to solve this issue

What does the proposed API look like?


window.$docsify = {
    //...
    loadSidebar: true,
    resizeSidebar: true, // <- new
    //...
}

How should this be implemented in your opinion?

You can click on the sidebar and drag it to resize it.

It should be disabled on mobile.

Are you willing to work on this yourself?

Yes, but I would like some suggestions on the best way to implement this feature, and where in the codebase I should work.

Soneji avatar Mar 01 '21 12:03 Soneji

Hi any update on this? Or any hacky way to achieve this you've explored?

yanbutan avatar Dec 28 '21 10:12 yanbutan

Sorry @yanbutan I have not touched this since opening the issue. I would still love to see this feature if you or any of the 7 peopple who thumbs up'd this post want to work on it...

Soneji avatar Dec 28 '21 17:12 Soneji

This would be an interesting feature. You can see in this screenshot, there are three elements:

Screenshot from 2021-12-31 11-19-40

They each have 300px width. Someone would need to add an invisible element along the edge of the sidebar for dragging, then adjust the 300px value of the elements.

Here's how the CSS adjustment would work:

https://user-images.githubusercontent.com/297678/147836898-edab1b11-af6f-491a-8853-2046fc4e5ba2.mp4

Should be fairly easy to enable this with an option!

trusktr avatar Dec 31 '21 19:12 trusktr

I managed to do it by adjusting their root css through some js events. I tried to change the css properties for that aside tag with .sidebar, but I rmbr it dint work as expected. I will try to find some time and upload snippets of my code when, maybe it can help some people. Also, it may not be the best way to do it so feel free to suggest ways to improve.

yanbutan avatar Jan 12 '22 02:01 yanbutan

This issue has been addressed by PR #2469. The changes will be available when Docsify v5 is released.

  1. Sidebar links now wrap by default.
  2. Site administrators have the option of clamping sidebar links to a single line with ellipses if preferred
  3. Site administrators have the option to customize the sidebar width:
    :root {
      --sidebar-width: 280px;
    }
    

jhildenbiddle avatar Jul 19 '24 16:07 jhildenbiddle