Add keybindings to toggle the table of contents and menu sidebars on some MkDocs themes
Project description
mkdocs-toggle-sidebar-plugin
This package allows you to toggle the left (navigation) and right (table of contents) sidebars on a couple of MkDocs themes such as:
- Material for MkDocs:
material
- Builtin themes:
mkdocs
,readthedocs
You can play around with it and these themes on the test page.
The settings are stored using the localStorage
object, so that it will persist between pages.
I wrote it after getting frustrated by the browser's Find in page
function matching way to many links in the navigation sidebar instead of searching in the actual page's content.
Usage
Setup
First install the PyPI package:
pip install mkdocs-toggle-sidebar-plugin
Add something like the following to your mkdocs.yml
:
plugins:
- search
- toggle-sidebar
Key bindings
The plugin adds the following key bindings:
Key | Action |
---|---|
b |
toggle both (TOC and navigation) |
m |
toggle navigation menu |
t |
toggle TOC |
Theme support
Theme | Theme version | Plugin version | Status |
---|---|---|---|
mkdocs-material | 9.1.21 | 0.0.1 | works |
mkdocs (default) | 1.5.2 | 0.0.2 | works |
readthedocs | 1.5.2 | 0.0.2 | works |
Just open a issue / PR if you use a strange theme or the info above is not up to date anymore.
Note to self
Test mkdocs-material theme:
./serve.sh
Test mkdocs theme:
./serve.sh --theme mkdocs
Notable changes
Version 0.0.3
- Changed internal API:
- Element hiding/restyling is now done via CSS, so it is easier to undo. You should no longer have problems on devices with small screens (like phones) having broken layouts.
Version 0.0.2
- Added support for
mkdocs
andreadthedocs
theme.
Version 0.0.1
- Prototype with
mkdocs-material
implementation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mkdocs-toggle-sidebar-plugin-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39bc6279da42602e68599310a06bdf5730b1bc3fc7283401a980c1e28e70335b |
|
MD5 | 6d39e80ea6a62c2bf4858c739a74e53a |
|
BLAKE2b-256 | a621421c720c4d152462ff77f3e9f0c138d89c3f20ecd58d313e7a2b38f8a1d8 |
Hashes for mkdocs_toggle_sidebar_plugin-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 949be5825bc84be77591371080e35b0d2f7adcfcc88b0a95f704834884305fd0 |
|
MD5 | 3865e7978df25ed49c5d7aa3c6c0dddb |
|
BLAKE2b-256 | 8f0393316e748f469e22a3c5dd835bd008a7570097764d275152f2095306d293 |