hexo-theme-stellar 1.25.0 → 1.26.0
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/_config.yml +80 -32
- package/_data/icons.yml +33 -0
- package/_data/widgets.yml +2 -16
- package/languages/zh-CN.yml +1 -1
- package/languages/zh-TW.yml +1 -1
- package/layout/404.ejs +2 -2
- package/layout/_partial/cover/index.ejs +5 -5
- package/layout/_partial/cover/post_cover.ejs +1 -1
- package/layout/_partial/cover/wiki_cover.ejs +2 -2
- package/layout/_partial/head.ejs +5 -8
- package/layout/_partial/main/article/article_footer.ejs +7 -15
- package/layout/_partial/main/article/read_next.ejs +6 -6
- package/layout/_partial/main/article/related_posts.ejs +1 -1
- package/layout/_partial/main/footer.ejs +1 -1
- package/layout/_partial/main/navbar/article_top_area.ejs +35 -0
- package/layout/_partial/main/navbar/author_banner.ejs +1 -3
- package/layout/_partial/main/navbar/breadcrumb/blog.ejs +34 -0
- package/layout/_partial/main/navbar/breadcrumb/page.ejs +10 -0
- package/layout/_partial/main/navbar/breadcrumb/wiki.ejs +20 -0
- package/layout/_partial/main/navbar/dateinfo.ejs +32 -0
- package/layout/_partial/main/navbar/ghinfo.ejs +25 -0
- package/layout/_partial/main/navbar/nav_tabs_blog.ejs +3 -3
- package/layout/_partial/main/navbar/nav_tabs_wiki.ejs +2 -2
- package/layout/_partial/main/post_list/paginator.ejs +1 -1
- package/layout/_partial/main/post_list/post_card.ejs +3 -3
- package/layout/_partial/menubtn.ejs +1 -1
- package/layout/_partial/plugins/ai/tianli_gpt.ejs +4 -3
- package/layout/_partial/plugins/comments/artalk/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/artalk/script.ejs +1 -1
- package/layout/_partial/plugins/comments/beaudar/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/giscus/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/layout.ejs +3 -3
- package/layout/_partial/plugins/comments/twikoo/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/utterances/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/waline/layout.ejs +1 -1
- package/layout/_partial/sidebar/index.ejs +72 -71
- package/layout/_partial/sidebar/logo.ejs +87 -0
- package/layout/_partial/sidebar/menu.ejs +23 -18
- package/layout/_partial/sidebar/search.ejs +42 -0
- package/layout/_partial/widgets/components/link.ejs +21 -0
- package/layout/_partial/widgets/components/linklist.ejs +27 -0
- package/layout/_partial/widgets/ghissues.ejs +7 -9
- package/layout/_partial/widgets/ghrepo.ejs +10 -12
- package/layout/_partial/widgets/ghuser.ejs +2 -6
- package/layout/_partial/widgets/linklist.ejs +17 -0
- package/layout/_partial/widgets/markdown.ejs +5 -2
- package/layout/_partial/widgets/recent.ejs +12 -8
- package/layout/_partial/widgets/related.ejs +13 -9
- package/layout/_partial/widgets/search.ejs +0 -40
- package/layout/_partial/widgets/tagcloud.ejs +2 -2
- package/layout/_partial/widgets/timeline.ejs +2 -2
- package/layout/_partial/widgets/toc.ejs +24 -24
- package/layout/archive.ejs +2 -2
- package/layout/categories.ejs +1 -1
- package/layout/index.ejs +4 -20
- package/layout/index_topic.ejs +1 -1
- package/layout/index_wiki.ejs +2 -2
- package/layout/layout.ejs +53 -21
- package/layout/page.ejs +59 -12
- package/layout/tags.ejs +1 -1
- package/package.json +2 -2
- package/scripts/events/lib/config.js +28 -24
- package/scripts/events/lib/doc_tree.js +27 -19
- package/scripts/events/lib/merge_posts.js +0 -1
- package/scripts/generators/topic.js +3 -3
- package/scripts/generators/wiki.js +5 -4
- package/scripts/helpers/category_color.js +1 -1
- package/scripts/helpers/icon.js +16 -0
- package/scripts/helpers/parse_config.js +18 -16
- package/scripts/helpers/scrollreveal.js +6 -6
- package/scripts/tags/lib/toc.js +1 -1
- package/source/css/_common/blur.styl +1 -8
- package/source/css/_common/cap.styl +1 -1
- package/source/css/_common/device.styl +2 -2
- package/source/css/_common/highlight.styl +2 -2
- package/source/css/_common/layout.styl +6 -0
- package/source/css/_common/svg.styl +3 -0
- package/source/css/_custom.styl +9 -2
- package/source/css/_defines/theme.styl +10 -0
- package/source/css/_layout/layout.styl +17 -4
- package/source/css/_layout/list.styl +5 -2
- package/source/css/_layout/main.styl +5 -4
- package/source/css/_layout/md.styl +12 -11
- package/source/css/_layout/partial/paginator.styl +2 -2
- package/source/css/_layout/sidebar/footer.styl +4 -31
- package/source/css/_layout/sidebar/{header.styl → logo.styl} +11 -41
- package/source/css/_layout/sidebar/menu.styl +53 -0
- package/source/css/_layout/sidebar/nav-area.styl +2 -0
- package/source/css/_layout/{widgets → sidebar}/search.styl +51 -50
- package/source/css/_layout/sidebar/sidebar.styl +21 -31
- package/source/css/_layout/tag-plugins/banner.styl +9 -10
- package/source/css/_layout/tag-plugins/okr.styl +0 -1
- package/source/css/_layout/tag-plugins/tabs.styl +2 -2
- package/source/css/_layout/tag-plugins/toc.styl +1 -1
- package/source/css/_layout/widgets/components.styl +49 -0
- package/source/css/_layout/widgets/ghrepo.styl +0 -1
- package/source/css/_layout/widgets/ghuser.styl +0 -23
- package/source/css/_layout/widgets/list.styl +28 -0
- package/source/css/_layout/widgets/markdown.styl +20 -0
- package/source/css/_layout/widgets/related.styl +36 -5
- package/source/css/_layout/widgets/timeline.styl +21 -2
- package/source/css/_layout/widgets/toc_blog.styl +1 -1
- package/source/css/_layout/widgets/toc_common.styl +12 -12
- package/source/css/_layout/widgets/toc_wiki.styl +38 -25
- package/source/css/_layout/widgets/widgets.styl +25 -20
- package/source/css/_plugins/comments/twikoo.styl +9 -9
- package/source/css/_plugins/scrollreveal.styl +1 -1
- package/source/css/_plugins/tianli_gpt.styl +12 -14
- package/source/js/main.js +5 -2
- package/source/js/plugins/copycode.js +3 -3
- package/layout/_partial/main/header/index.ejs +0 -3
- package/layout/_partial/main/navbar/breadcrumb.ejs +0 -161
- package/layout/_partial/sidebar/header.ejs +0 -58
- package/layout/post.ejs +0 -33
- package/layout/topic.ejs +0 -28
- package/layout/wiki.ejs +0 -32
- package/source/css/_layout/widgets/recent.styl +0 -15
package/layout/page.ejs
CHANGED
|
@@ -1,28 +1,75 @@
|
|
|
1
1
|
<%
|
|
2
|
+
const { layout } = page
|
|
3
|
+
// 是否使用 Heti 布局插件
|
|
4
|
+
const isUsingHeti = theme.plugins.heti && theme.plugins.heti.enable
|
|
5
|
+
// 是否使用 TianliGPT 插件
|
|
6
|
+
const isUsingTianliGPT = theme.plugins.tianli_gpt.enable && ['all', page.layout].includes(theme.plugins.tianli_gpt.field)
|
|
7
|
+
|
|
8
|
+
// 默认的 menu_id
|
|
9
|
+
if (page.menu_id == null) {
|
|
10
|
+
if (page.wiki?.length > 0) {
|
|
11
|
+
page.menu_id = theme.site_tree.wiki.menu_id
|
|
12
|
+
} else if (page.topic?.length > 0) {
|
|
13
|
+
page.menu_id = theme.site_tree.topic.menu_id
|
|
14
|
+
} else {
|
|
15
|
+
page.menu_id = theme.site_tree.post.menu_id
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// 默认的 title
|
|
19
|
+
if (page.title == null) {
|
|
20
|
+
if (page.wiki) {
|
|
21
|
+
page.title = __('btn.wiki')
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
2
25
|
function layoutTitle() {
|
|
3
|
-
const title = page.h1 != null ? page.h1 : page.title
|
|
26
|
+
const title = page.h1 != null ? page.h1 : page.title
|
|
4
27
|
if (title && title.length > 0) {
|
|
5
|
-
return
|
|
28
|
+
return `<h1 class="article-title"><span>${title}</span></h1>`
|
|
6
29
|
} else {
|
|
7
|
-
return ''
|
|
30
|
+
return ''
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function articleClass() {
|
|
35
|
+
var str = `md-text content${scrollreveal(' ')}`
|
|
36
|
+
if (isUsingHeti) {
|
|
37
|
+
str += ' heti'
|
|
8
38
|
}
|
|
39
|
+
if (isUsingTianliGPT) {
|
|
40
|
+
str += ' '
|
|
41
|
+
}
|
|
42
|
+
return str
|
|
9
43
|
}
|
|
44
|
+
|
|
10
45
|
function layoutDiv() {
|
|
11
|
-
var el = ''
|
|
46
|
+
var el = ''
|
|
12
47
|
if (page.nav_tabs) {
|
|
13
|
-
el += partial('_partial/main/navbar/nav_tabs_blog')
|
|
48
|
+
el += partial('_partial/main/navbar/nav_tabs_blog')
|
|
14
49
|
}
|
|
15
50
|
if (page.h1 || page.title || (page.content && page.content.length > 0)) {
|
|
16
|
-
el += partial('_partial/main/navbar/
|
|
51
|
+
el += partial('_partial/main/navbar/article_top_area')
|
|
17
52
|
}
|
|
18
|
-
el +=
|
|
19
|
-
el += layoutTitle()
|
|
53
|
+
el += `<article class="${articleClass()}">`
|
|
54
|
+
el += layoutTitle()
|
|
20
55
|
if (page.content && page.content.length > 0) {
|
|
21
|
-
el += page.content
|
|
56
|
+
el += page.content
|
|
57
|
+
}
|
|
58
|
+
if (layout === 'post') {
|
|
59
|
+
el += partial('_partial/main/article/article_footer')
|
|
60
|
+
}
|
|
61
|
+
el += `</article>`
|
|
62
|
+
if (layout === 'post' || page.wiki) {
|
|
63
|
+
el += partial('_partial/main/article/read_next')
|
|
64
|
+
}
|
|
65
|
+
if (isUsingTianliGPT) {
|
|
66
|
+
el += partial('_partial/plugins/ai/tianli_gpt')
|
|
67
|
+
}
|
|
68
|
+
if (layout === 'post') {
|
|
69
|
+
el += partial('_partial/main/article/related_posts')
|
|
22
70
|
}
|
|
23
|
-
el += '
|
|
24
|
-
el
|
|
25
|
-
return el;
|
|
71
|
+
el += partial('_partial/plugins/comments/layout')
|
|
72
|
+
return el
|
|
26
73
|
}
|
|
27
74
|
%>
|
|
28
75
|
|
package/layout/tags.ejs
CHANGED
|
@@ -9,7 +9,7 @@ if (page.menu_id == undefined) {
|
|
|
9
9
|
<% page.layout = 'tags'; %>
|
|
10
10
|
<%- partial('_partial/main/navbar/nav_tabs_blog') %>
|
|
11
11
|
<div class='post-list'>
|
|
12
|
-
<article class='<%- scrollreveal() %>' id='tags'>
|
|
12
|
+
<article class='<%- scrollreveal("") %>' id='tags'>
|
|
13
13
|
<% site.tags.sort('length', -1).each(function(tag){ %>
|
|
14
14
|
<a class='tag' href="<%= url_for(tag.path) %>">
|
|
15
15
|
<span class='name'><%= tag.name %></span>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-theme-stellar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Elegant and powerful theme for Hexo.",
|
|
5
5
|
"main": "package.json",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"hexo-renderer-ejs": "^2.0.0",
|
|
25
|
-
"hexo-renderer-stylus": "^
|
|
25
|
+
"hexo-renderer-stylus": "^3.0.1"
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://xaoxuu.com/wiki/stellar/",
|
|
28
28
|
"devDependencies": {
|
|
@@ -7,57 +7,61 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
const path = require('path')
|
|
10
|
+
const path = require('path')
|
|
11
11
|
|
|
12
|
-
module.exports =
|
|
12
|
+
module.exports = ctx => {
|
|
13
13
|
|
|
14
|
-
const { cache, language_switcher } =
|
|
14
|
+
const { cache, language_switcher } = ctx.theme.config
|
|
15
15
|
const warning = function(...args) {
|
|
16
|
-
|
|
17
|
-
}
|
|
16
|
+
ctx.log.warn(`Since ${args[0]} is turned on, the ${args[1]} is disabled to avoid potential hazards.`)
|
|
17
|
+
}
|
|
18
18
|
|
|
19
19
|
if (cache && cache.enable && language_switcher) {
|
|
20
|
-
warning('language_switcher', 'caching')
|
|
21
|
-
cache.enable = false
|
|
20
|
+
warning('language_switcher', 'caching')
|
|
21
|
+
cache.enable = false
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (cache && cache.enable &&
|
|
25
|
-
warning('caching', '`relative_link` option in Hexo `_config.yml`')
|
|
26
|
-
|
|
24
|
+
if (cache && cache.enable && ctx.config.relative_link) {
|
|
25
|
+
warning('caching', '`relative_link` option in Hexo `_config.yml`')
|
|
26
|
+
ctx.config.relative_link = false
|
|
27
27
|
}
|
|
28
|
-
//
|
|
28
|
+
// ctx.config.meta_generator = false;
|
|
29
29
|
|
|
30
30
|
// merge data
|
|
31
|
-
const data =
|
|
32
|
-
// merge widgets
|
|
33
|
-
var widgets =
|
|
31
|
+
const data = ctx.locals.get('data')
|
|
32
|
+
// merge widgets: 可覆盖删除的合并
|
|
33
|
+
var widgets = ctx.render.renderSync({ path: path.join(ctx.theme_dir, '_data/widgets.yml'), engine: 'yaml' })
|
|
34
34
|
if (data.widgets) {
|
|
35
35
|
for (let i of Object.keys(data.widgets)) {
|
|
36
|
-
let widget = data.widgets[i]
|
|
36
|
+
let widget = data.widgets[i]
|
|
37
37
|
if (widget == null || widget.length == 0) {
|
|
38
38
|
// delete
|
|
39
|
-
delete widgets[i]
|
|
39
|
+
delete widgets[i]
|
|
40
40
|
} else {
|
|
41
41
|
// create
|
|
42
42
|
if (widgets[i] == null) {
|
|
43
|
-
widgets[i] = widget
|
|
43
|
+
widgets[i] = widget
|
|
44
44
|
} else {
|
|
45
45
|
// merge
|
|
46
46
|
for (let j of Object.keys(widget)) {
|
|
47
|
-
widgets[i][j] = widget[j]
|
|
47
|
+
widgets[i][j] = widget[j]
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
ctx.theme.config.widgets = widgets
|
|
54
|
+
|
|
55
|
+
// merge icons: 简单覆盖合并
|
|
56
|
+
var icons = ctx.render.renderSync({ path: path.join(ctx.theme_dir, '_data/icons.yml'), engine: 'yaml' })
|
|
57
|
+
if (data.icons) {
|
|
58
|
+
icons = Object.assign({}, icons, data.icons)
|
|
55
59
|
}
|
|
56
|
-
|
|
60
|
+
ctx.theme.config.icons = icons
|
|
57
61
|
|
|
58
62
|
// default menu
|
|
59
|
-
if (
|
|
60
|
-
|
|
63
|
+
if (ctx.theme.config.menubar == undefined) {
|
|
64
|
+
ctx.theme.config.menubar = {}
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
}
|
|
67
|
+
}
|
|
@@ -9,7 +9,6 @@ class WikiPage {
|
|
|
9
9
|
this.id = page._id
|
|
10
10
|
this.wiki = page.wiki
|
|
11
11
|
this.title = page.title
|
|
12
|
-
this.seo_title = page.seo_title
|
|
13
12
|
this.path = page.path
|
|
14
13
|
this.path_key = page.path.replace('.html', '')
|
|
15
14
|
this.layout = page.layout
|
|
@@ -35,11 +34,15 @@ function getWikiObject(ctx) {
|
|
|
35
34
|
if (obj.sort == null) {
|
|
36
35
|
obj.sort = 0
|
|
37
36
|
}
|
|
38
|
-
if (obj.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
obj.
|
|
37
|
+
if (obj.base_dir) {
|
|
38
|
+
if (obj.base_dir.startsWith('/')) {
|
|
39
|
+
obj.base_dir = obj.base_dir.substring(1)
|
|
40
|
+
}
|
|
41
|
+
if (obj.base_dir.length > 1 && obj.base_dir.endsWith('/') == false) {
|
|
42
|
+
obj.base_dir = obj.base_dir + '/'
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
obj.base_dir = ''
|
|
43
46
|
}
|
|
44
47
|
list.push(obj)
|
|
45
48
|
}
|
|
@@ -56,7 +59,7 @@ module.exports = ctx => {
|
|
|
56
59
|
var wiki = getWikiObject(ctx)
|
|
57
60
|
const pages = ctx.locals.get('pages')
|
|
58
61
|
// wiki 所有页面
|
|
59
|
-
const wiki_pages = pages.filter(p => (p.
|
|
62
|
+
const wiki_pages = pages.filter(p => (p.wiki != null)).map(p => new WikiPage(p))
|
|
60
63
|
const wiki_list = Object.keys(wiki.tree)
|
|
61
64
|
// 上架的项目列表
|
|
62
65
|
wiki.shelf = ctx.locals.get('data').wiki || []
|
|
@@ -101,25 +104,30 @@ module.exports = ctx => {
|
|
|
101
104
|
|
|
102
105
|
// 首页
|
|
103
106
|
// 未特别指定首页时,获取TOC第一页作为首页
|
|
104
|
-
|
|
107
|
+
var homepage = item.homepage
|
|
108
|
+
if (homepage == null && item.toc != null) {
|
|
105
109
|
for (let id of Object.keys(item.toc)) {
|
|
106
110
|
const sec = item.toc[id]
|
|
107
111
|
for (let key of sec) {
|
|
108
|
-
let hs = sub_pages.filter(p => p.path_key == item.
|
|
112
|
+
let hs = sub_pages.filter(p => p.path_key == item.base_dir + key)
|
|
109
113
|
if (hs.length > 0) {
|
|
110
|
-
|
|
114
|
+
homepage = hs[0]
|
|
111
115
|
break
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
|
-
if (
|
|
118
|
+
if (homepage != null) {
|
|
115
119
|
break
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
|
-
if (
|
|
120
|
-
|
|
123
|
+
if (homepage == null) {
|
|
124
|
+
homepage = sub_pages[0]
|
|
125
|
+
}
|
|
126
|
+
if (typeof homepage == 'string') {
|
|
127
|
+
homepage = {path: homepage}
|
|
121
128
|
}
|
|
122
|
-
|
|
129
|
+
homepage.is_homepage = true
|
|
130
|
+
item.homepage = homepage
|
|
123
131
|
// 内页分组
|
|
124
132
|
var sections = []
|
|
125
133
|
var others = sub_pages
|
|
@@ -128,21 +136,21 @@ module.exports = ctx => {
|
|
|
128
136
|
for (let title of Object.keys(item.toc)) {
|
|
129
137
|
var sec = { title: title, pages: []}
|
|
130
138
|
for (let key of item.toc[title]) {
|
|
131
|
-
sec.pages = sec.pages.concat(sub_pages.filter(p => p.path_key == item.
|
|
132
|
-
others = others.filter(p => p.path_key != item.
|
|
139
|
+
sec.pages = sec.pages.concat(sub_pages.filter(p => p.path_key == item.base_dir + key))
|
|
140
|
+
others = others.filter(p => p.path_key != item.base_dir + key)
|
|
133
141
|
}
|
|
134
142
|
sections.push(sec)
|
|
135
143
|
}
|
|
136
144
|
if (others.length > 0 && others.filter(p => p.title?.length > 0).length > 0) {
|
|
137
145
|
sections.push({
|
|
138
146
|
title: '...',
|
|
139
|
-
pages: others.sort((p1, p2) => p1.
|
|
147
|
+
pages: others.sort((p1, p2) => p1.title - p2.title)
|
|
140
148
|
})
|
|
141
149
|
}
|
|
142
150
|
} else {
|
|
143
151
|
// 自动设置顺序
|
|
144
152
|
sections.push({
|
|
145
|
-
pages: sub_pages.sort((p1, p2) => p1.
|
|
153
|
+
pages: sub_pages.sort((p1, p2) => p1.title - p2.title)
|
|
146
154
|
})
|
|
147
155
|
}
|
|
148
156
|
|
|
@@ -177,7 +185,7 @@ module.exports = ctx => {
|
|
|
177
185
|
}
|
|
178
186
|
all_tags[tag_name] = {
|
|
179
187
|
name: tag_name,
|
|
180
|
-
path: (ctx.theme.config.site_tree.
|
|
188
|
+
path: (ctx.theme.config.site_tree.index_wiki.base_dir) + '/tags/' + tag_name + '/index.html',
|
|
181
189
|
items: items
|
|
182
190
|
}
|
|
183
191
|
})
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* topic v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
hexo.extend.generator.register('
|
|
5
|
+
hexo.extend.generator.register('index_topic', function (locals) {
|
|
6
6
|
const { site_tree, topic } = hexo.theme.config
|
|
7
7
|
const topicIdList = Object.keys(topic.tree)
|
|
8
8
|
if (topicIdList.length == 0) {
|
|
@@ -10,11 +10,11 @@ hexo.extend.generator.register('topic', function (locals) {
|
|
|
10
10
|
}
|
|
11
11
|
var ret = []
|
|
12
12
|
ret.push({
|
|
13
|
-
path: site_tree.
|
|
13
|
+
path: site_tree.index_topic.base_dir + '/index.html',
|
|
14
14
|
layout: ['index_topic'],
|
|
15
15
|
data: {
|
|
16
16
|
layout: 'index_topic',
|
|
17
|
-
menu_id: site_tree.
|
|
17
|
+
menu_id: site_tree.index_topic.menu_id
|
|
18
18
|
}
|
|
19
19
|
})
|
|
20
20
|
return ret
|
|
@@ -10,11 +10,11 @@ hexo.extend.generator.register('wiki', function (locals) {
|
|
|
10
10
|
}
|
|
11
11
|
var ret = []
|
|
12
12
|
ret.push({
|
|
13
|
-
path: site_tree.
|
|
13
|
+
path: site_tree.index_wiki.base_dir + '/index.html',
|
|
14
14
|
layout: ['index_wiki'],
|
|
15
15
|
data: {
|
|
16
16
|
layout: 'index_wiki',
|
|
17
|
-
menu_id: site_tree.
|
|
17
|
+
menu_id: site_tree.index_wiki.menu_id,
|
|
18
18
|
filter: false
|
|
19
19
|
}
|
|
20
20
|
})
|
|
@@ -26,9 +26,10 @@ hexo.extend.generator.register('wiki', function (locals) {
|
|
|
26
26
|
layout: ['index_wiki'],
|
|
27
27
|
data: {
|
|
28
28
|
layout: 'index_wiki',
|
|
29
|
-
menu_id: site_tree.
|
|
29
|
+
menu_id: site_tree.index_wiki.menu_id,
|
|
30
30
|
filter: true,
|
|
31
|
-
tagName: tag.name
|
|
31
|
+
tagName: tag.name,
|
|
32
|
+
title: tag.name
|
|
32
33
|
}
|
|
33
34
|
})
|
|
34
35
|
}
|
|
@@ -16,7 +16,7 @@ hexo.extend.helper.register('category_color', function(cat){
|
|
|
16
16
|
} else if (textColor.length == (1+6)) { // #ffffff
|
|
17
17
|
bgColor += '20'
|
|
18
18
|
}
|
|
19
|
-
return ` style="--text-
|
|
19
|
+
return ` style="--text-p2:${textColor};--theme-block:${bgColor}"`;
|
|
20
20
|
}
|
|
21
21
|
return ''
|
|
22
22
|
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
hexo.extend.helper.register('icon', function(key) {
|
|
4
|
+
const { icons } = hexo.theme.config
|
|
5
|
+
var result = ''
|
|
6
|
+
if (icons[key]) {
|
|
7
|
+
result = icons[key]
|
|
8
|
+
} else {
|
|
9
|
+
result = key
|
|
10
|
+
}
|
|
11
|
+
if (result.startsWith('/') || result.startsWith('https://') || result.startsWith('http://')) {
|
|
12
|
+
return `<img src="${result}" />`
|
|
13
|
+
} else {
|
|
14
|
+
return result
|
|
15
|
+
}
|
|
16
|
+
})
|
|
@@ -7,33 +7,35 @@
|
|
|
7
7
|
|
|
8
8
|
hexo.extend.helper.register('md_text', function(args) {
|
|
9
9
|
if (args == undefined) {
|
|
10
|
-
return ''
|
|
10
|
+
return ''
|
|
11
11
|
}
|
|
12
|
-
let tmp = args.split('](')
|
|
12
|
+
let tmp = args.split('](')
|
|
13
13
|
if (tmp.length > 1) {
|
|
14
|
-
tmp = tmp[0]
|
|
14
|
+
tmp = tmp[0]
|
|
15
15
|
if (tmp.length > 1) {
|
|
16
|
-
tmp = tmp.substring(1, tmp.length)
|
|
16
|
+
tmp = tmp.substring(1, tmp.length)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
if (tmp == 'config.title') {
|
|
20
|
-
tmp = hexo.config.title
|
|
21
|
-
} else if (tmp == 'config.avatar') {
|
|
22
|
-
tmp = hexo.config.avatar
|
|
19
|
+
if (tmp == 'config.title' || tmp == '${config.title}') {
|
|
20
|
+
tmp = hexo.config.title
|
|
21
|
+
} else if (tmp == 'config.avatar' || tmp == '${config.avatar}') {
|
|
22
|
+
tmp = hexo.config.avatar
|
|
23
23
|
}
|
|
24
|
-
return tmp
|
|
25
|
-
})
|
|
24
|
+
return tmp
|
|
25
|
+
})
|
|
26
26
|
|
|
27
27
|
hexo.extend.helper.register('md_link', function(args) {
|
|
28
28
|
if (args == undefined) {
|
|
29
|
-
return ''
|
|
29
|
+
return ''
|
|
30
30
|
}
|
|
31
|
-
let tmp = args.split('](')
|
|
31
|
+
let tmp = args.split('](')
|
|
32
32
|
if (tmp.length > 1) {
|
|
33
|
-
tmp = tmp[1]
|
|
33
|
+
tmp = tmp[1]
|
|
34
34
|
if (tmp.length > 1) {
|
|
35
|
-
tmp = tmp.substring(0, tmp.length-1)
|
|
35
|
+
tmp = tmp.substring(0, tmp.length-1)
|
|
36
36
|
}
|
|
37
|
+
} else {
|
|
38
|
+
return ''
|
|
37
39
|
}
|
|
38
|
-
return tmp
|
|
39
|
-
})
|
|
40
|
+
return tmp
|
|
41
|
+
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
hexo.extend.helper.register('scrollreveal', function(args){
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
hexo.extend.helper.register('scrollreveal', function(args) {
|
|
4
|
+
if (hexo.theme.config.plugins.scrollreveal?.enable) {
|
|
5
|
+
return `${args ? args : ''}slide-up`
|
|
6
|
+
} else {
|
|
7
|
+
return ''
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
});
|
|
9
|
+
})
|
package/scripts/tags/lib/toc.js
CHANGED
|
@@ -14,7 +14,7 @@ function layoutDocTree(ctx, pages) {
|
|
|
14
14
|
pages.forEach((p, i) => {
|
|
15
15
|
el += '<li>'
|
|
16
16
|
el += '<a class="list-link" href="' + url_for(p.path) + '">'
|
|
17
|
-
el += '<span>' +
|
|
17
|
+
el += '<span>' + p.title + '</span>'
|
|
18
18
|
el += '</a>'
|
|
19
19
|
el += '</li>'
|
|
20
20
|
})
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
:root
|
|
2
2
|
--blur-px: 12px
|
|
3
|
-
--blur-bg:
|
|
4
|
-
if hexo-config('style.darkmode') == 'auto'
|
|
5
|
-
@media (prefers-color-scheme: dark)
|
|
6
|
-
:root
|
|
7
|
-
--blur-bg: alpha(black, .5)
|
|
8
|
-
if hexo-config('style.darkmode') == 'always'
|
|
9
|
-
:root
|
|
10
|
-
--blur-bg: alpha(black, .5)
|
|
3
|
+
--blur-bg: var(--alpha50)
|
|
11
4
|
|
|
12
5
|
blur-effect()
|
|
13
6
|
background: var(--blur-bg)
|
|
@@ -34,8 +34,8 @@ p>code:not([class]),li>code:not([class])
|
|
|
34
34
|
span
|
|
35
35
|
padding: 4px 0.5rem
|
|
36
36
|
display: block
|
|
37
|
-
border-bottom-left-radius: $border-
|
|
38
|
-
border-bottom-right-radius: $border-
|
|
37
|
+
border-bottom-left-radius: $border-button
|
|
38
|
+
border-bottom-right-radius: $border-button
|
|
39
39
|
background: var(--block-hover)
|
|
40
40
|
>table
|
|
41
41
|
overflow: auto
|
package/source/css/_custom.styl
CHANGED
|
@@ -50,7 +50,7 @@ $fs-h3 = 1.375rem // 22px
|
|
|
50
50
|
$fs-h4 = 1.125rem // 18px
|
|
51
51
|
$fs-h5 = $fs-15
|
|
52
52
|
$fs-h6 = $fs-12
|
|
53
|
-
$fs-
|
|
53
|
+
$fs-body = convert(hexo-config('style.font-size.body'))
|
|
54
54
|
$fs-code = convert(hexo-config('style.font-size.code'))
|
|
55
55
|
$fs-codeblock = convert(hexo-config('style.font-size.codeblock'))
|
|
56
56
|
|
|
@@ -65,6 +65,7 @@ $border-button = 4px
|
|
|
65
65
|
:root
|
|
66
66
|
--width-left: 288px
|
|
67
67
|
--width-main: 720px
|
|
68
|
+
--fs-p: $fs-body
|
|
68
69
|
--gap-l: 16px
|
|
69
70
|
--gap-p: 1rem // gap for paragraph
|
|
70
71
|
--gap-p-compact: 0.75rem
|
|
@@ -84,7 +85,13 @@ $border-button = 4px
|
|
|
84
85
|
@media screen and (max-width: $device-mobile-max)
|
|
85
86
|
--width-left: 288px
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
// 文章布局风格
|
|
89
|
+
.l_body.story
|
|
90
|
+
--fs-p: 'calc(%s + 2px)' % $fs-body
|
|
91
|
+
--gap-p: 1.5rem
|
|
92
|
+
.tag-plugin,p>img
|
|
93
|
+
margin-top: 2.4rem
|
|
94
|
+
margin-bottom: 2.4rem
|
|
88
95
|
|
|
89
96
|
// shadow
|
|
90
97
|
$boxshadow-card = 0 1px 2px 0px rgba(0, 0, 0, 0.1)
|
|
@@ -35,6 +35,11 @@ set_text_light()
|
|
|
35
35
|
:root
|
|
36
36
|
--site-bg: hsl($color-background-h, $color-background-s, $color-background-l)
|
|
37
37
|
--card: hsl($color-block-h, $color-block-s, 100)
|
|
38
|
+
--alpha20: rgba(white, 0.2)
|
|
39
|
+
--alpha50: rgba(white, 0.5)
|
|
40
|
+
--alpha60: rgba(white, 0.6)
|
|
41
|
+
--alpha100: white
|
|
42
|
+
--sidebar-bg: rgba(white, 0.5)
|
|
38
43
|
--block: hsl($color-block-h, $color-block-s, 95)
|
|
39
44
|
--block-border: hsl($color-block-h, $color-block-s, 90)
|
|
40
45
|
--block-hover: hsl($color-block-h, $color-block-s, 92)
|
|
@@ -48,6 +53,11 @@ set_darkmode()
|
|
|
48
53
|
--block: hsl($color-block-h, $color-block-s, 16)
|
|
49
54
|
--block-border: hsl($color-block-h, $color-block-s, 24)
|
|
50
55
|
--block-hover: hsl($color-block-h, $color-block-s, 20)
|
|
56
|
+
--alpha20: rgba(black, 0.2)
|
|
57
|
+
--alpha50: rgba(black, 0.5)
|
|
58
|
+
--alpha60: rgba(black, 0.6)
|
|
59
|
+
--alpha100: black
|
|
60
|
+
--sidebar-bg: rgba(black, 0.64)
|
|
51
61
|
set_text_light()
|
|
52
62
|
@media screen and (max-width: $device-mobile-max)
|
|
53
63
|
--site-bg: black
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
flex-shrink: 0
|
|
11
11
|
position: sticky
|
|
12
12
|
position: -webkit-sticky
|
|
13
|
-
top:
|
|
13
|
+
top: 8px
|
|
14
14
|
|
|
15
15
|
.l_body .l_main
|
|
16
16
|
flex-shrink: 1
|
|
@@ -20,6 +20,17 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
// 手机布局
|
|
23
|
+
.main-mask
|
|
24
|
+
position: fixed
|
|
25
|
+
pointer-events: none
|
|
26
|
+
top: 0
|
|
27
|
+
left: 0
|
|
28
|
+
width: 100%
|
|
29
|
+
height: 100%
|
|
30
|
+
background: rgba(black, 0.5)
|
|
31
|
+
z-index: 9
|
|
32
|
+
opacity 0
|
|
33
|
+
trans1 opacity
|
|
23
34
|
@media screen and (max-width: $device-mobile-max)
|
|
24
35
|
.mobile-only
|
|
25
36
|
display: block !important
|
|
@@ -29,10 +40,9 @@
|
|
|
29
40
|
position: fixed
|
|
30
41
|
transform: translateX(-320px)
|
|
31
42
|
margin: 0
|
|
32
|
-
left:
|
|
33
|
-
background: var(--site-bg)
|
|
43
|
+
left: 8px
|
|
34
44
|
box-shadow: $boxshadow-card-float
|
|
35
|
-
z-index:
|
|
45
|
+
z-index: 10
|
|
36
46
|
.l_main
|
|
37
47
|
max-width: 100%
|
|
38
48
|
.l_body.mobile
|
|
@@ -41,3 +51,6 @@
|
|
|
41
51
|
.l_body.mobile.sidebar
|
|
42
52
|
.l_left
|
|
43
53
|
transform: translateX(0px)
|
|
54
|
+
.main-mask
|
|
55
|
+
opacity 1
|
|
56
|
+
pointer-events: inherit
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// list
|
|
2
|
-
.post-list
|
|
2
|
+
.l_main .post-list
|
|
3
3
|
margin: 1rem
|
|
4
4
|
.post-title:first-child
|
|
5
5
|
margin-top: .5rem
|
|
6
6
|
|
|
7
|
-
.post-list
|
|
7
|
+
.l_main .post-list
|
|
8
8
|
.post-title
|
|
9
9
|
font-weight: 500
|
|
10
10
|
margin: 1.25rem 0 .75rem 0
|
|
@@ -52,6 +52,9 @@
|
|
|
52
52
|
img
|
|
53
53
|
object-fit: contain
|
|
54
54
|
height: 1.5em
|
|
55
|
+
svg
|
|
56
|
+
height: 1.5rem
|
|
57
|
+
color: $c-red
|
|
55
58
|
|
|
56
59
|
.post-list .post-card:hover
|
|
57
60
|
img
|