mkdocs-toggle-sidebar-plugin 0.0.8__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mkdocs_toggle_sidebar_plugin-0.0.8/src/mkdocs_toggle_sidebar_plugin.egg-info → mkdocs_toggle_sidebar_plugin-0.0.9}/PKG-INFO +24 -2
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/README.md +23 -1
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/setup.cfg +1 -1
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin/__init__.py +44 -4
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin/toggle-sidebar.js +4 -4
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9/src/mkdocs_toggle_sidebar_plugin.egg-info}/PKG-INFO +24 -2
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/LICENSE +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/MANIFEST.in +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/pyproject.toml +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin/material.js +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin/mkdocs.js +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin/readthedocs.js +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin.egg-info/SOURCES.txt +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin.egg-info/dependency_links.txt +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin.egg-info/entry_points.txt +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin.egg-info/requires.txt +0 -0
- {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.0.9}/src/mkdocs_toggle_sidebar_plugin.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mkdocs-toggle-sidebar-plugin
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: Add keybindings to toggle the navigation and table of contents sidebars
|
|
5
5
|
Home-page: https://github.com/six-two/mkdocs-toggle-sidebar-plugin
|
|
6
6
|
Author: six-two
|
|
@@ -84,6 +84,10 @@ plugins:
|
|
|
84
84
|
show_toc_by_default: False
|
|
85
85
|
theme: material
|
|
86
86
|
toggle_button: all
|
|
87
|
+
button_toggle_both_tooltip: Toggle Navigation and Table of Contents
|
|
88
|
+
button_toggle_nav_tooltip: Toggle Navigation
|
|
89
|
+
button_toggle_toc_tooltip: Toggle Table of Contents
|
|
90
|
+
button_toggle_icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"></path></svg>'
|
|
87
91
|
```
|
|
88
92
|
|
|
89
93
|
The following options exist:
|
|
@@ -99,6 +103,10 @@ show_navigation_by_default | `bool` | `True` | Whether to show the navigation by
|
|
|
99
103
|
show_toc_by_default | `bool` | `True` | Whether to show the table of contents by default
|
|
100
104
|
theme | `str` | `auto` | Used for theme detection. With `auto`, the plugin tries to automatically detect the theme. But you can also force it to use a specific theme preset that you know will work. Currently supported values: `material`/`ansible`, `mkdocs`, `readthedocs`.
|
|
101
105
|
toggle_button | `str` | `"none"` | Can be set to show a toggle button (see below)
|
|
106
|
+
button_toggle_both_tooltip | `str` | `"Toggle Navigation and Table of Contents"` | Tooltip to show when `toggle_button` is `both`
|
|
107
|
+
button_toggle_nav_tooltip | `str` | `"Toggle Navigation"` | Tooltip to show when `toggle_button` is `navigation`
|
|
108
|
+
button_toggle_toc_tooltip | `str` | `"Toggle Table of Contents"` | Tooltip to show when `toggle_button` is `toc`
|
|
109
|
+
button_toggle_icon | `str` | SVG of hamburger menu (three vertical bars on top of each other) | SVG to show for the toggle button. Should be 24px by 24px in size.
|
|
102
110
|
|
|
103
111
|
|
|
104
112
|
#### Toggle button
|
|
@@ -108,6 +116,16 @@ It is usually in the nav or the top bar.
|
|
|
108
116
|
Clicking the button will toggle the navigation, table of contents, or both (depending on the supplied value).
|
|
109
117
|
By leaving the field empty or setting it to `none`, no button is added.
|
|
110
118
|
|
|
119
|
+
You can set a custom icon for the button, using the `button_toggle_icon` configuration.
|
|
120
|
+
The icon should be a 24px square SVG file.
|
|
121
|
+
|
|
122
|
+
The tooltip shown when hovering over the button can also be changed.
|
|
123
|
+
Depending on which value you set in `toggle_button`, a different option is used:
|
|
124
|
+
|
|
125
|
+
- If `toggle_button` is `all`, then `button_toggle_both_tooltip` is used.
|
|
126
|
+
- If `toggle_button` is `navigation`, then `button_toggle_nav_tooltip` is used.
|
|
127
|
+
- If `toggle_button` is `toc`, then `button_toggle_toc_tooltip` is used.
|
|
128
|
+
|
|
111
129
|
### Exported API functions
|
|
112
130
|
|
|
113
131
|
This plugin exposes some JavaScript functions, that can show, hide or toggle the visibility of the sidebars.
|
|
@@ -117,7 +135,7 @@ In short there are:
|
|
|
117
135
|
|
|
118
136
|
- `MkdocsToggleSidebarPlugin.setNavigationVisibility(show: bool)`
|
|
119
137
|
- `MkdocsToggleSidebarPlugin.setTocVisibility(show: bool)`
|
|
120
|
-
- `MkdocsToggleSidebarPlugin.setAllVisibility
|
|
138
|
+
- `MkdocsToggleSidebarPlugin.setAllVisibility(showNavigation: bool, showTOC: bool)`
|
|
121
139
|
- `MkdocsToggleSidebarPlugin.toggleNavigationVisibility()`
|
|
122
140
|
- `MkdocsToggleSidebarPlugin.toggleTocVisibility()`
|
|
123
141
|
- `MkdocsToggleSidebarPlugin.toggleAllVisibility()`
|
|
@@ -169,6 +187,10 @@ docker run --rm -it -v "$PWD:/share" -w "/share" -p 8000:8000 --entrypoint=bash
|
|
|
169
187
|
|
|
170
188
|
## Notable changes
|
|
171
189
|
|
|
190
|
+
### Version 0.0.9
|
|
191
|
+
|
|
192
|
+
- Added `button_toggle_both_tooltip`, `button_toggle_nav_tooltip`, `button_toggle_toc_tooltip` and `button_toggle_icon` options for customizing the toggle button (see #12)
|
|
193
|
+
|
|
172
194
|
### Version 0.0.8
|
|
173
195
|
|
|
174
196
|
- Fixed toggle button not shown in certain window dimensions in Material theme (see #11)
|
|
@@ -62,6 +62,10 @@ plugins:
|
|
|
62
62
|
show_toc_by_default: False
|
|
63
63
|
theme: material
|
|
64
64
|
toggle_button: all
|
|
65
|
+
button_toggle_both_tooltip: Toggle Navigation and Table of Contents
|
|
66
|
+
button_toggle_nav_tooltip: Toggle Navigation
|
|
67
|
+
button_toggle_toc_tooltip: Toggle Table of Contents
|
|
68
|
+
button_toggle_icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"></path></svg>'
|
|
65
69
|
```
|
|
66
70
|
|
|
67
71
|
The following options exist:
|
|
@@ -77,6 +81,10 @@ show_navigation_by_default | `bool` | `True` | Whether to show the navigation by
|
|
|
77
81
|
show_toc_by_default | `bool` | `True` | Whether to show the table of contents by default
|
|
78
82
|
theme | `str` | `auto` | Used for theme detection. With `auto`, the plugin tries to automatically detect the theme. But you can also force it to use a specific theme preset that you know will work. Currently supported values: `material`/`ansible`, `mkdocs`, `readthedocs`.
|
|
79
83
|
toggle_button | `str` | `"none"` | Can be set to show a toggle button (see below)
|
|
84
|
+
button_toggle_both_tooltip | `str` | `"Toggle Navigation and Table of Contents"` | Tooltip to show when `toggle_button` is `both`
|
|
85
|
+
button_toggle_nav_tooltip | `str` | `"Toggle Navigation"` | Tooltip to show when `toggle_button` is `navigation`
|
|
86
|
+
button_toggle_toc_tooltip | `str` | `"Toggle Table of Contents"` | Tooltip to show when `toggle_button` is `toc`
|
|
87
|
+
button_toggle_icon | `str` | SVG of hamburger menu (three vertical bars on top of each other) | SVG to show for the toggle button. Should be 24px by 24px in size.
|
|
80
88
|
|
|
81
89
|
|
|
82
90
|
#### Toggle button
|
|
@@ -86,6 +94,16 @@ It is usually in the nav or the top bar.
|
|
|
86
94
|
Clicking the button will toggle the navigation, table of contents, or both (depending on the supplied value).
|
|
87
95
|
By leaving the field empty or setting it to `none`, no button is added.
|
|
88
96
|
|
|
97
|
+
You can set a custom icon for the button, using the `button_toggle_icon` configuration.
|
|
98
|
+
The icon should be a 24px square SVG file.
|
|
99
|
+
|
|
100
|
+
The tooltip shown when hovering over the button can also be changed.
|
|
101
|
+
Depending on which value you set in `toggle_button`, a different option is used:
|
|
102
|
+
|
|
103
|
+
- If `toggle_button` is `all`, then `button_toggle_both_tooltip` is used.
|
|
104
|
+
- If `toggle_button` is `navigation`, then `button_toggle_nav_tooltip` is used.
|
|
105
|
+
- If `toggle_button` is `toc`, then `button_toggle_toc_tooltip` is used.
|
|
106
|
+
|
|
89
107
|
### Exported API functions
|
|
90
108
|
|
|
91
109
|
This plugin exposes some JavaScript functions, that can show, hide or toggle the visibility of the sidebars.
|
|
@@ -95,7 +113,7 @@ In short there are:
|
|
|
95
113
|
|
|
96
114
|
- `MkdocsToggleSidebarPlugin.setNavigationVisibility(show: bool)`
|
|
97
115
|
- `MkdocsToggleSidebarPlugin.setTocVisibility(show: bool)`
|
|
98
|
-
- `MkdocsToggleSidebarPlugin.setAllVisibility
|
|
116
|
+
- `MkdocsToggleSidebarPlugin.setAllVisibility(showNavigation: bool, showTOC: bool)`
|
|
99
117
|
- `MkdocsToggleSidebarPlugin.toggleNavigationVisibility()`
|
|
100
118
|
- `MkdocsToggleSidebarPlugin.toggleTocVisibility()`
|
|
101
119
|
- `MkdocsToggleSidebarPlugin.toggleAllVisibility()`
|
|
@@ -147,6 +165,10 @@ docker run --rm -it -v "$PWD:/share" -w "/share" -p 8000:8000 --entrypoint=bash
|
|
|
147
165
|
|
|
148
166
|
## Notable changes
|
|
149
167
|
|
|
168
|
+
### Version 0.0.9
|
|
169
|
+
|
|
170
|
+
- Added `button_toggle_both_tooltip`, `button_toggle_nav_tooltip`, `button_toggle_toc_tooltip` and `button_toggle_icon` options for customizing the toggle button (see #12)
|
|
171
|
+
|
|
150
172
|
### Version 0.0.8
|
|
151
173
|
|
|
152
174
|
- Fixed toggle button not shown in certain window dimensions in Material theme (see #11)
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import os
|
|
2
3
|
import urllib.parse
|
|
4
|
+
import xml.etree.ElementTree as ET
|
|
3
5
|
# pip dependency
|
|
4
6
|
from mkdocs.plugins import BasePlugin, get_plugin_logger
|
|
5
7
|
from mkdocs.config.defaults import MkDocsConfig
|
|
6
8
|
from mkdocs.config.base import Config
|
|
7
|
-
from mkdocs.config.config_options import Type
|
|
9
|
+
from mkdocs.config.config_options import Type
|
|
8
10
|
from mkdocs.exceptions import PluginError
|
|
9
11
|
|
|
10
12
|
LOGGER = get_plugin_logger(__name__)
|
|
@@ -16,6 +18,7 @@ THEME_COMPATIBILITY = {
|
|
|
16
18
|
}
|
|
17
19
|
# May not always be accurate, this is just for a more helpful error message
|
|
18
20
|
KNOWN_THEME_NAMES = ["material", "mkdocs", "readthedocs"] + list(THEME_COMPATIBILITY.keys())
|
|
21
|
+
DEFAULT_TOGGLE_BUTTON_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"></path></svg>'
|
|
19
22
|
|
|
20
23
|
class PluginConfig(Config):
|
|
21
24
|
enabled = Type(bool, default=True)
|
|
@@ -27,6 +30,10 @@ class PluginConfig(Config):
|
|
|
27
30
|
javascript = Type(str, default="assets/javascripts/toggle-sidebar.js")
|
|
28
31
|
debug = Type(bool, default=False)
|
|
29
32
|
inline = Type(bool, default=False)
|
|
33
|
+
button_toggle_both_tooltip = Type(str, default="Toggle Navigation and Table of Contents")
|
|
34
|
+
button_toggle_nav_tooltip = Type(str, default="Toggle Navigation")
|
|
35
|
+
button_toggle_toc_tooltip = Type(str, default="Toggle Table of Contents")
|
|
36
|
+
button_toggle_icon = Type(str, default=DEFAULT_TOGGLE_BUTTON_ICON)
|
|
30
37
|
|
|
31
38
|
|
|
32
39
|
def is_known_theme(theme_name: str) -> bool:
|
|
@@ -49,14 +56,22 @@ def get_base_url_by_url(url: str):
|
|
|
49
56
|
return './'
|
|
50
57
|
return url.count('/') * '../'
|
|
51
58
|
|
|
59
|
+
def escape_for_javascript_string(value: str) -> str:
|
|
60
|
+
# JSON escaping should be save for text added to a double quote (") JavaScript string
|
|
61
|
+
return json.dumps(value)
|
|
62
|
+
|
|
52
63
|
class Plugin(BasePlugin[PluginConfig]):
|
|
53
64
|
def on_config(self, config: MkDocsConfig, **kwargs) -> MkDocsConfig:
|
|
54
65
|
"""
|
|
55
66
|
Called once when the config is loaded.
|
|
56
67
|
It will make modify the config and initialize this plugin.
|
|
57
68
|
"""
|
|
69
|
+
# This will raise an exception or print a warning if something is missconfigured
|
|
70
|
+
self.validate_config_options()
|
|
71
|
+
|
|
58
72
|
self.theme_function_definitions = None
|
|
59
73
|
self.inline_javascript = None
|
|
74
|
+
|
|
60
75
|
if self.config.enabled:
|
|
61
76
|
theme_name = self.config.theme
|
|
62
77
|
# Default to automatically determining the theme
|
|
@@ -89,9 +104,29 @@ class Plugin(BasePlugin[PluginConfig]):
|
|
|
89
104
|
# We cache it for performance reasons
|
|
90
105
|
self.inline_javascript = f"<script>{self.get_toggle_sidebar_javascript(config)}</script>"
|
|
91
106
|
|
|
107
|
+
return config
|
|
108
|
+
|
|
109
|
+
def validate_config_options(self) -> None:
|
|
92
110
|
if self.config.toggle_button not in ALLOWED_TOGGLE_BUTTON_VALUES:
|
|
93
111
|
raise PluginError(f"Unexpected value for 'toggle_button': '{self.config.toggle_button}'. Allowed values are {', '.join(ALLOWED_TOGGLE_BUTTON_VALUES)}")
|
|
94
|
-
|
|
112
|
+
|
|
113
|
+
try:
|
|
114
|
+
root = ET.fromstring(self.config.button_toggle_icon)
|
|
115
|
+
width = root.get("width", "").replace("px", "")
|
|
116
|
+
height = root.get("height", "").replace("px", "")
|
|
117
|
+
# check size of SVG
|
|
118
|
+
if width and width != "24":
|
|
119
|
+
LOGGER.warning(f"button_toggle_icon should have a width of 24, but has {width}")
|
|
120
|
+
if height and height != "24":
|
|
121
|
+
LOGGER.warning(f"button_toggle_icon should have a height of 24, but has {height}")
|
|
122
|
+
# If width and height are not set, fall abck to viewbox
|
|
123
|
+
if not width and not height:
|
|
124
|
+
viewBox = root.get("viewBox", "")
|
|
125
|
+
if viewBox != "0 0 24 24":
|
|
126
|
+
LOGGER.warning(f"button_toggle_icon should have a size of 24x24, but has a viewbox of {viewBox} and no explicit size")
|
|
127
|
+
|
|
128
|
+
except Exception as ex:
|
|
129
|
+
LOGGER.error(f"Failed to parse and validate SVG button_toggle_icon: {ex}")
|
|
95
130
|
|
|
96
131
|
def debug(self, message: str) -> None:
|
|
97
132
|
if self.config.debug:
|
|
@@ -136,8 +171,13 @@ class Plugin(BasePlugin[PluginConfig]):
|
|
|
136
171
|
|
|
137
172
|
with open(asset_path) as f:
|
|
138
173
|
data = f.read()
|
|
139
|
-
|
|
174
|
+
|
|
175
|
+
data = data.replace("THEME_DEPENDENT_FUNCTION_DEFINITION_PLACEHOLDER", self.theme_function_definitions or "")
|
|
140
176
|
data = data.replace("TOC_DEFAULT_PLACEHOLDER", "true" if self.config.show_toc_by_default else "false")
|
|
141
177
|
data = data.replace("NAVIGATION_DEFAULT_PLACEHOLDER", "true" if self.config.show_toc_by_default else "false")
|
|
142
178
|
data = data.replace("TOGGLE_BUTTON_PLACEHOLDER", self.config.toggle_button)
|
|
143
|
-
|
|
179
|
+
data = data.replace("BUTTON_TOGGLE_ICON_PLACEHOLDER", escape_for_javascript_string(self.config.button_toggle_icon))
|
|
180
|
+
data = data.replace("BUTTON_TOGGLE_BOTH_TOOLTIP_PLACEHOLDER", escape_for_javascript_string(self.config.button_toggle_both_tooltip))
|
|
181
|
+
data = data.replace("BUTTON_TOGGLE_NAV_TOOLTIP_PLACEHOLDER", escape_for_javascript_string(self.config.button_toggle_nav_tooltip))
|
|
182
|
+
data = data.replace("BUTTON_TOGGLE_TOC_TOOLTIP_PLACEHOLDER", escape_for_javascript_string(self.config.button_toggle_toc_tooltip))
|
|
183
|
+
return data
|
|
@@ -88,13 +88,13 @@
|
|
|
88
88
|
const createDefaultToggleButton = (toggleNavigation, toggleTOC) => {
|
|
89
89
|
const toggleBtn = document.createElement("div");
|
|
90
90
|
toggleBtn.className = "mkdocs-toggle-sidebar-button";
|
|
91
|
-
toggleBtn.innerHTML =
|
|
91
|
+
toggleBtn.innerHTML = BUTTON_TOGGLE_ICON_PLACEHOLDER;
|
|
92
92
|
if (toggleNavigation && toggleTOC) {
|
|
93
|
-
toggleBtn.title =
|
|
93
|
+
toggleBtn.title = BUTTON_TOGGLE_BOTH_TOOLTIP_PLACEHOLDER;
|
|
94
94
|
} else if (toggleNavigation) {
|
|
95
|
-
toggleBtn.title =
|
|
95
|
+
toggleBtn.title = BUTTON_TOGGLE_NAV_TOOLTIP_PLACEHOLDER;
|
|
96
96
|
} else if (toggleTOC) {
|
|
97
|
-
toggleBtn.title =
|
|
97
|
+
toggleBtn.title = BUTTON_TOGGLE_TOC_TOOLTIP_PLACEHOLDER;
|
|
98
98
|
}
|
|
99
99
|
toggleBtn.addEventListener("click", () => toggleVisibility(toggleNavigation, toggleTOC));
|
|
100
100
|
return toggleBtn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mkdocs-toggle-sidebar-plugin
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: Add keybindings to toggle the navigation and table of contents sidebars
|
|
5
5
|
Home-page: https://github.com/six-two/mkdocs-toggle-sidebar-plugin
|
|
6
6
|
Author: six-two
|
|
@@ -84,6 +84,10 @@ plugins:
|
|
|
84
84
|
show_toc_by_default: False
|
|
85
85
|
theme: material
|
|
86
86
|
toggle_button: all
|
|
87
|
+
button_toggle_both_tooltip: Toggle Navigation and Table of Contents
|
|
88
|
+
button_toggle_nav_tooltip: Toggle Navigation
|
|
89
|
+
button_toggle_toc_tooltip: Toggle Table of Contents
|
|
90
|
+
button_toggle_icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"></path></svg>'
|
|
87
91
|
```
|
|
88
92
|
|
|
89
93
|
The following options exist:
|
|
@@ -99,6 +103,10 @@ show_navigation_by_default | `bool` | `True` | Whether to show the navigation by
|
|
|
99
103
|
show_toc_by_default | `bool` | `True` | Whether to show the table of contents by default
|
|
100
104
|
theme | `str` | `auto` | Used for theme detection. With `auto`, the plugin tries to automatically detect the theme. But you can also force it to use a specific theme preset that you know will work. Currently supported values: `material`/`ansible`, `mkdocs`, `readthedocs`.
|
|
101
105
|
toggle_button | `str` | `"none"` | Can be set to show a toggle button (see below)
|
|
106
|
+
button_toggle_both_tooltip | `str` | `"Toggle Navigation and Table of Contents"` | Tooltip to show when `toggle_button` is `both`
|
|
107
|
+
button_toggle_nav_tooltip | `str` | `"Toggle Navigation"` | Tooltip to show when `toggle_button` is `navigation`
|
|
108
|
+
button_toggle_toc_tooltip | `str` | `"Toggle Table of Contents"` | Tooltip to show when `toggle_button` is `toc`
|
|
109
|
+
button_toggle_icon | `str` | SVG of hamburger menu (three vertical bars on top of each other) | SVG to show for the toggle button. Should be 24px by 24px in size.
|
|
102
110
|
|
|
103
111
|
|
|
104
112
|
#### Toggle button
|
|
@@ -108,6 +116,16 @@ It is usually in the nav or the top bar.
|
|
|
108
116
|
Clicking the button will toggle the navigation, table of contents, or both (depending on the supplied value).
|
|
109
117
|
By leaving the field empty or setting it to `none`, no button is added.
|
|
110
118
|
|
|
119
|
+
You can set a custom icon for the button, using the `button_toggle_icon` configuration.
|
|
120
|
+
The icon should be a 24px square SVG file.
|
|
121
|
+
|
|
122
|
+
The tooltip shown when hovering over the button can also be changed.
|
|
123
|
+
Depending on which value you set in `toggle_button`, a different option is used:
|
|
124
|
+
|
|
125
|
+
- If `toggle_button` is `all`, then `button_toggle_both_tooltip` is used.
|
|
126
|
+
- If `toggle_button` is `navigation`, then `button_toggle_nav_tooltip` is used.
|
|
127
|
+
- If `toggle_button` is `toc`, then `button_toggle_toc_tooltip` is used.
|
|
128
|
+
|
|
111
129
|
### Exported API functions
|
|
112
130
|
|
|
113
131
|
This plugin exposes some JavaScript functions, that can show, hide or toggle the visibility of the sidebars.
|
|
@@ -117,7 +135,7 @@ In short there are:
|
|
|
117
135
|
|
|
118
136
|
- `MkdocsToggleSidebarPlugin.setNavigationVisibility(show: bool)`
|
|
119
137
|
- `MkdocsToggleSidebarPlugin.setTocVisibility(show: bool)`
|
|
120
|
-
- `MkdocsToggleSidebarPlugin.setAllVisibility
|
|
138
|
+
- `MkdocsToggleSidebarPlugin.setAllVisibility(showNavigation: bool, showTOC: bool)`
|
|
121
139
|
- `MkdocsToggleSidebarPlugin.toggleNavigationVisibility()`
|
|
122
140
|
- `MkdocsToggleSidebarPlugin.toggleTocVisibility()`
|
|
123
141
|
- `MkdocsToggleSidebarPlugin.toggleAllVisibility()`
|
|
@@ -169,6 +187,10 @@ docker run --rm -it -v "$PWD:/share" -w "/share" -p 8000:8000 --entrypoint=bash
|
|
|
169
187
|
|
|
170
188
|
## Notable changes
|
|
171
189
|
|
|
190
|
+
### Version 0.0.9
|
|
191
|
+
|
|
192
|
+
- Added `button_toggle_both_tooltip`, `button_toggle_nav_tooltip`, `button_toggle_toc_tooltip` and `button_toggle_icon` options for customizing the toggle button (see #12)
|
|
193
|
+
|
|
172
194
|
### Version 0.0.8
|
|
173
195
|
|
|
174
196
|
- Fixed toggle button not shown in certain window dimensions in Material theme (see #11)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|