Skip to main content

Add keybindings to toggle the table of contents and menu sidebars on some MkDocs themes

Project description

mkdocs-toggle-sidebar-plugin

PyPI version License Python versions

This package allows you to toggle the left (navigation) and right (table of contents) sidebars on a couple of MkDocs themes such as:

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 and readthedocs theme.

Version 0.0.1

  • Prototype with mkdocs-material implementation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-toggle-sidebar-plugin-0.0.3.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page