mkdocs-header-dropdown 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.
- mkdocs_header_dropdown-0.1.0/CHANGELOG.md +28 -0
- mkdocs_header_dropdown-0.1.0/CONTRIBUTING.md +153 -0
- mkdocs_header_dropdown-0.1.0/LICENSE +21 -0
- mkdocs_header_dropdown-0.1.0/MANIFEST.in +7 -0
- mkdocs_header_dropdown-0.1.0/PKG-INFO +238 -0
- mkdocs_header_dropdown-0.1.0/QUICKSTART.md +186 -0
- mkdocs_header_dropdown-0.1.0/README.md +203 -0
- mkdocs_header_dropdown-0.1.0/USAGE.md +338 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown/__init__.py +3 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown/plugin.py +88 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown/templates/main.html +6 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown/templates/partials/header-dropdown.html +125 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown/templates/partials/header.html +74 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown.egg-info/PKG-INFO +238 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown.egg-info/SOURCES.txt +20 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown.egg-info/dependency_links.txt +1 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown.egg-info/entry_points.txt +2 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown.egg-info/requires.txt +2 -0
- mkdocs_header_dropdown-0.1.0/mkdocs_header_dropdown.egg-info/top_level.txt +1 -0
- mkdocs_header_dropdown-0.1.0/pyproject.toml +53 -0
- mkdocs_header_dropdown-0.1.0/setup.cfg +4 -0
- mkdocs_header_dropdown-0.1.0/setup.py +38 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2024-11-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of mkdocs-header-dropdown plugin
|
|
12
|
+
- Support for configurable dropdown menus in MkDocs Material theme header
|
|
13
|
+
- Multiple dropdown menus support
|
|
14
|
+
- Optional icon support for dropdowns
|
|
15
|
+
- Configurable links with text, URL, and target attributes
|
|
16
|
+
- Hover and click interactions
|
|
17
|
+
- Responsive design
|
|
18
|
+
- Dark/light mode compatibility
|
|
19
|
+
- Comprehensive documentation (README, QUICKSTART, USAGE, DEPLOYMENT)
|
|
20
|
+
- Example templates for header integration
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
- Plugin configuration via mkdocs.yml
|
|
24
|
+
- Jinja2 template integration
|
|
25
|
+
- Material theme CSS variable support
|
|
26
|
+
- No external dependencies beyond MkDocs
|
|
27
|
+
|
|
28
|
+
[0.1.0]: https://github.com/your-org/mkdocs-header-dropdown/releases/tag/v0.1.0
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Contributing to MkDocs Header Dropdown Plugin
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the MkDocs Header Dropdown Plugin!
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
### Reporting Issues
|
|
8
|
+
|
|
9
|
+
If you find a bug or have a feature request:
|
|
10
|
+
|
|
11
|
+
1. Check if the issue already exists in [GitHub Issues](https://github.com/cms-cat/mkdocs-header-dropdown/issues)
|
|
12
|
+
2. If not, create a new issue with:
|
|
13
|
+
- Clear title and description
|
|
14
|
+
- Steps to reproduce (for bugs)
|
|
15
|
+
- Expected vs actual behavior
|
|
16
|
+
- MkDocs and plugin versions
|
|
17
|
+
- Sample configuration (if applicable)
|
|
18
|
+
|
|
19
|
+
### Submitting Changes
|
|
20
|
+
|
|
21
|
+
1. **Fork the repository** on GitHub
|
|
22
|
+
|
|
23
|
+
2. **Clone your fork**:
|
|
24
|
+
```bash
|
|
25
|
+
git clone https://github.com/YOUR-USERNAME/mkdocs-header-dropdown.git
|
|
26
|
+
cd mkdocs-header-dropdown
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. **Create a branch**:
|
|
30
|
+
```bash
|
|
31
|
+
git checkout -b feature/your-feature-name
|
|
32
|
+
# or
|
|
33
|
+
git checkout -b fix/your-bug-fix
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. **Make your changes**:
|
|
37
|
+
- Follow the existing code style
|
|
38
|
+
- Add tests if applicable
|
|
39
|
+
- Update documentation if needed
|
|
40
|
+
|
|
41
|
+
5. **Test your changes**:
|
|
42
|
+
```bash
|
|
43
|
+
# Install in development mode
|
|
44
|
+
pip install -e .
|
|
45
|
+
|
|
46
|
+
# Test with a sample MkDocs site
|
|
47
|
+
cd /path/to/test/site
|
|
48
|
+
mkdocs build
|
|
49
|
+
mkdocs serve
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
6. **Commit your changes**:
|
|
53
|
+
```bash
|
|
54
|
+
git add .
|
|
55
|
+
git commit -m "Add: Brief description of your changes"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Use commit message prefixes:
|
|
59
|
+
- `Add:` for new features
|
|
60
|
+
- `Fix:` for bug fixes
|
|
61
|
+
- `Update:` for improvements to existing features
|
|
62
|
+
- `Docs:` for documentation changes
|
|
63
|
+
- `Refactor:` for code refactoring
|
|
64
|
+
|
|
65
|
+
7. **Push to your fork**:
|
|
66
|
+
```bash
|
|
67
|
+
git push origin feature/your-feature-name
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
8. **Create a Pull Request**:
|
|
71
|
+
- Go to the original repository
|
|
72
|
+
- Click "New Pull Request"
|
|
73
|
+
- Select your fork and branch
|
|
74
|
+
- Describe your changes
|
|
75
|
+
|
|
76
|
+
## Development Setup
|
|
77
|
+
|
|
78
|
+
### Prerequisites
|
|
79
|
+
|
|
80
|
+
- Python 3.7 or higher
|
|
81
|
+
- MkDocs >= 1.4.0
|
|
82
|
+
- Material for MkDocs theme
|
|
83
|
+
|
|
84
|
+
### Installation
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Clone the repository
|
|
88
|
+
git clone https://github.com/cms-cat/mkdocs-header-dropdown.git
|
|
89
|
+
cd mkdocs-header-dropdown
|
|
90
|
+
|
|
91
|
+
# Install in development mode
|
|
92
|
+
pip install -e .
|
|
93
|
+
|
|
94
|
+
# Or with development dependencies (if we add them later)
|
|
95
|
+
pip install -e ".[dev]"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Testing
|
|
99
|
+
|
|
100
|
+
To test your changes:
|
|
101
|
+
|
|
102
|
+
1. Create a test MkDocs site or use an existing one
|
|
103
|
+
2. Install the plugin in development mode
|
|
104
|
+
3. Configure the plugin in `mkdocs.yml`
|
|
105
|
+
4. Run `mkdocs serve` and verify functionality
|
|
106
|
+
5. Test with different configurations
|
|
107
|
+
6. Test with light and dark themes
|
|
108
|
+
|
|
109
|
+
## Code Style
|
|
110
|
+
|
|
111
|
+
- Follow PEP 8 Python style guide
|
|
112
|
+
- Use meaningful variable and function names
|
|
113
|
+
- Add docstrings to classes and functions
|
|
114
|
+
- Keep functions focused and small
|
|
115
|
+
- Comment complex logic
|
|
116
|
+
|
|
117
|
+
## Documentation
|
|
118
|
+
|
|
119
|
+
When adding new features:
|
|
120
|
+
|
|
121
|
+
- Update README.md with basic usage
|
|
122
|
+
- Update USAGE.md with detailed examples
|
|
123
|
+
- Add examples to QUICKSTART.md if applicable
|
|
124
|
+
- Update CHANGELOG.md with your changes
|
|
125
|
+
|
|
126
|
+
## Version Numbering
|
|
127
|
+
|
|
128
|
+
We follow [Semantic Versioning](https://semver.org/):
|
|
129
|
+
|
|
130
|
+
- MAJOR version for incompatible API changes
|
|
131
|
+
- MINOR version for new functionality (backwards compatible)
|
|
132
|
+
- PATCH version for bug fixes (backwards compatible)
|
|
133
|
+
|
|
134
|
+
## Release Process
|
|
135
|
+
|
|
136
|
+
Maintainers will handle releases:
|
|
137
|
+
|
|
138
|
+
1. Update version in `pyproject.toml` and `setup.py`
|
|
139
|
+
2. Update CHANGELOG.md
|
|
140
|
+
3. Create a git tag: `git tag -a vX.Y.Z -m "Release vX.Y.Z"`
|
|
141
|
+
4. Push tag: `git push origin vX.Y.Z`
|
|
142
|
+
5. Create GitHub release from tag
|
|
143
|
+
|
|
144
|
+
## Questions?
|
|
145
|
+
|
|
146
|
+
Feel free to:
|
|
147
|
+
- Open an issue for questions
|
|
148
|
+
- Start a discussion on GitHub Discussions (if enabled)
|
|
149
|
+
- Contact the maintainers
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 CMS Common Analysis Tools
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mkdocs-header-dropdown
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A MkDocs plugin to add configurable dropdown menus to the Material theme header
|
|
5
|
+
Home-page: https://github.com/cms-cat/mkdocs-header-dropdown
|
|
6
|
+
Author: CMS Common Analysis Tools
|
|
7
|
+
Maintainer: CMS Common Analysis Tools
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/cms-cat/mkdocs-header-dropdown
|
|
10
|
+
Project-URL: Repository, https://github.com/cms-cat/mkdocs-header-dropdown
|
|
11
|
+
Project-URL: Issues, https://github.com/cms-cat/mkdocs-header-dropdown/issues
|
|
12
|
+
Project-URL: Documentation, https://github.com/cms-cat/mkdocs-header-dropdown#readme
|
|
13
|
+
Keywords: mkdocs,plugin,dropdown,navigation,material-theme,documentation
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Topic :: Documentation
|
|
17
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
18
|
+
Classifier: Framework :: MkDocs
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Operating System :: OS Independent
|
|
27
|
+
Requires-Python: >=3.7
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: mkdocs>=1.4.0
|
|
31
|
+
Requires-Dist: pyyaml
|
|
32
|
+
Dynamic: home-page
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
|
|
36
|
+
# MkDocs Header Dropdown Plugin
|
|
37
|
+
|
|
38
|
+
A MkDocs plugin that adds configurable dropdown menus to the Material theme header. This plugin allows you to create cross-documentation navigation menus that can be shared across multiple documentation sites.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### From Source (Local Development)
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install -e /path/to/mkdocs_header_dropdown
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### From Git Repository
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install git+https://github.com/cms-cat/mkdocs-header-dropdown.git
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
### Option 1: Using a Shared Config (Recommended for Organizations)
|
|
57
|
+
|
|
58
|
+
If you're part of an organization with shared documentation links:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Add the shared config as a git submodule
|
|
62
|
+
git submodule add https://github.com/your-org/docs-common.git
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
# mkdocs.yml
|
|
67
|
+
plugins:
|
|
68
|
+
- search
|
|
69
|
+
- header-dropdown:
|
|
70
|
+
config_file: "docs-common/header-dropdown.yml"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Option 2: Direct Configuration
|
|
74
|
+
|
|
75
|
+
For standalone projects:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
# mkdocs.yml
|
|
79
|
+
plugins:
|
|
80
|
+
- search
|
|
81
|
+
- header-dropdown:
|
|
82
|
+
dropdowns:
|
|
83
|
+
- title: "Documentation"
|
|
84
|
+
links:
|
|
85
|
+
- text: "Getting Started"
|
|
86
|
+
url: "/getting-started/"
|
|
87
|
+
- text: "User Guide"
|
|
88
|
+
url: "/guide/"
|
|
89
|
+
- text: "API Reference"
|
|
90
|
+
url: "/api/"
|
|
91
|
+
- title: "External Links"
|
|
92
|
+
links:
|
|
93
|
+
- text: "GitHub Repository"
|
|
94
|
+
url: "https://github.com/your-org/your-project"
|
|
95
|
+
target: "_blank"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**That's it!** The plugin automatically provides the necessary templates. No manual template overrides required.
|
|
99
|
+
|
|
100
|
+
## Configuration Options
|
|
101
|
+
|
|
102
|
+
### Plugin Configuration
|
|
103
|
+
|
|
104
|
+
The plugin supports two ways to configure dropdowns, which can be combined:
|
|
105
|
+
|
|
106
|
+
1. **`config_file`** (string, optional): Load dropdown configuration from a YAML file
|
|
107
|
+
- Path is relative to the repository root
|
|
108
|
+
- Useful for sharing configuration across multiple repositories via git submodules
|
|
109
|
+
|
|
110
|
+
2. **`dropdowns`** (list, optional): Define dropdowns directly in mkdocs.yml
|
|
111
|
+
|
|
112
|
+
Both sources are merged together, allowing you to extend shared configs with repository-specific dropdowns.
|
|
113
|
+
|
|
114
|
+
### Dropdown Configuration
|
|
115
|
+
|
|
116
|
+
Each dropdown in the `dropdowns` list supports:
|
|
117
|
+
|
|
118
|
+
- `title` (string, required): The text displayed on the dropdown button
|
|
119
|
+
- `icon` (string, optional): Path to an icon image displayed next to the title
|
|
120
|
+
- `links` (list, required): List of links in the dropdown menu
|
|
121
|
+
|
|
122
|
+
### Link Configuration
|
|
123
|
+
|
|
124
|
+
Each link in the `links` list supports:
|
|
125
|
+
|
|
126
|
+
- `text` (string, required): The text displayed for the link
|
|
127
|
+
- `url` (string, optional): The URL the link points to (not needed if using `submenu`)
|
|
128
|
+
- `target` (string, optional): The target attribute (e.g., `_blank` for new tab)
|
|
129
|
+
- `submenu` (list, optional): List of nested links for a submenu (see Nested Dropdowns below)
|
|
130
|
+
|
|
131
|
+
## Example: Using Shared Config File
|
|
132
|
+
|
|
133
|
+
For multiple repositories that share the same dropdown configuration (e.g., via git submodule):
|
|
134
|
+
|
|
135
|
+
**Step 1**: Create a shared config repository with `header-dropdown.yml`:
|
|
136
|
+
```yaml
|
|
137
|
+
dropdowns:
|
|
138
|
+
- title: "CMS POG Docs"
|
|
139
|
+
icon: "/assets/CMSlogo_white_nolabel_1024_May2014.png"
|
|
140
|
+
links:
|
|
141
|
+
- text: "Analysis Corrections | CrossPOG"
|
|
142
|
+
url: "https://cms-analysis-corrections.docs.cern.ch/"
|
|
143
|
+
target: "_blank"
|
|
144
|
+
- text: "BTV Docs"
|
|
145
|
+
url: "https://btv-wiki.docs.cern.ch/"
|
|
146
|
+
target: "_blank"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Step 2**: Add as git submodule and reference in `mkdocs.yml`:
|
|
150
|
+
```bash
|
|
151
|
+
git submodule add https://github.com/your-org/cms-docs-config.git
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
plugins:
|
|
156
|
+
- header-dropdown:
|
|
157
|
+
config_file: "cms-docs-config/header-dropdown.yml"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Example: Multiple Dropdowns
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
plugins:
|
|
164
|
+
- header-dropdown:
|
|
165
|
+
dropdowns:
|
|
166
|
+
- title: "CMS POG Docs"
|
|
167
|
+
icon: "/assets/cms-logo.png"
|
|
168
|
+
links:
|
|
169
|
+
- text: "BTV Docs"
|
|
170
|
+
url: "https://btv-wiki.docs.cern.ch/"
|
|
171
|
+
target: "_blank"
|
|
172
|
+
- text: "JetMet TWiki"
|
|
173
|
+
url: "https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetMET"
|
|
174
|
+
- title: "External Resources"
|
|
175
|
+
links:
|
|
176
|
+
- text: "GitHub"
|
|
177
|
+
url: "https://github.com/cms-cat"
|
|
178
|
+
target: "_blank"
|
|
179
|
+
- text: "GitLab"
|
|
180
|
+
url: "https://gitlab.cern.ch/cms-analysis"
|
|
181
|
+
target: "_blank"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Example: Nested Dropdowns
|
|
185
|
+
|
|
186
|
+
Create submenus by using `submenu` instead of `url`:
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
plugins:
|
|
190
|
+
- header-dropdown:
|
|
191
|
+
dropdowns:
|
|
192
|
+
- title: "Resources"
|
|
193
|
+
links:
|
|
194
|
+
- text: "GitHub"
|
|
195
|
+
url: "https://github.com/example"
|
|
196
|
+
- text: "Documentation" # This will show an arrow
|
|
197
|
+
submenu:
|
|
198
|
+
- text: "User Guide"
|
|
199
|
+
url: "/guide/"
|
|
200
|
+
target: "_blank"
|
|
201
|
+
- text: "API Reference"
|
|
202
|
+
url: "/api/"
|
|
203
|
+
- text: "Tutorials"
|
|
204
|
+
url: "/tutorials/"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Nested dropdowns:
|
|
208
|
+
- Show an arrow indicator (▶) automatically
|
|
209
|
+
- Appear to the right on hover
|
|
210
|
+
- Support multiple levels of nesting
|
|
211
|
+
- Work with keyboard navigation
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Features
|
|
215
|
+
|
|
216
|
+
- **Shared configuration**: Load dropdown config from external YAML files via git submodules
|
|
217
|
+
- **Flexible configuration**: Mix shared configs with repository-specific dropdowns
|
|
218
|
+
- **Nested dropdowns**: Create multi-level submenus with arrow indicators
|
|
219
|
+
- **Multiple dropdown menus**: Support for any number of dropdowns
|
|
220
|
+
- **Configurable icons and titles**: Customize appearance
|
|
221
|
+
- **Hover and click interactions**: User-friendly interactions
|
|
222
|
+
- **Responsive design**: Works on all screen sizes
|
|
223
|
+
- **Theme integration**: Works with Material theme's light and dark modes
|
|
224
|
+
- **Accessible**: Keyboard-friendly navigation
|
|
225
|
+
- **No manual overrides**: Plugin automatically provides necessary templates
|
|
226
|
+
|
|
227
|
+
## Requirements
|
|
228
|
+
|
|
229
|
+
- MkDocs >= 1.4.0
|
|
230
|
+
- Material for MkDocs theme
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
MIT License
|
|
235
|
+
|
|
236
|
+
## Contributing
|
|
237
|
+
|
|
238
|
+
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Quick Start Guide - MkDocs Header Dropdown Plugin
|
|
2
|
+
|
|
3
|
+
## What This Plugin Does
|
|
4
|
+
|
|
5
|
+
The `mkdocs-header-dropdown` plugin allows you to add configurable dropdown menus to your MkDocs Material theme header. This is perfect for organizations with multiple documentation sites that need cross-linking navigation.
|
|
6
|
+
|
|
7
|
+
## Installation & Setup (5 Minutes)
|
|
8
|
+
|
|
9
|
+
### Step 1: Install the Plugin
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# For local development
|
|
13
|
+
pip install -e /path/to/mkdocs-header-dropdown-plugin
|
|
14
|
+
|
|
15
|
+
# OR from Git repository (once published)
|
|
16
|
+
pip install git+https://gitlab.cern.ch/cms-analysis/mkdocs-header-dropdown.git
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Step 2: Add Plugin Configuration
|
|
20
|
+
|
|
21
|
+
Add this to your `mkdocs.yml`:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
plugins:
|
|
25
|
+
- search
|
|
26
|
+
- header-dropdown:
|
|
27
|
+
dropdowns:
|
|
28
|
+
- title: "CMS POG Docs"
|
|
29
|
+
icon: "/assets/CMSlogo_white_nolabel_1024_May2014.png"
|
|
30
|
+
links:
|
|
31
|
+
- text: "Analysis Corrections | CrossPOG"
|
|
32
|
+
url: "https://cms-analysis-corrections.docs.cern.ch/"
|
|
33
|
+
target: "_blank"
|
|
34
|
+
- text: "BTV Docs"
|
|
35
|
+
url: "https://btv-wiki.docs.cern.ch/"
|
|
36
|
+
target: "_blank"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Step 3: Copy Template Files
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Create overrides directory if it doesn't exist
|
|
43
|
+
mkdir -p overrides/partials
|
|
44
|
+
|
|
45
|
+
# Copy the dropdown template
|
|
46
|
+
cp /path/to/plugin/templates/partials/header-dropdown.html overrides/partials/
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If you don't have a custom header already, also copy the header template:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cp /path/to/plugin/templates/partials/header.html overrides/partials/
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If you DO have a custom header, add this line where you want the dropdown:
|
|
56
|
+
|
|
57
|
+
```jinja
|
|
58
|
+
{% include "partials/header-dropdown.html" %}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Step 4: Configure Theme
|
|
62
|
+
|
|
63
|
+
Make sure your `mkdocs.yml` has:
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
theme:
|
|
67
|
+
name: material
|
|
68
|
+
custom_dir: overrides
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Step 5: Build or Serve
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Build the site
|
|
75
|
+
mkdocs build
|
|
76
|
+
|
|
77
|
+
# Or serve locally
|
|
78
|
+
mkdocs serve
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## For This Project (cat-docs)
|
|
82
|
+
|
|
83
|
+
### Local Development
|
|
84
|
+
|
|
85
|
+
Use the new local serve script:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
./serve-local.sh
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This script:
|
|
92
|
+
- Uses your locally installed plugin
|
|
93
|
+
- Initializes submodules if needed
|
|
94
|
+
- Generates correction digest
|
|
95
|
+
- Starts the dev server on http://127.0.0.1:8000
|
|
96
|
+
|
|
97
|
+
### Using Docker
|
|
98
|
+
|
|
99
|
+
The original `serve.sh` has been updated to work with the plugin:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
./serve.sh
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This script:
|
|
106
|
+
- Mounts the plugin directory into the Docker container
|
|
107
|
+
- Installs the plugin in the container
|
|
108
|
+
- Runs mkdocs serve
|
|
109
|
+
|
|
110
|
+
## Troubleshooting
|
|
111
|
+
|
|
112
|
+
### "Plugin is not installed" Error
|
|
113
|
+
|
|
114
|
+
**Solution**: Make sure you installed the plugin in your current Python environment:
|
|
115
|
+
```bash
|
|
116
|
+
pip install -e /path/to/mkdocs-header-dropdown-plugin
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Verify installation:
|
|
120
|
+
```bash
|
|
121
|
+
pip list | grep mkdocs-header-dropdown
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Dropdown Not Showing
|
|
125
|
+
|
|
126
|
+
**Solution**:
|
|
127
|
+
1. Check that you copied `header-dropdown.html` to `overrides/partials/`
|
|
128
|
+
2. Verify you have `custom_dir: overrides` in your theme config
|
|
129
|
+
3. Make sure your header includes `{% include "partials/header-dropdown.html" %}`
|
|
130
|
+
|
|
131
|
+
### Submodule Issues
|
|
132
|
+
|
|
133
|
+
If you get file not found errors related to systematics:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
git submodule update --init --recursive
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Next Steps
|
|
140
|
+
|
|
141
|
+
- See [USAGE.md](USAGE.md) for detailed configuration options
|
|
142
|
+
- See [DEPLOYMENT.md](DEPLOYMENT.md) for sharing across projects
|
|
143
|
+
- See [README.md](README.md) for full documentation
|
|
144
|
+
|
|
145
|
+
## Example Configuration
|
|
146
|
+
|
|
147
|
+
Here's a complete example with multiple dropdowns:
|
|
148
|
+
|
|
149
|
+
```yaml
|
|
150
|
+
theme:
|
|
151
|
+
name: material
|
|
152
|
+
custom_dir: overrides
|
|
153
|
+
|
|
154
|
+
plugins:
|
|
155
|
+
- search
|
|
156
|
+
- header-dropdown:
|
|
157
|
+
dropdowns:
|
|
158
|
+
# Primary dropdown for POG docs
|
|
159
|
+
- title: "CMS POG Docs"
|
|
160
|
+
icon: "/assets/cms-logo.png"
|
|
161
|
+
links:
|
|
162
|
+
- text: "Analysis Corrections"
|
|
163
|
+
url: "https://cms-analysis-corrections.docs.cern.ch/"
|
|
164
|
+
target: "_blank"
|
|
165
|
+
- text: "BTV Wiki"
|
|
166
|
+
url: "https://btv-wiki.docs.cern.ch/"
|
|
167
|
+
target: "_blank"
|
|
168
|
+
- text: "Muon Wiki"
|
|
169
|
+
url: "https://muon-wiki.docs.cern.ch/"
|
|
170
|
+
target: "_blank"
|
|
171
|
+
|
|
172
|
+
# Secondary dropdown for tools
|
|
173
|
+
- title: "Tools"
|
|
174
|
+
links:
|
|
175
|
+
- text: "GitLab"
|
|
176
|
+
url: "https://gitlab.cern.ch/cms-analysis"
|
|
177
|
+
target: "_blank"
|
|
178
|
+
- text: "GitHub"
|
|
179
|
+
url: "https://github.com/cms-cat"
|
|
180
|
+
target: "_blank"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Support
|
|
184
|
+
|
|
185
|
+
- Issues: https://gitlab.cern.ch/cms-analysis/mkdocs-header-dropdown/issues
|
|
186
|
+
- Email: cms-phys-conveners-CAT@cern.ch
|