Closed mihaigalos closed 1 week ago
Hi,
I can expose some JavaScript functions, that you can call to toggle or set the visibility of the sidebars. Then a button or link can just call these functions. But since each theme is different, adding buttons for all of them may not be straightforward. The following approaches come to my mind:
Do you have any other ideas? Which of the approaches would you prefer?
Hi @six-two, I managed to get this working:
Shows up nicely to the top right like this:
Thank you. If you want to proceed here, we can keep this open otherwise free to close. 👍
@mihaigalos Thanks for the code.
I now export an API (see docs/javascript-functions.md
). This has the benefit of working with all supported themes and saving the state (which side bars are shown or hidden).
I also played around with your code and implemented a button (for now in Material theme only) similar to it. You can include it by setting toggle_button
to all
, navigation
or toc
:
plugins:
- search
- toggle-sidebar:
toggle_button: toc
You can try it out by installing the version from the main branch:
pip install -U git+https://github.com/six-two/mkdocs-toggle-sidebar-plugin
I implemented the feature for the remaining themes and released it with version 0.0.4
Hi,
Awesome stuff!
Is it possible to also have a toggle button for people not familiar with the keyboard shortcuts?