mkdocs-toggle-sidebar-plugin 0.0.8__tar.gz → 0.1.0__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.
Files changed (17) hide show
  1. {mkdocs_toggle_sidebar_plugin-0.0.8/src/mkdocs_toggle_sidebar_plugin.egg-info → mkdocs_toggle_sidebar_plugin-0.1.0}/PKG-INFO +34 -3
  2. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/README.md +33 -1
  3. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/setup.cfg +1 -3
  4. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/src/mkdocs_toggle_sidebar_plugin/__init__.py +54 -8
  5. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/src/mkdocs_toggle_sidebar_plugin/toggle-sidebar.js +4 -4
  6. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0/src/mkdocs_toggle_sidebar_plugin.egg-info}/PKG-INFO +34 -3
  7. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/src/mkdocs_toggle_sidebar_plugin.egg-info/SOURCES.txt +0 -1
  8. mkdocs_toggle_sidebar_plugin-0.0.8/src/mkdocs_toggle_sidebar_plugin.egg-info/requires.txt +0 -1
  9. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/LICENSE +0 -0
  10. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/MANIFEST.in +0 -0
  11. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/pyproject.toml +0 -0
  12. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/src/mkdocs_toggle_sidebar_plugin/material.js +0 -0
  13. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/src/mkdocs_toggle_sidebar_plugin/mkdocs.js +0 -0
  14. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/src/mkdocs_toggle_sidebar_plugin/readthedocs.js +0 -0
  15. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/src/mkdocs_toggle_sidebar_plugin.egg-info/dependency_links.txt +0 -0
  16. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/src/mkdocs_toggle_sidebar_plugin.egg-info/entry_points.txt +0 -0
  17. {mkdocs_toggle_sidebar_plugin-0.0.8 → mkdocs_toggle_sidebar_plugin-0.1.0}/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.8
3
+ Version: 0.1.0
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
@@ -17,7 +17,6 @@ Classifier: Programming Language :: Python :: 3.13
17
17
  Requires-Python: >=3.9
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: mkdocs>=1.5.0
21
20
  Dynamic: license-file
22
21
 
23
22
  # mkdocs-toggle-sidebar-plugin
@@ -38,6 +37,10 @@ The settings are stored using the `localStorage` object, so that it will persist
38
37
  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.
39
38
 
40
39
 
40
+ ## Note on Zensical, MkDocs 1.x, ProperDocs, etc
41
+
42
+ To make it easy to keep it up to date for all my plugins, I hosted my [intentions of what platforms to support](https://six-two.dev/plugin-support-for-mkdocs-and-forks/) on my website.
43
+
41
44
  ## Usage
42
45
 
43
46
  ### Setup
@@ -84,6 +87,10 @@ plugins:
84
87
  show_toc_by_default: False
85
88
  theme: material
86
89
  toggle_button: all
90
+ button_toggle_both_tooltip: Toggle Navigation and Table of Contents
91
+ button_toggle_nav_tooltip: Toggle Navigation
92
+ button_toggle_toc_tooltip: Toggle Table of Contents
93
+ 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
94
  ```
88
95
 
89
96
  The following options exist:
@@ -99,6 +106,10 @@ show_navigation_by_default | `bool` | `True` | Whether to show the navigation by
99
106
  show_toc_by_default | `bool` | `True` | Whether to show the table of contents by default
100
107
  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
108
  toggle_button | `str` | `"none"` | Can be set to show a toggle button (see below)
109
+ button_toggle_both_tooltip | `str` | `"Toggle Navigation and Table of Contents"` | Tooltip to show when `toggle_button` is `both`
110
+ button_toggle_nav_tooltip | `str` | `"Toggle Navigation"` | Tooltip to show when `toggle_button` is `navigation`
111
+ button_toggle_toc_tooltip | `str` | `"Toggle Table of Contents"` | Tooltip to show when `toggle_button` is `toc`
112
+ 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
113
 
103
114
 
104
115
  #### Toggle button
@@ -108,6 +119,16 @@ It is usually in the nav or the top bar.
108
119
  Clicking the button will toggle the navigation, table of contents, or both (depending on the supplied value).
109
120
  By leaving the field empty or setting it to `none`, no button is added.
110
121
 
122
+ You can set a custom icon for the button, using the `button_toggle_icon` configuration.
123
+ The icon should be a 24px square SVG file.
124
+
125
+ The tooltip shown when hovering over the button can also be changed.
126
+ Depending on which value you set in `toggle_button`, a different option is used:
127
+
128
+ - If `toggle_button` is `all`, then `button_toggle_both_tooltip` is used.
129
+ - If `toggle_button` is `navigation`, then `button_toggle_nav_tooltip` is used.
130
+ - If `toggle_button` is `toc`, then `button_toggle_toc_tooltip` is used.
131
+
111
132
  ### Exported API functions
112
133
 
113
134
  This plugin exposes some JavaScript functions, that can show, hide or toggle the visibility of the sidebars.
@@ -117,7 +138,7 @@ In short there are:
117
138
 
118
139
  - `MkdocsToggleSidebarPlugin.setNavigationVisibility(show: bool)`
119
140
  - `MkdocsToggleSidebarPlugin.setTocVisibility(show: bool)`
120
- - `MkdocsToggleSidebarPlugin.setAllVisibility: (showNavigation: bool, showTOC: bool)`
141
+ - `MkdocsToggleSidebarPlugin.setAllVisibility(showNavigation: bool, showTOC: bool)`
121
142
  - `MkdocsToggleSidebarPlugin.toggleNavigationVisibility()`
122
143
  - `MkdocsToggleSidebarPlugin.toggleTocVisibility()`
123
144
  - `MkdocsToggleSidebarPlugin.toggleAllVisibility()`
@@ -133,6 +154,7 @@ Theme | Theme version | Plugin version | Status
133
154
  --- | --- | --- | ---
134
155
  mkdocs-ansible | 25.6.0 | 0.0.6 | works
135
156
  mkdocs-material | 9.6.14 | 0.0.4+ | works
157
+ mkdocs-materialx | 10.1.5 | 0.1.0 | works
136
158
  mkdocs (default) | 1.6.1 | 0.0.4+ | works
137
159
  readthedocs | 1.6.1 | 0.0.4+ | works
138
160
 
@@ -169,6 +191,15 @@ docker run --rm -it -v "$PWD:/share" -w "/share" -p 8000:8000 --entrypoint=bash
169
191
 
170
192
  ## Notable changes
171
193
 
194
+ ### Version 0.1.0
195
+
196
+ - Added autodetection for [MaterialX](https://github.com/jaywhj/mkdocs-materialx) theme.
197
+ - Removed dependency declaration of `mkdocs`
198
+
199
+ ### Version 0.0.9
200
+
201
+ - 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)
202
+
172
203
  ### Version 0.0.8
173
204
 
174
205
  - Fixed toggle button not shown in certain window dimensions in Material theme (see #11)
@@ -16,6 +16,10 @@ The settings are stored using the `localStorage` object, so that it will persist
16
16
  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.
17
17
 
18
18
 
19
+ ## Note on Zensical, MkDocs 1.x, ProperDocs, etc
20
+
21
+ To make it easy to keep it up to date for all my plugins, I hosted my [intentions of what platforms to support](https://six-two.dev/plugin-support-for-mkdocs-and-forks/) on my website.
22
+
19
23
  ## Usage
20
24
 
21
25
  ### Setup
@@ -62,6 +66,10 @@ plugins:
62
66
  show_toc_by_default: False
63
67
  theme: material
64
68
  toggle_button: all
69
+ button_toggle_both_tooltip: Toggle Navigation and Table of Contents
70
+ button_toggle_nav_tooltip: Toggle Navigation
71
+ button_toggle_toc_tooltip: Toggle Table of Contents
72
+ 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
73
  ```
66
74
 
67
75
  The following options exist:
@@ -77,6 +85,10 @@ show_navigation_by_default | `bool` | `True` | Whether to show the navigation by
77
85
  show_toc_by_default | `bool` | `True` | Whether to show the table of contents by default
78
86
  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
87
  toggle_button | `str` | `"none"` | Can be set to show a toggle button (see below)
88
+ button_toggle_both_tooltip | `str` | `"Toggle Navigation and Table of Contents"` | Tooltip to show when `toggle_button` is `both`
89
+ button_toggle_nav_tooltip | `str` | `"Toggle Navigation"` | Tooltip to show when `toggle_button` is `navigation`
90
+ button_toggle_toc_tooltip | `str` | `"Toggle Table of Contents"` | Tooltip to show when `toggle_button` is `toc`
91
+ 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
92
 
81
93
 
82
94
  #### Toggle button
@@ -86,6 +98,16 @@ It is usually in the nav or the top bar.
86
98
  Clicking the button will toggle the navigation, table of contents, or both (depending on the supplied value).
87
99
  By leaving the field empty or setting it to `none`, no button is added.
88
100
 
101
+ You can set a custom icon for the button, using the `button_toggle_icon` configuration.
102
+ The icon should be a 24px square SVG file.
103
+
104
+ The tooltip shown when hovering over the button can also be changed.
105
+ Depending on which value you set in `toggle_button`, a different option is used:
106
+
107
+ - If `toggle_button` is `all`, then `button_toggle_both_tooltip` is used.
108
+ - If `toggle_button` is `navigation`, then `button_toggle_nav_tooltip` is used.
109
+ - If `toggle_button` is `toc`, then `button_toggle_toc_tooltip` is used.
110
+
89
111
  ### Exported API functions
90
112
 
91
113
  This plugin exposes some JavaScript functions, that can show, hide or toggle the visibility of the sidebars.
@@ -95,7 +117,7 @@ In short there are:
95
117
 
96
118
  - `MkdocsToggleSidebarPlugin.setNavigationVisibility(show: bool)`
97
119
  - `MkdocsToggleSidebarPlugin.setTocVisibility(show: bool)`
98
- - `MkdocsToggleSidebarPlugin.setAllVisibility: (showNavigation: bool, showTOC: bool)`
120
+ - `MkdocsToggleSidebarPlugin.setAllVisibility(showNavigation: bool, showTOC: bool)`
99
121
  - `MkdocsToggleSidebarPlugin.toggleNavigationVisibility()`
100
122
  - `MkdocsToggleSidebarPlugin.toggleTocVisibility()`
101
123
  - `MkdocsToggleSidebarPlugin.toggleAllVisibility()`
@@ -111,6 +133,7 @@ Theme | Theme version | Plugin version | Status
111
133
  --- | --- | --- | ---
112
134
  mkdocs-ansible | 25.6.0 | 0.0.6 | works
113
135
  mkdocs-material | 9.6.14 | 0.0.4+ | works
136
+ mkdocs-materialx | 10.1.5 | 0.1.0 | works
114
137
  mkdocs (default) | 1.6.1 | 0.0.4+ | works
115
138
  readthedocs | 1.6.1 | 0.0.4+ | works
116
139
 
@@ -147,6 +170,15 @@ docker run --rm -it -v "$PWD:/share" -w "/share" -p 8000:8000 --entrypoint=bash
147
170
 
148
171
  ## Notable changes
149
172
 
173
+ ### Version 0.1.0
174
+
175
+ - Added autodetection for [MaterialX](https://github.com/jaywhj/mkdocs-materialx) theme.
176
+ - Removed dependency declaration of `mkdocs`
177
+
178
+ ### Version 0.0.9
179
+
180
+ - 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)
181
+
150
182
  ### Version 0.0.8
151
183
 
152
184
  - Fixed toggle button not shown in certain window dimensions in Material theme (see #11)
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = mkdocs-toggle-sidebar-plugin
3
- version = 0.0.8
3
+ version = 0.1.0
4
4
  author = six-two
5
5
  author_email = pip@six-two.dev
6
6
  description = Add keybindings to toggle the navigation and table of contents sidebars
@@ -25,8 +25,6 @@ package_dir =
25
25
  packages = find:
26
26
  python_requires = >=3.9
27
27
  scripts =
28
- install_requires =
29
- mkdocs>=1.5.0
30
28
 
31
29
  [options.entry_points]
32
30
  mkdocs.plugins =
@@ -1,11 +1,18 @@
1
+ import json
1
2
  import os
2
3
  import urllib.parse
4
+ import xml.etree.ElementTree as ET
3
5
  # pip dependency
4
- from mkdocs.plugins import BasePlugin, get_plugin_logger
5
- from mkdocs.config.defaults import MkDocsConfig
6
- from mkdocs.config.base import Config
7
- from mkdocs.config.config_options import Type, ExtraScriptValue
8
- from mkdocs.exceptions import PluginError
6
+ try:
7
+ from mkdocs.plugins import BasePlugin, get_plugin_logger
8
+ from mkdocs.config.defaults import MkDocsConfig
9
+ from mkdocs.config.base import Config
10
+ from mkdocs.config.config_options import Type
11
+ from mkdocs.exceptions import PluginError
12
+ except ImportError as ex:
13
+ print("[-] Error importing 'mkdocs'. Please install 'properdocs' (recommended) or 'mkdocs<=1.6.1' (deprecated) with pip")
14
+ exit(1)
15
+
9
16
 
10
17
  LOGGER = get_plugin_logger(__name__)
11
18
  SCRIPT_DIR = os.path.dirname(__file__)
@@ -13,9 +20,11 @@ ALLOWED_TOGGLE_BUTTON_VALUES = ["none", "navigation", "toc", "all"]
13
20
  # This is a map of compatible themes. For example 'ansible' inherits from 'material', so the material javascript will work for the ansible theme too
14
21
  THEME_COMPATIBILITY = {
15
22
  "ansible": "material",
23
+ "materialx": "material",
16
24
  }
17
25
  # May not always be accurate, this is just for a more helpful error message
18
26
  KNOWN_THEME_NAMES = ["material", "mkdocs", "readthedocs"] + list(THEME_COMPATIBILITY.keys())
27
+ 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
28
 
20
29
  class PluginConfig(Config):
21
30
  enabled = Type(bool, default=True)
@@ -27,6 +36,10 @@ class PluginConfig(Config):
27
36
  javascript = Type(str, default="assets/javascripts/toggle-sidebar.js")
28
37
  debug = Type(bool, default=False)
29
38
  inline = Type(bool, default=False)
39
+ button_toggle_both_tooltip = Type(str, default="Toggle Navigation and Table of Contents")
40
+ button_toggle_nav_tooltip = Type(str, default="Toggle Navigation")
41
+ button_toggle_toc_tooltip = Type(str, default="Toggle Table of Contents")
42
+ button_toggle_icon = Type(str, default=DEFAULT_TOGGLE_BUTTON_ICON)
30
43
 
31
44
 
32
45
  def is_known_theme(theme_name: str) -> bool:
@@ -49,14 +62,22 @@ def get_base_url_by_url(url: str):
49
62
  return './'
50
63
  return url.count('/') * '../'
51
64
 
65
+ def escape_for_javascript_string(value: str) -> str:
66
+ # JSON escaping should be save for text added to a double quote (") JavaScript string
67
+ return json.dumps(value)
68
+
52
69
  class Plugin(BasePlugin[PluginConfig]):
53
70
  def on_config(self, config: MkDocsConfig, **kwargs) -> MkDocsConfig:
54
71
  """
55
72
  Called once when the config is loaded.
56
73
  It will make modify the config and initialize this plugin.
57
74
  """
75
+ # This will raise an exception or print a warning if something is missconfigured
76
+ self.validate_config_options()
77
+
58
78
  self.theme_function_definitions = None
59
79
  self.inline_javascript = None
80
+
60
81
  if self.config.enabled:
61
82
  theme_name = self.config.theme
62
83
  # Default to automatically determining the theme
@@ -89,9 +110,29 @@ class Plugin(BasePlugin[PluginConfig]):
89
110
  # We cache it for performance reasons
90
111
  self.inline_javascript = f"<script>{self.get_toggle_sidebar_javascript(config)}</script>"
91
112
 
113
+ return config
114
+
115
+ def validate_config_options(self) -> None:
92
116
  if self.config.toggle_button not in ALLOWED_TOGGLE_BUTTON_VALUES:
93
117
  raise PluginError(f"Unexpected value for 'toggle_button': '{self.config.toggle_button}'. Allowed values are {', '.join(ALLOWED_TOGGLE_BUTTON_VALUES)}")
94
- return config
118
+
119
+ try:
120
+ root = ET.fromstring(self.config.button_toggle_icon)
121
+ width = root.get("width", "").replace("px", "")
122
+ height = root.get("height", "").replace("px", "")
123
+ # check size of SVG
124
+ if width and width != "24":
125
+ LOGGER.warning(f"button_toggle_icon should have a width of 24, but has {width}")
126
+ if height and height != "24":
127
+ LOGGER.warning(f"button_toggle_icon should have a height of 24, but has {height}")
128
+ # If width and height are not set, fall abck to viewbox
129
+ if not width and not height:
130
+ viewBox = root.get("viewBox", "")
131
+ if viewBox != "0 0 24 24":
132
+ LOGGER.warning(f"button_toggle_icon should have a size of 24x24, but has a viewbox of {viewBox} and no explicit size")
133
+
134
+ except Exception as ex:
135
+ LOGGER.error(f"Failed to parse and validate SVG button_toggle_icon: {ex}")
95
136
 
96
137
  def debug(self, message: str) -> None:
97
138
  if self.config.debug:
@@ -136,8 +177,13 @@ class Plugin(BasePlugin[PluginConfig]):
136
177
 
137
178
  with open(asset_path) as f:
138
179
  data = f.read()
139
- data = data.replace("THEME_DEPENDENT_FUNCTION_DEFINITION_PLACEHOLDER", self.theme_function_definitions)
180
+
181
+ data = data.replace("THEME_DEPENDENT_FUNCTION_DEFINITION_PLACEHOLDER", self.theme_function_definitions or "")
140
182
  data = data.replace("TOC_DEFAULT_PLACEHOLDER", "true" if self.config.show_toc_by_default else "false")
141
183
  data = data.replace("NAVIGATION_DEFAULT_PLACEHOLDER", "true" if self.config.show_toc_by_default else "false")
142
184
  data = data.replace("TOGGLE_BUTTON_PLACEHOLDER", self.config.toggle_button)
143
- return data
185
+ data = data.replace("BUTTON_TOGGLE_ICON_PLACEHOLDER", escape_for_javascript_string(self.config.button_toggle_icon))
186
+ data = data.replace("BUTTON_TOGGLE_BOTH_TOOLTIP_PLACEHOLDER", escape_for_javascript_string(self.config.button_toggle_both_tooltip))
187
+ data = data.replace("BUTTON_TOGGLE_NAV_TOOLTIP_PLACEHOLDER", escape_for_javascript_string(self.config.button_toggle_nav_tooltip))
188
+ data = data.replace("BUTTON_TOGGLE_TOC_TOOLTIP_PLACEHOLDER", escape_for_javascript_string(self.config.button_toggle_toc_tooltip))
189
+ 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 = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"></path></svg>`;
91
+ toggleBtn.innerHTML = BUTTON_TOGGLE_ICON_PLACEHOLDER;
92
92
  if (toggleNavigation && toggleTOC) {
93
- toggleBtn.title = "Toggle Navigation and Table of Contents";
93
+ toggleBtn.title = BUTTON_TOGGLE_BOTH_TOOLTIP_PLACEHOLDER;
94
94
  } else if (toggleNavigation) {
95
- toggleBtn.title = "Toggle Navigation";
95
+ toggleBtn.title = BUTTON_TOGGLE_NAV_TOOLTIP_PLACEHOLDER;
96
96
  } else if (toggleTOC) {
97
- toggleBtn.title = "Toggle Table of Contents";
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.8
3
+ Version: 0.1.0
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
@@ -17,7 +17,6 @@ Classifier: Programming Language :: Python :: 3.13
17
17
  Requires-Python: >=3.9
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: mkdocs>=1.5.0
21
20
  Dynamic: license-file
22
21
 
23
22
  # mkdocs-toggle-sidebar-plugin
@@ -38,6 +37,10 @@ The settings are stored using the `localStorage` object, so that it will persist
38
37
  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.
39
38
 
40
39
 
40
+ ## Note on Zensical, MkDocs 1.x, ProperDocs, etc
41
+
42
+ To make it easy to keep it up to date for all my plugins, I hosted my [intentions of what platforms to support](https://six-two.dev/plugin-support-for-mkdocs-and-forks/) on my website.
43
+
41
44
  ## Usage
42
45
 
43
46
  ### Setup
@@ -84,6 +87,10 @@ plugins:
84
87
  show_toc_by_default: False
85
88
  theme: material
86
89
  toggle_button: all
90
+ button_toggle_both_tooltip: Toggle Navigation and Table of Contents
91
+ button_toggle_nav_tooltip: Toggle Navigation
92
+ button_toggle_toc_tooltip: Toggle Table of Contents
93
+ 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
94
  ```
88
95
 
89
96
  The following options exist:
@@ -99,6 +106,10 @@ show_navigation_by_default | `bool` | `True` | Whether to show the navigation by
99
106
  show_toc_by_default | `bool` | `True` | Whether to show the table of contents by default
100
107
  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
108
  toggle_button | `str` | `"none"` | Can be set to show a toggle button (see below)
109
+ button_toggle_both_tooltip | `str` | `"Toggle Navigation and Table of Contents"` | Tooltip to show when `toggle_button` is `both`
110
+ button_toggle_nav_tooltip | `str` | `"Toggle Navigation"` | Tooltip to show when `toggle_button` is `navigation`
111
+ button_toggle_toc_tooltip | `str` | `"Toggle Table of Contents"` | Tooltip to show when `toggle_button` is `toc`
112
+ 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
113
 
103
114
 
104
115
  #### Toggle button
@@ -108,6 +119,16 @@ It is usually in the nav or the top bar.
108
119
  Clicking the button will toggle the navigation, table of contents, or both (depending on the supplied value).
109
120
  By leaving the field empty or setting it to `none`, no button is added.
110
121
 
122
+ You can set a custom icon for the button, using the `button_toggle_icon` configuration.
123
+ The icon should be a 24px square SVG file.
124
+
125
+ The tooltip shown when hovering over the button can also be changed.
126
+ Depending on which value you set in `toggle_button`, a different option is used:
127
+
128
+ - If `toggle_button` is `all`, then `button_toggle_both_tooltip` is used.
129
+ - If `toggle_button` is `navigation`, then `button_toggle_nav_tooltip` is used.
130
+ - If `toggle_button` is `toc`, then `button_toggle_toc_tooltip` is used.
131
+
111
132
  ### Exported API functions
112
133
 
113
134
  This plugin exposes some JavaScript functions, that can show, hide or toggle the visibility of the sidebars.
@@ -117,7 +138,7 @@ In short there are:
117
138
 
118
139
  - `MkdocsToggleSidebarPlugin.setNavigationVisibility(show: bool)`
119
140
  - `MkdocsToggleSidebarPlugin.setTocVisibility(show: bool)`
120
- - `MkdocsToggleSidebarPlugin.setAllVisibility: (showNavigation: bool, showTOC: bool)`
141
+ - `MkdocsToggleSidebarPlugin.setAllVisibility(showNavigation: bool, showTOC: bool)`
121
142
  - `MkdocsToggleSidebarPlugin.toggleNavigationVisibility()`
122
143
  - `MkdocsToggleSidebarPlugin.toggleTocVisibility()`
123
144
  - `MkdocsToggleSidebarPlugin.toggleAllVisibility()`
@@ -133,6 +154,7 @@ Theme | Theme version | Plugin version | Status
133
154
  --- | --- | --- | ---
134
155
  mkdocs-ansible | 25.6.0 | 0.0.6 | works
135
156
  mkdocs-material | 9.6.14 | 0.0.4+ | works
157
+ mkdocs-materialx | 10.1.5 | 0.1.0 | works
136
158
  mkdocs (default) | 1.6.1 | 0.0.4+ | works
137
159
  readthedocs | 1.6.1 | 0.0.4+ | works
138
160
 
@@ -169,6 +191,15 @@ docker run --rm -it -v "$PWD:/share" -w "/share" -p 8000:8000 --entrypoint=bash
169
191
 
170
192
  ## Notable changes
171
193
 
194
+ ### Version 0.1.0
195
+
196
+ - Added autodetection for [MaterialX](https://github.com/jaywhj/mkdocs-materialx) theme.
197
+ - Removed dependency declaration of `mkdocs`
198
+
199
+ ### Version 0.0.9
200
+
201
+ - 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)
202
+
172
203
  ### Version 0.0.8
173
204
 
174
205
  - Fixed toggle button not shown in certain window dimensions in Material theme (see #11)
@@ -12,5 +12,4 @@ src/mkdocs_toggle_sidebar_plugin.egg-info/PKG-INFO
12
12
  src/mkdocs_toggle_sidebar_plugin.egg-info/SOURCES.txt
13
13
  src/mkdocs_toggle_sidebar_plugin.egg-info/dependency_links.txt
14
14
  src/mkdocs_toggle_sidebar_plugin.egg-info/entry_points.txt
15
- src/mkdocs_toggle_sidebar_plugin.egg-info/requires.txt
16
15
  src/mkdocs_toggle_sidebar_plugin.egg-info/top_level.txt