zhangdocs 1.1.13 → 1.1.15

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.
package/.bin/zhangdocs.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  var commander = require('commander');
4
4
  var appInfo = require('../package');
package/lib/build.js CHANGED
@@ -56,6 +56,67 @@ marked.setOptions({
56
56
 
57
57
  var template = '';
58
58
 
59
+ // 生成目录页面HTML
60
+ function generateIndexPage(zhangdocsmd, pathArr, currentPath, relativePath) {
61
+ var html = '<div class="index-page">';
62
+ html += '<h1>文档目录</h1>';
63
+ html += '<div class="index-list">';
64
+
65
+ // 计算URL - 所有md文件都生成到html目录
66
+ function pathto(urlarr, basename, current) {
67
+ var url = '', temp = '';
68
+ for (var i = 0; i < urlarr.length; i++) {
69
+ if (urlarr[i].indexOf('md/' + basename) > -1) url = urlarr[i];
70
+ }
71
+ // 传进来的 url 处理 - 所有文件都生成到html目录
72
+ url = url.replace(process.cwd() + '/md', process.cwd() + '/html').replace(/\.md/, '.html');
73
+ url = url.replace(process.cwd() + '/', '');
74
+
75
+ // 获取相对路径(从index.html到目标文件)
76
+ temp = file.relativePath(current, process.cwd());
77
+ temp += url;
78
+ return temp;
79
+ }
80
+
81
+ function generateList(arr, _sub, level) {
82
+ level = level || 0;
83
+ var indent = level * 20;
84
+ var listHtml = '<ul style="margin-left: ' + indent + 'px;">';
85
+
86
+ for (var i = 0; i < arr.length; i++) {
87
+ var s = _sub ? _sub + '/' + arr[i] : arr[i];
88
+
89
+ if (typeof arr[i] === 'object') {
90
+ // 这是一个目录
91
+ for (var a in arr[i]) {
92
+ listHtml += '<li class="index-category">';
93
+ listHtml += '<span class="category-title">' + a + '</span>';
94
+ listHtml += generateList(arr[i][a], (_sub ? _sub + '/' + a : a), level + 1);
95
+ listHtml += '</li>';
96
+ }
97
+ } else {
98
+ // 这是一个文件
99
+ // 计算URL - 所有文件都生成到html目录
100
+ var url = pathto(pathArr, s, currentPath);
101
+
102
+ var displayName = arr[i].replace(/\.md/, '');
103
+ listHtml += '<li class="index-item">';
104
+ listHtml += '<a href="' + url + '">' + displayName + '</a>';
105
+ listHtml += '</li>';
106
+ }
107
+ }
108
+
109
+ listHtml += '</ul>';
110
+ return listHtml;
111
+ }
112
+
113
+ html += generateList(zhangdocsmd, '', 0);
114
+ html += '</div>';
115
+ html += '</div>';
116
+
117
+ return html;
118
+ }
119
+
59
120
  function build(commander, changeFile) {
60
121
 
61
122
  require('./menu_update')();
@@ -86,14 +147,23 @@ function build(commander, changeFile) {
86
147
 
87
148
  if (changeFile) pathArr = [changeFile];
88
149
 
150
+ // 先处理所有md文件,包括第一个md文件
89
151
  pathArr.forEach(function (item, idx) {
90
152
  //菜单层级
91
153
  var isIndex = false
92
154
  var len = item.replace(process.cwd() + '/md/', '').split('/').length;
93
155
 
94
156
  if (path.basename(item) === zhangdocsmd[0]) len = 0;
95
- //导航菜单生成
96
- var navHTML = nav(zhangdocsmd, item, pathArr, len);
157
+
158
+ // 获取 md 的相对目录(提前获取,用于计算HTML路径)
159
+ var itemRel = path.normalize(item);
160
+ itemRel = itemRel.replace(path.normalize(process.cwd() + '/md/'), '');
161
+
162
+ // 指定HTML路径 - 所有md文件都生成到html目录
163
+ var _path = path.normalize(process.cwd() + '/html/' + itemRel).replace('.md', ".html");
164
+
165
+ //导航菜单生成 - 传入HTML路径作为当前页面
166
+ var navHTML = nav(zhangdocsmd, _path, pathArr, len);
97
167
 
98
168
  let mdContent = file.read(item);
99
169
  // 自动把 \[ ... \] 替换为 $$ ... $$
@@ -110,18 +180,9 @@ function build(commander, changeFile) {
110
180
  markedstr = toc(markedstr, function (_html) {
111
181
  tocHTML = _html.toc
112
182
  });
113
- item = path.normalize(item)
114
-
115
- // 获取 md 的相对目录
116
- item = item.replace(path.normalize(process.cwd() + '/md/'), '');
117
183
 
118
- // 是否为首页判断
119
- zhangdocsmd[0] === item ? isIndex = true : isIndex = false;
120
-
121
- // 指定HTML路径
122
- _path = zhangdocsmd[0] === item ?
123
- (path.normalize(process.cwd() + '/' + item)).replace(item, "index.html") :
124
- (path.normalize(process.cwd() + '/html/' + item)).replace('.md', ".html");
184
+ // 第一个md文件不再作为首页,所有md文件都生成到html目录
185
+ isIndex = false;
125
186
 
126
187
  // 图片引用路径处理
127
188
  markedstr = imgPath(markedstr, _path);
@@ -142,6 +203,23 @@ function build(commander, changeFile) {
142
203
  if (!changeFile) log(color.blue('Generates') + ' "' + item.replace('.html', ".md") + '"' + color.blue(" Success ! ") + new Date());
143
204
  })
144
205
 
206
+ // 单独生成index.html作为目录页面
207
+ var indexPath = path.normalize(process.cwd() + '/index.html');
208
+ var indexNavHTML = nav(zhangdocsmd, indexPath, pathArr, 0);
209
+ var indexMarkedstr = generateIndexPage(zhangdocsmd, pathArr, indexPath, file.relativePath(indexPath, process.cwd()));
210
+
211
+ html = file.ejs(template + '/layout.ejs', {
212
+ title: pkg.name,//项目工程名字
213
+ index: true,//是否为首页
214
+ pkg: pkg,
215
+ relative_path: file.relativePath(indexPath, process.cwd()),//相对路径
216
+ menu_html: indexNavHTML,//页面之间的超链接导航
217
+ toc_html: '',// markdown 导航
218
+ markdown_html: indexMarkedstr // markdown 生成字符串
219
+ });
220
+ file.write(indexPath, html);
221
+ if (!changeFile) log(color.blue('Generates') + ' "index.html (目录页面)"' + color.blue(" Success ! ") + new Date());
222
+
145
223
  // 复制复制所有静态资源到生产目录里面
146
224
  copy(template + '/source/', todir + 'static', {
147
225
  filter: function (_file) {
package/lib/nav.js CHANGED
@@ -63,28 +63,23 @@ function pathto(urlarr,basename,current,index,floor){
63
63
  for (var i = 0; i < urlarr.length; i++) {
64
64
  if(urlarr[i].indexOf('md/'+basename) > -1) url = urlarr[i];
65
65
  };
66
- // 传进来的 url 处理
66
+ // 传进来的 url 处理 - 所有md文件都生成到html目录
67
67
  url = url.replace(process.cwd()+'/md',process.cwd() + '/html').replace(/\.md/,'.html');
68
+ url = url.replace(process.cwd()+'/','');
68
69
 
69
- // 当前md url 处理
70
- current = current.replace(process.cwd()+'/md',process.cwd() + '/html').replace(/\.md/,'.html');
71
-
72
- // 跳转首页相对地址 特殊处理
73
- var _index = index;
74
-
75
- index = index.replace(/\.md/,'.html');
76
- if(url==='') url = 'index.html'
77
- if(_index === basename){
78
- url = url.replace(process.cwd()+'/html/','').replace(index,'index.html')
79
- }else{
80
- url = url.replace(process.cwd()+'/','')
70
+ // 当前页面的 url 处理
71
+ // 如果是index.html,保持原样;否则转换为html目录下的路径
72
+ if(current.indexOf('index.html') === -1) {
73
+ current = current.replace(process.cwd()+'/md',process.cwd() + '/html').replace(/\.md/,'.html');
81
74
  }
82
75
 
83
76
  // 获取相对路径
84
77
  temp = file.relativePath(current ,process.cwd());
85
78
 
86
- // 首页跳转到其他页面的特殊处理
87
- if(floor === 0) temp = "";
79
+ // 从index.html跳转到其他页面的特殊处理
80
+ if(floor === 0 && current.indexOf('index.html') > -1) {
81
+ temp = "";
82
+ }
88
83
 
89
84
  temp += url;
90
85
  return temp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhangdocs",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "Simple document generation tool. Dependence Node.js run.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "main": "index.js",
10
10
  "bin": {
11
- "zhangdocs": ".bin/zhangdocs.js"
11
+ "doc": ".bin/zhangdocs.js"
12
12
  },
13
13
  "keywords": [
14
14
  "zhangdocs",
@@ -1,15 +1,18 @@
1
- <div class="nav">
2
- <div class="nav-header">
3
- <div class="logo">
4
- <%= title %>
5
- </div>
6
- <button class="nav-toggle" id="nav-toggle" aria-label="切换导航菜单">
7
- <span></span>
8
- <span></span>
9
- <span></span>
10
- </button>
1
+ <!-- 右上角菜单图标 -->
2
+ <button class="menu-icon" id="menu-icon" aria-label="打开菜单">
3
+ <span></span>
4
+ <span></span>
5
+ <span></span>
6
+ </button>
7
+
8
+ <!-- 弹出菜单 -->
9
+ <div class="menu-overlay" id="menu-overlay"></div>
10
+ <div class="menu-popup" id="menu-popup">
11
+ <div class="menu-popup-header">
12
+ <h3>导航菜单</h3>
13
+ <button class="menu-close" id="menu-close" aria-label="关闭菜单">×</button>
11
14
  </div>
12
- <div class="nav-menu" id="nav-menu">
15
+ <div class="menu-popup-content">
13
16
  <%- menu_html -%>
14
17
  </div>
15
18
  </div>
@@ -1,14 +1,18 @@
1
1
  <% include head.ejs %>
2
2
  <div class="warpper" id="main-container" style="display: none;">
3
+ <% if (!index) { %>
3
4
  <div class="page-toc">
4
5
  <%- toc_html %>
5
6
  </div>
6
- <div class="content markdown-body">
7
+ <% } %>
8
+ <div class="content markdown-body <%= index ? 'index-page-content' : '' %>">
9
+ <% if (!index) { %>
7
10
  <svg id="toc-toggle" class="toc-toggle" stroke="black" fill="none" stroke-width="2" viewBox="0 0 24 24"
8
11
  stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4 text-black" xmlns="http://www.w3.org/2000/svg">
9
12
  <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
10
13
  <line x1="9" y1="3" x2="9" y2="21" />
11
14
  </svg>
15
+ <% } %>
12
16
 
13
17
  <%- markdown_html %>
14
18
  </div>
@@ -35,23 +39,107 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
35
39
  </div>
36
40
 
37
41
  <script>
38
- // 立即执行,避免闪烁
39
- (function() {
40
- const expectedToken = '83687401';
41
- const existingToken = localStorage.getItem('token');
42
- if (existingToken === expectedToken) {
43
- // Token正确,立即显示内容
44
- const mainContainer = document.getElementById('main-container');
45
- const navElement = document.querySelector('.nav');
46
- if (mainContainer) mainContainer.style.display = 'block';
47
- if (navElement) navElement.style.display = 'block';
48
- }
49
- })();
42
+ // 菜单弹出功能 - 提前定义,确保可以在任何地方调用
43
+ var initMenuPopup = (function() {
44
+ var isInitialized = false;
45
+
46
+ return function() {
47
+ // 如果已经初始化过,跳过
48
+ if (isInitialized) {
49
+ return;
50
+ }
51
+
52
+ var menuIcon = document.getElementById('menu-icon');
53
+ var menuPopup = document.getElementById('menu-popup');
54
+ var menuOverlay = document.getElementById('menu-overlay');
55
+ var menuClose = document.getElementById('menu-close');
56
+
57
+ if (!menuIcon || !menuPopup || !menuOverlay || !menuClose) {
58
+ return;
59
+ }
60
+
61
+ // 标记为已初始化
62
+ isInitialized = true;
63
+
64
+ // 打开菜单
65
+ function openMenu() {
66
+ menuIcon.classList.add('menu-icon-active');
67
+ menuPopup.classList.add('menu-popup-show');
68
+ menuOverlay.classList.add('menu-overlay-show');
69
+ document.body.style.overflow = 'hidden'; // 防止背景滚动
70
+ }
71
+
72
+ // 关闭菜单
73
+ function closeMenu() {
74
+ menuIcon.classList.remove('menu-icon-active');
75
+ menuPopup.classList.remove('menu-popup-show');
76
+ menuOverlay.classList.remove('menu-overlay-show');
77
+ document.body.style.overflow = ''; // 恢复滚动
78
+ }
79
+
80
+ // 绑定事件
81
+ menuIcon.addEventListener('click', function(e) {
82
+ e.preventDefault();
83
+ e.stopPropagation();
84
+ if (menuPopup.classList.contains('menu-popup-show')) {
85
+ closeMenu();
86
+ } else {
87
+ openMenu();
88
+ }
89
+ });
90
+
91
+ menuClose.addEventListener('click', function(e) {
92
+ e.preventDefault();
93
+ e.stopPropagation();
94
+ closeMenu();
95
+ });
96
+
97
+ menuOverlay.addEventListener('click', function(e) {
98
+ if (e.target === menuOverlay) {
99
+ closeMenu();
100
+ }
101
+ });
102
+
103
+ // 点击菜单项后关闭菜单
104
+ setTimeout(function() {
105
+ var menuLinks = menuPopup.querySelectorAll('a');
106
+ menuLinks.forEach(function(link) {
107
+ link.addEventListener('click', function() {
108
+ closeMenu();
109
+ });
110
+ });
111
+ }, 200);
112
+
113
+ // ESC键关闭菜单
114
+ document.addEventListener('keydown', function(e) {
115
+ if (e.key === 'Escape' && menuPopup.classList.contains('menu-popup-show')) {
116
+ closeMenu();
117
+ }
118
+ });
119
+ };
120
+ })();
121
+
122
+ // 立即执行,避免闪烁
123
+ (function() {
124
+ const expectedToken = '83687401';
125
+ const existingToken = localStorage.getItem('token');
126
+ if (existingToken === expectedToken) {
127
+ // Token正确,立即显示内容
128
+ const mainContainer = document.getElementById('main-container');
129
+ const menuIcon = document.getElementById('menu-icon');
130
+ if (mainContainer) mainContainer.style.display = 'block';
131
+ if (menuIcon) {
132
+ menuIcon.style.display = 'flex';
133
+ // 菜单图标显示后,初始化菜单功能
134
+ setTimeout(initMenuPopup, 50);
135
+ }
136
+ }
137
+ })();
50
138
 
51
139
  document.addEventListener('DOMContentLoaded', function () {
52
140
  const expectedToken = '83687401';
53
141
  const mainContainer = document.getElementById('main-container');
54
- const navElement = document.querySelector('.nav');
142
+ const menuIcon = document.getElementById('menu-icon');
55
143
  const tokenModal = document.getElementById('token-modal');
56
144
  const tokenInput = document.getElementById('token-input');
57
145
  const tokenSubmit = document.getElementById('token-submit');
@@ -86,13 +174,17 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
86
174
  // 显示内容
87
175
  function showContent() {
88
176
  mainContainer.style.display = 'block';
89
- if (navElement) navElement.style.display = 'block';
177
+ if (menuIcon) {
178
+ menuIcon.style.display = 'flex';
179
+ // 菜单图标显示后,初始化菜单功能
180
+ setTimeout(initMenuPopup, 50);
181
+ }
90
182
  }
91
183
 
92
184
  // 隐藏内容
93
185
  function hideContent() {
94
186
  mainContainer.style.display = 'none';
95
- if (navElement) navElement.style.display = 'none';
187
+ if (menuIcon) menuIcon.style.display = 'none';
96
188
  }
97
189
 
98
190
  // 事件监听
@@ -194,49 +286,18 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
194
286
  }
195
287
  });
196
288
 
197
- // 移动端导航菜单折叠/展开功能
198
- (function() {
199
- function initNavToggle() {
200
- var navToggle = document.getElementById('nav-toggle');
201
- var navMenu = document.getElementById('nav-menu');
202
-
203
- if (navToggle && navMenu) {
204
- // 绑定点击事件
205
- navToggle.onclick = function(e) {
206
- e.preventDefault();
207
- e.stopPropagation();
208
- navToggle.classList.toggle('nav-toggle-active');
209
- navMenu.classList.toggle('nav-menu-open');
210
- };
211
-
212
- // 点击菜单项后自动收起菜单(移动端)
213
- if (window.innerWidth <= 768) {
214
- setTimeout(function() {
215
- var menuLinks = navMenu.querySelectorAll('a');
216
- menuLinks.forEach(function(link) {
217
- link.onclick = function() {
218
- navToggle.classList.remove('nav-toggle-active');
219
- navMenu.classList.remove('nav-menu-open');
220
- };
221
- });
222
- }, 200);
223
- }
224
- }
225
- }
226
-
227
- // 立即尝试初始化
228
- initNavToggle();
229
-
230
- // DOM 加载完成后再次初始化
231
- if (document.readyState === 'loading') {
232
- document.addEventListener('DOMContentLoaded', initNavToggle);
233
- } else {
234
- setTimeout(initNavToggle, 100);
235
- }
236
-
237
- // 延迟初始化(处理动态显示的情况)
238
- setTimeout(initNavToggle, 500);
239
- setTimeout(initNavToggle, 1000);
240
- })();
289
+ // 立即尝试初始化菜单功能
290
+ initMenuPopup();
291
+
292
+ // DOM 加载完成后再次初始化
293
+ if (document.readyState === 'loading') {
294
+ document.addEventListener('DOMContentLoaded', initMenuPopup);
295
+ } else {
296
+ setTimeout(initMenuPopup, 100);
297
+ }
298
+
299
+ // 延迟初始化(处理动态显示的情况)
300
+ setTimeout(initMenuPopup, 500);
301
+ setTimeout(initMenuPopup, 1000);
241
302
  </script>
242
303
  <% include footer.ejs %>
@@ -37,185 +37,152 @@ $link-color = #3498DB // 链接色
37
37
  $border-color = #E5E9F2 // 边框色
38
38
  $hover-color = #1ABC9C // 悬停绿色
39
39
 
40
- .nav
41
- background: $secondary-color
42
- z-index: 2
43
- height: 80px
44
- line-height: 61px
45
- border-bottom: 1px solid $border-color
46
- padding: 0 0 0 20px
40
+ // 右上角菜单图标
41
+ .menu-icon
42
+ position: fixed
43
+ top: 20px
44
+ right: 20px
45
+ width: 32px
46
+ height: 32px
47
+ background: rgba(0, 0, 0, 0.05)
48
+ border: 1px solid rgba(0, 0, 0, 0.1)
49
+ border-radius: 4px
50
+ cursor: pointer
51
+ z-index: 1000
52
+ display: none
53
+ flex-direction: column
54
+ justify-content: center
55
+ align-items: center
56
+ padding: 0
57
+ box-shadow: 0 1px 3px rgba(0,0,0,0.08)
58
+ transition: all 0.3s ease
59
+ pointer-events: auto
60
+ -webkit-tap-highlight-color: transparent
61
+ &:hover
62
+ background: rgba(0, 0, 0, 0.08)
63
+ border-color: rgba(0, 0, 0, 0.15)
64
+ box-shadow: 0 2px 6px rgba(0,0,0,0.12)
65
+ &:active
66
+ transform: scale(0.95)
67
+ span
68
+ width: 18px
69
+ height: 2px
70
+ background: #666
71
+ border-radius: 1px
72
+ margin: 2.5px 0
73
+ transition: all 0.3s ease
74
+ transform-origin: center
75
+ &.menu-icon-active
76
+ span:nth-child(1)
77
+ transform: rotate(45deg) translate(7px, 7px)
78
+ span:nth-child(2)
79
+ opacity: 0
80
+ span:nth-child(3)
81
+ transform: rotate(-45deg) translate(7px, -7px)
82
+
83
+ // 菜单遮罩层
84
+ .menu-overlay
47
85
  position: fixed
86
+ top: 0
87
+ left: 0
48
88
  width: 100%
89
+ height: 100%
90
+ background: rgba(0,0,0,0.5)
91
+ z-index: 1001
92
+ opacity: 0
93
+ visibility: hidden
94
+ transition: all 0.3s ease
95
+ &.menu-overlay-show
96
+ opacity: 1
97
+ visibility: visible
98
+
99
+ // 弹出菜单
100
+ .menu-popup
101
+ position: fixed
102
+ top: 0
103
+ right: -400px
104
+ width: 400px
105
+ height: 100%
106
+ background: white
107
+ z-index: 1002
108
+ box-shadow: -2px 0 10px rgba(0,0,0,0.1)
109
+ transition: right 0.3s ease
110
+ display: flex
111
+ flex-direction: column
49
112
  @media mq-mobile
50
- height: auto
51
- min-height: auto
52
- position: relative
53
- padding: 0
54
- line-height: 1.5
113
+ width: 80%
114
+ right: -80%
115
+ &.menu-popup-show
116
+ right: 0
117
+ .menu-popup-header
118
+ display: flex
119
+ justify-content: space-between
120
+ align-items: center
121
+ padding: 10px 20px
55
122
  border-bottom: 1px solid $border-color
56
- box-shadow: 0 2px 4px rgba(0,0,0,0.1)
57
- .nav-header
58
- @media mq-mobile
59
- display: flex
60
- justify-content: space-between
61
- align-items: center
62
- padding: 12px
63
- border-bottom: 1px solid rgba(0,0,0,0.1)
64
- @media (min-width: 769px)
65
- display: block
66
- padding: 0
67
- border-bottom: none
68
- .logo
69
- float: left
70
- padding: 10px 20px 0 0
71
- font-size: 24px
72
- color: #61dafb
73
- .nav-menu
74
- @media (min-width: 769px)
75
- display: block
76
- height: 100%
77
- @media mq-mobile
78
- overflow-y: hidden
79
- transition: max-height 0.3s ease-out
80
- max-height: 0
81
- &.nav-menu-open
82
- max-height: 70vh
83
- overflow-y: auto
84
- -webkit-overflow-scrolling: touch
85
- transition: max-height 0.5s ease-in
86
- ul
87
- @media mq-mobile
88
- display: block
89
- .nav-toggle
90
- @media mq-mobile
91
- display: flex
92
- flex-direction: column
93
- justify-content: space-around
94
- width: 28px
95
- height: 28px
123
+ background: $secondary-color
124
+ h3
125
+ margin: 0
126
+ font-size: 16px
127
+ color: $text-color
128
+ font-weight: 600
129
+ .menu-close
130
+ width: 24px
131
+ height: 24px
96
132
  background: transparent
97
133
  border: none
134
+ font-size: 20px
135
+ color: $text-color
98
136
  cursor: pointer
137
+ line-height: 1
99
138
  padding: 0
100
- z-index: 100
101
- span
102
- width: 100%
103
- height: 3px
104
- background: $text-color
105
- border-radius: 3px
106
- transition: all 0.3s ease
107
- transform-origin: center
108
- &.nav-toggle-active
109
- span:nth-child(1)
110
- transform: rotate(45deg) translate(7px, 7px)
111
- span:nth-child(2)
112
- opacity: 0
113
- span:nth-child(3)
114
- transform: rotate(-45deg) translate(7px, -7px)
115
- @media (min-width: 769px)
116
- display: none
117
- ul
118
- list-style: none
119
- position: relative
120
- display: inline-table
121
- display: block
122
- overflow-x:auto
123
- height:100%
124
- @media mq-mobile
125
- flex-direction: column
126
- width: 100%
127
- overflow: visible
128
- height: auto
129
- padding: 0
139
+ transition: all 0.2s ease
140
+ &:hover
141
+ color: $primary-color
142
+ transform: scale(1.1)
143
+ .menu-popup-content
144
+ flex: 1
145
+ overflow-y: auto
146
+ padding: 20px
130
147
  ul
131
- display: none
132
- background: #D1D1D1
133
- border-radius: 0px
148
+ list-style: none
149
+ margin: 0
134
150
  padding: 0
135
- position: absolute
136
- top: 100%
137
- z-index 9
138
- @media mq-mobile
139
- position: static
140
- background: rgba(0,0,0,0.02)
141
- border-left: 3px solid $primary-color
142
- margin-left: 15px
143
- display: none
144
- li.active
151
+ li
152
+ margin: 0
153
+ padding: 0
145
154
  a
146
- color:$primary-color
147
- line-height:29px
148
- height:29px
149
- li
150
- float: none
151
- border-bottom: 1px solid #C8C8C8
152
- position: relative
153
- @media mq-mobile
154
- border-bottom: 1px solid rgba(0,0,0,0.05)
155
- a:hover
156
- background: #4b545f
157
- color:$hover-color
158
- @media mq-mobile
159
- background: rgba(0,0,0,0.03)
160
- color: $text-color
161
- a
162
- color: $text-color
163
- line-height: 29px
164
- white-space:nowrap
165
- word-break:keep-all
166
- @media mq-mobile
167
- padding: 8px 15px
168
- line-height: 1.5
169
- font-size: 14px
170
- ul
171
- position: absolute
172
- left: 100%
173
- top:0
174
- li
175
- float: left
176
- line-height: 40px
177
- @media mq-mobile
178
- float: none
179
- line-height: 1.5
180
- width: 100%
181
- border-bottom: 1px solid rgba(0,0,0,0.05)
182
- a
183
- color: $text-color
184
- text-decoration: none
185
- padding: 0 15px
186
- display: block
187
- @media mq-mobile
155
+ display: block
188
156
  padding: 12px 15px
189
- width: 100%
157
+ color: $text-color
158
+ text-decoration: none
159
+ border-radius: 4px
160
+ transition: all 0.2s ease
190
161
  font-size: 15px
191
- &:hover
192
- @media mq-mobile
193
- background-color: rgba(0,0,0,0.02)
194
- a
195
- color: $hover-color
196
- li.active
197
- @media mq-mobile
198
- background-color: rgba(74, 144, 226, 0.1)
199
- a
200
- color:$primary-color
201
- height: 40px
202
- @media mq-mobile
203
- height: auto
204
- color: $primary-color
205
- font-weight: 600
206
- ul li:hover > ul
207
- display: block
208
- ul:after
209
- content: ""
210
- clear: both
211
- display: block
162
+ &:hover
163
+ background: $secondary-color
164
+ color: $primary-color
165
+ &.active
166
+ a
167
+ background: rgba($primary-color, 0.1)
168
+ color: $primary-color
169
+ font-weight: 600
170
+ ul
171
+ margin-left: 20px
172
+ margin-top: 5px
173
+ li
174
+ a
175
+ padding: 8px 15px
176
+ font-size: 14px
177
+ color: lighten($text-color, 20%)
178
+ &.active
179
+ a
180
+ color: $primary-color
212
181
  .warpper
213
182
  width: 100%
214
- padding: 80px 0 0 0
183
+ padding: 0
215
184
  height: 100%
216
185
  overflow: auto
217
- @media mq-mobile
218
- padding-top: 0
219
186
  .page-toc,.markdown-body
220
187
  height:100%
221
188
  .markdown-body
@@ -223,8 +190,10 @@ $hover-color = #1ABC9C // 悬停绿色
223
190
  overflow: auto
224
191
  @media mq-mobile
225
192
  margin-left:0
193
+ &.index-page-content
194
+ margin-left: 0
226
195
  .page-toc
227
- height:calc(100% - 80px)
196
+ height: 100%
228
197
  position: fixed
229
198
  width:tocwidth
230
199
  border-right: 1px solid #bbb
@@ -400,7 +369,7 @@ table
400
369
  transition: all 0.3s ease
401
370
  position: fixed
402
371
  left: 200px
403
- top: 80px
372
+ top: 20px
404
373
  width: 24px
405
374
  height: 24px
406
375
  cursor: pointer
@@ -430,4 +399,61 @@ table
430
399
  font-size: 1.1em
431
400
 
432
401
  .katex-error
433
- color: #f00
402
+ color: #f00
403
+
404
+ // 首页目录页面样式
405
+ .index-page
406
+ padding: 40px 20px
407
+ max-width: 1200px
408
+ margin: 0 auto
409
+
410
+ h1
411
+ font-size: 32px
412
+ color: $text-color
413
+ margin-bottom: 30px
414
+ font-weight: 600
415
+ border-bottom: 2px solid $primary-color
416
+ padding-bottom: 15px
417
+
418
+ .index-list
419
+ ul
420
+ list-style: none
421
+ margin: 0
422
+ padding: 0
423
+
424
+ .index-category
425
+ margin: 15px 0
426
+
427
+ .category-title
428
+ display: block
429
+ font-size: 18px
430
+ font-weight: 600
431
+ color: $primary-color
432
+ margin-bottom: 10px
433
+ padding: 8px 12px
434
+ background: rgba($primary-color, 0.1)
435
+ border-left: 4px solid $primary-color
436
+ border-radius: 4px
437
+
438
+ ul
439
+ margin-left: 20px !important
440
+ margin-top: 10px
441
+
442
+ .index-item
443
+ margin: 8px 0
444
+
445
+ a
446
+ display: inline-block
447
+ padding: 10px 15px
448
+ color: $text-color
449
+ text-decoration: none
450
+ border-radius: 4px
451
+ transition: all 0.2s ease
452
+ font-size: 16px
453
+ border-left: 3px solid transparent
454
+
455
+ &:hover
456
+ background: $secondary-color
457
+ color: $primary-color
458
+ border-left-color: $primary-color
459
+ transform: translateX(5px)