mkdocs-smzhbook-theme 1.1__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.
@@ -0,0 +1,8 @@
1
+ *.pyc
2
+ dist/
3
+ mkdocs_basic_theme.egg-info/
4
+ site/
5
+ .venv
6
+ uv.lock
7
+ .idea
8
+ .playwright-mcp
@@ -0,0 +1,26 @@
1
+ Copyright © 2015, Dougal Matthews. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or
4
+ without modification, are permitted provided that the following
5
+ conditions are met:
6
+
7
+ Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in
11
+ the documentation and/or other materials provided with the
12
+ distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
15
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
+ POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.4
2
+ Name: mkdocs-smzhbook-theme
3
+ Version: 1.1
4
+ Summary: smallzh's book theme for MkDocs
5
+ Project-URL: Source, https://github.com/smallzh/mkdocs-smzhbook-theme
6
+ Author-email: smallzh <smallzh@yeah.net>
7
+ License-Expression: BSD-2-Clause
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Environment :: Web Environment
11
+ Classifier: Framework :: MkDocs
12
+ Classifier: Intended Audience :: Information Technology
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Topic :: Documentation
16
+ Requires-Dist: mkdocs>=1.5
17
+ Description-Content-Type: text/markdown
18
+
19
+ # MkDocs Smzhbook Theme
20
+
21
+ blog.smallzh.top网站使用的主题,基于[MkDocs](https://mkdocs.readthedocs.io/) 构建。
22
+
23
+
24
+ ## 0x00.使用
25
+
26
+ ### 安装主题
27
+
28
+ ```shell
29
+ pip install mkdocs-smzhbook-theme
30
+ ```
31
+
32
+ ### 配置 MkDocs
33
+
34
+ 在 `mkdocs.yml` 中设置主题:
35
+
36
+ ```yaml
37
+ site_name: Your Site Name
38
+ theme:
39
+ name: smzhbook
40
+ ```
41
+
42
+ ### 自定义样式和脚本
43
+
44
+ ```yaml
45
+ extra_css:
46
+ - custom.css
47
+
48
+ extra_javascript:
49
+ - custom.js
50
+ ```
51
+
52
+ ### 本地开发主题
53
+
54
+ 如果需要在本地直接使用主题源码(而非安装的包),可以在 `mkdocs.yml` 中直接指定主题目录:
55
+
56
+ ```yaml
57
+ theme:
58
+ name: null
59
+ dir: /path/to/mkdocs-smzhbook-theme/smzhbook_theme
60
+ ```
61
+
62
+ ## 0x01.开发
63
+ 先安装 [uv](https://docs.astral.sh/uv/) ,再执行以下命令
64
+
65
+ ```shell
66
+ # 创建虚拟环境
67
+ uv venv .venv
68
+ # 安装 mkdocs
69
+ uv pip install mkdocs
70
+ # 启动
71
+ uv run mkdocs serve
72
+ ```
73
+
74
+ ## 0xFF.感谢
75
+
76
+ 1. [MkDocs](https://mkdocs.readthedocs.io/) ,简单易用的静态站点生成器
77
+ 2. [mkdocs-basic-theme](https://mkdocs.github.io/mkdocs-basic-theme/) , mkdocs的基础主题库
78
+
79
+ [![PyPI Downloads][pypi-dl-image]][pypi-dl-link]
80
+ [![PyPI Version][pypi-v-image]][pypi-v-link]
81
+
82
+ [pypi-dl-image]: https://img.shields.io/pypi/dm/mkdocs-smzhbook-theme.png
83
+ [pypi-dl-link]: https://pypi.python.org/pypi/mkdocs-smzhbook-theme
84
+ [pypi-v-image]: https://img.shields.io/pypi/v/mkdocs-smzhbook-theme.png
85
+ [pypi-v-link]: https://pypi.python.org/pypi/mkdocs-smzhbook-theme
86
+
@@ -0,0 +1,68 @@
1
+ # MkDocs Smzhbook Theme
2
+
3
+ blog.smallzh.top网站使用的主题,基于[MkDocs](https://mkdocs.readthedocs.io/) 构建。
4
+
5
+
6
+ ## 0x00.使用
7
+
8
+ ### 安装主题
9
+
10
+ ```shell
11
+ pip install mkdocs-smzhbook-theme
12
+ ```
13
+
14
+ ### 配置 MkDocs
15
+
16
+ 在 `mkdocs.yml` 中设置主题:
17
+
18
+ ```yaml
19
+ site_name: Your Site Name
20
+ theme:
21
+ name: smzhbook
22
+ ```
23
+
24
+ ### 自定义样式和脚本
25
+
26
+ ```yaml
27
+ extra_css:
28
+ - custom.css
29
+
30
+ extra_javascript:
31
+ - custom.js
32
+ ```
33
+
34
+ ### 本地开发主题
35
+
36
+ 如果需要在本地直接使用主题源码(而非安装的包),可以在 `mkdocs.yml` 中直接指定主题目录:
37
+
38
+ ```yaml
39
+ theme:
40
+ name: null
41
+ dir: /path/to/mkdocs-smzhbook-theme/smzhbook_theme
42
+ ```
43
+
44
+ ## 0x01.开发
45
+ 先安装 [uv](https://docs.astral.sh/uv/) ,再执行以下命令
46
+
47
+ ```shell
48
+ # 创建虚拟环境
49
+ uv venv .venv
50
+ # 安装 mkdocs
51
+ uv pip install mkdocs
52
+ # 启动
53
+ uv run mkdocs serve
54
+ ```
55
+
56
+ ## 0xFF.感谢
57
+
58
+ 1. [MkDocs](https://mkdocs.readthedocs.io/) ,简单易用的静态站点生成器
59
+ 2. [mkdocs-basic-theme](https://mkdocs.github.io/mkdocs-basic-theme/) , mkdocs的基础主题库
60
+
61
+ [![PyPI Downloads][pypi-dl-image]][pypi-dl-link]
62
+ [![PyPI Version][pypi-v-image]][pypi-v-link]
63
+
64
+ [pypi-dl-image]: https://img.shields.io/pypi/dm/mkdocs-smzhbook-theme.png
65
+ [pypi-dl-link]: https://pypi.python.org/pypi/mkdocs-smzhbook-theme
66
+ [pypi-v-image]: https://img.shields.io/pypi/v/mkdocs-smzhbook-theme.png
67
+ [pypi-v-link]: https://pypi.python.org/pypi/mkdocs-smzhbook-theme
68
+
@@ -0,0 +1,34 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "mkdocs-smzhbook-theme"
7
+ version = "1.1"
8
+ description = "smallzh's book theme for MkDocs"
9
+ readme = "README.md"
10
+ license = "BSD-2-Clause"
11
+ authors = [
12
+ {name = "smallzh", email = "smallzh@yeah.net"},
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 5 - Production/Stable",
16
+ "Environment :: Web Environment",
17
+ "Framework :: MkDocs",
18
+ "Intended Audience :: Information Technology",
19
+ "License :: OSI Approved :: BSD License",
20
+ "Operating System :: OS Independent",
21
+ "Topic :: Documentation",
22
+ ]
23
+ dependencies = [
24
+ "mkdocs>=1.5",
25
+ ]
26
+
27
+ [project.urls]
28
+ Source = "https://github.com/smallzh/mkdocs-smzhbook-theme"
29
+
30
+ [project.entry-points."mkdocs.themes"]
31
+ smzhbook = "smzhbook_theme"
32
+
33
+ [tool.hatch.build]
34
+ include = ["/smzhbook_theme"]
File without changes
@@ -0,0 +1,284 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
+ <meta name="HandheldFriendly" content="true">
8
+ <meta name="apple-mobile-web-app-capable" content="yes">
9
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
10
+
11
+ <!-- 页面标题 -->
12
+ <title>{% if page and page.title %}{{ page.title }} - {% endif %}{{ config.site_name }}</title>
13
+
14
+ <!-- 站点描述 -->
15
+ {% if config.site_description %}
16
+ <meta name="description" content="{{ config.site_description }}">
17
+ {% endif %}
18
+
19
+ <!-- 作者信息 -->
20
+ {% if config.site_author %}
21
+ <meta name="author" content="{{ config.site_author }}">
22
+ {% endif %}
23
+
24
+ <!-- 生成器信息 -->
25
+ <meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-smzhbook-{{ config.theme.version }}">
26
+
27
+ <!-- Favicon -->
28
+ <link rel="shortcut icon" href="{{ "img/favicon.ico"|url }}" type="image/x-icon">
29
+
30
+ <!-- 主题 CSS -->
31
+ <link rel="stylesheet" href="{{ "css/theme.css"|url }}">
32
+
33
+ <!-- 用户自定义 CSS -->
34
+ {% for path in config.extra_css %}
35
+ <link href="{{ path|url }}" rel="stylesheet">
36
+ {% endfor %}
37
+
38
+ {% block extrahead %}
39
+ {% endblock %}
40
+
41
+ <!-- 用户自定义 JavaScript -->
42
+ {% for script in config.extra_javascript %}
43
+ {{ script | script_tag }}
44
+ {% endfor %}
45
+
46
+ </head>
47
+
48
+ <body>
49
+ <div id="app">
50
+ <!-- 顶部导航栏 -->
51
+ <header class="vp-nav">
52
+ <div class="vp-nav-bar">
53
+ <!-- 移动端菜单按钮 -->
54
+ <button class="vp-menu-toggle" aria-label="切换导航菜单">
55
+ <span class="vp-menu-icon"></span>
56
+ </button>
57
+
58
+ <!-- Logo/站点名称 -->
59
+ <div class="vp-nav-bar-title">
60
+ <a href="{{ nav.homepage.url|url }}" class="vp-nav-bar-logo">
61
+ {% if config.extra.logo %}
62
+ <img src="{{ config.extra.logo|url }}" alt="{{ config.site_name }}" class="vp-logo">
63
+ {% endif %}
64
+ <span class="vp-site-name">{{ config.site_name }}</span>
65
+ </a>
66
+ </div>
67
+
68
+ <!-- 顶部导航菜单 -->
69
+ <div class="vp-nav-bar-content">
70
+ {% if config.nav %}
71
+ <nav class="vp-nav-bar-menu">
72
+ {% for nav_item in config.nav %}
73
+ <div class="vp-nav-bar-menu-item{% if nav_item.children %} has-dropdown{% endif %}">
74
+ {% if nav_item.children %}
75
+ <button class="vp-nav-bar-menu-link">
76
+ {{ nav_item.title }}
77
+ <span class="vp-dropdown-icon"></span>
78
+ </button>
79
+ <div class="vp-nav-bar-dropdown">
80
+ {% for child in nav_item.children %}
81
+ <a href="{{ child.url|url }}" class="vp-nav-bar-dropdown-link">
82
+ {{ child.title }}
83
+ </a>
84
+ {% endfor %}
85
+ </div>
86
+ {% else %}
87
+ <a href="{{ nav_item.url|url }}" class="vp-nav-bar-menu-link">
88
+ {{ nav_item.title }}
89
+ </a>
90
+ {% endif %}
91
+ </div>
92
+ {% endfor %}
93
+ </nav>
94
+ {% endif %}
95
+
96
+ <!-- 搜索框 -->
97
+ {% if 'search' in config['plugins'] %}
98
+ <div class="vp-nav-bar-search">
99
+ <div id="book-search-input">
100
+ <input type="text" placeholder="搜索文档..." />
101
+ <span class="vp-search-key">⌘ K</span>
102
+ </div>
103
+ </div>
104
+ {% endif %}
105
+ </div>
106
+ </div>
107
+ </header>
108
+
109
+ <!-- 主体布局 -->
110
+ <div class="vp-layout">
111
+ <!-- 左侧侧边栏 -->
112
+ <aside class="vp-sidebar" id="vp-sidebar">
113
+ <div class="vp-sidebar-backdrop"></div>
114
+ <div class="vp-sidebar-container">
115
+ <nav class="vp-sidebar-nav" role="navigation">
116
+ <div class="vp-sidebar-group">
117
+ <ul class="vp-sidebar-links">
118
+ <!-- 导航项 -->
119
+ {% for nav_item in nav %}
120
+ {% if nav_item.children %}
121
+ <!-- 有子菜单的项 - 渲染分组标题和子项 -->
122
+ <li class="vp-sidebar-section">
123
+ <p class="vp-sidebar-section-title">{{ nav_item.title }}</p>
124
+ <ul class="vp-sidebar-section-items">
125
+ {% for child in nav_item.children %}
126
+ <li class="vp-sidebar-item{% if child.active %} active{% endif %}">
127
+ <a href="{{ child.url|url }}" class="vp-sidebar-link">
128
+ {{ child.title }}
129
+ </a>
130
+ </li>
131
+ {% endfor %}
132
+ </ul>
133
+ </li>
134
+ {% else %}
135
+ <!-- 单页项 -->
136
+ <li class="vp-sidebar-item{% if nav_item.active %} active{% endif %}">
137
+ <a href="{{ nav_item.url|url }}" class="vp-sidebar-link">
138
+ {{ nav_item.title }}
139
+ </a>
140
+ </li>
141
+ {% endif %}
142
+ {% endfor %}
143
+ </ul>
144
+ </div>
145
+ </nav>
146
+ </div>
147
+ </aside>
148
+
149
+ <!-- 主内容区域 -->
150
+ <main class="vp-content" id="VPContent">
151
+ <div class="vp-content-container">
152
+ <!-- 页面内容 -->
153
+ <div class="vp-doc">
154
+ {% block content %}
155
+ {{ page.content }}
156
+ {% endblock %}
157
+
158
+ <!-- 上一页/下一页导航 -->
159
+ {% if page.next_page or page.previous_page %}
160
+ <div class="vp-doc-footer">
161
+ <div class="vp-pagination">
162
+ {% if page.previous_page %}
163
+ <a href="{{ page.previous_page.url|url }}" class="vp-pagination-link prev">
164
+ <span class="vp-pagination-label">上一页</span>
165
+ <span class="vp-pagination-title">{{ page.previous_page.title }}</span>
166
+ </a>
167
+ {% else %}
168
+ <div></div>
169
+ {% endif %}
170
+
171
+ {% if page.next_page %}
172
+ <a href="{{ page.next_page.url|url }}" class="vp-pagination-link next">
173
+ <span class="vp-pagination-label">下一页</span>
174
+ <span class="vp-pagination-title">{{ page.next_page.title }}</span>
175
+ </a>
176
+ {% else %}
177
+ <div></div>
178
+ {% endif %}
179
+ </div>
180
+ </div>
181
+ {% endif %}
182
+ </div>
183
+
184
+ <!-- 右侧目录 -->
185
+ {% if page.toc and page.toc|length > 0 %}
186
+ <div class="vp-doc-aside">
187
+ <div class="vp-doc-aside-container">
188
+ <div class="vp-doc-aside-outline">
189
+ <div class="vp-doc-aside-outline-title">目录</div>
190
+ <nav class="vp-doc-aside-outline-content">
191
+ <ul class="vp-outline-root">
192
+ {% for toc_item in page.toc %}
193
+ <li class="vp-outline-item">
194
+ <a href="{{ toc_item.url }}" class="vp-outline-link{% if loop.first %} active{% endif %}">
195
+ {{ toc_item.title }}
196
+ </a>
197
+ {% if toc_item.children %}
198
+ <ul class="vp-outline-children">
199
+ {% for child in toc_item.children %}
200
+ <li class="vp-outline-item">
201
+ <a href="{{ child.url }}" class="vp-outline-link">
202
+ {{ child.title }}
203
+ </a>
204
+ </li>
205
+ {% endfor %}
206
+ </ul>
207
+ {% endif %}
208
+ </li>
209
+ {% endfor %}
210
+ </ul>
211
+ </nav>
212
+ </div>
213
+ </div>
214
+ </div>
215
+ {% endif %}
216
+ </div>
217
+ </main>
218
+ </div>
219
+ </div>
220
+
221
+ <!-- 搜索结果 -->
222
+ {% if 'search' in config['plugins'] %}
223
+ <div id="book-search-results">
224
+ <div class="search-noresults"></div>
225
+ <div class="search-results">
226
+ <div class="has-results">
227
+ <h1 class="search-results-title">
228
+ <span class='search-results-count'></span> 个结果匹配 "<span class='search-query'></span>"
229
+ </h1>
230
+ <ul class="search-results-list"></ul>
231
+ </div>
232
+ <div class="no-results">
233
+ <h1 class="search-results-title">没有找到匹配 "<span class='search-query'></span>" 的结果</h1>
234
+ </div>
235
+ </div>
236
+ </div>
237
+ {% endif %}
238
+
239
+ <!-- 主题 JavaScript -->
240
+ <script src="{{ "js/theme.js"|url }}"></script>
241
+
242
+ <!-- Mermaid.js (本地) -->
243
+ <script src="{{ "js/mermaid.min.js"|url }}"></script>
244
+ <script>
245
+ document.addEventListener('DOMContentLoaded', function() {
246
+ mermaid.initialize({
247
+ startOnLoad: false,
248
+ theme: 'default',
249
+ securityLevel: 'loose',
250
+ flowchart: {
251
+ useMaxWidth: true,
252
+ htmlLabels: true
253
+ },
254
+ sequence: {
255
+ useMaxWidth: true,
256
+ diagramMarginX: 50
257
+ }
258
+ });
259
+
260
+ // 渲染页面中的 Mermaid 代码块
261
+ var mermaidBlocks = document.querySelectorAll('.language-mermaid, .mermaid');
262
+ mermaidBlocks.forEach(function(block) {
263
+ var parent = block.parentElement;
264
+ if (parent && parent.tagName === 'PRE') {
265
+ var code = block.textContent || block.innerText;
266
+ var div = document.createElement('div');
267
+ div.className = 'mermaid';
268
+ div.textContent = code;
269
+ parent.parentNode.replaceChild(div, parent);
270
+ }
271
+ });
272
+
273
+ // 重新渲染所有 mermaid div
274
+ mermaid.run();
275
+ });
276
+ </script>
277
+
278
+ <!-- MkDocs 版本和构建时间 -->
279
+ <!--
280
+ MkDocs version: {{ mkdocs_version }}
281
+ Docs Build Date UTC: {{ build_date_utc }}
282
+ -->
283
+ </body>
284
+ </html>