hexo-theme-stellar 1.22.1 → 1.24.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 +21 -9
- package/_data/widgets.yml +3 -0
- package/languages/en.yml +1 -0
- package/languages/zh-CN.yml +1 -0
- package/languages/zh-TW.yml +1 -0
- package/layout/_partial/head.ejs +29 -19
- package/layout/_partial/main/article/article_footer.ejs +16 -5
- package/layout/_partial/main/footer.ejs +18 -24
- package/layout/_partial/main/navbar/author_banner.ejs +31 -0
- package/layout/_partial/main/navbar/breadcrumb.ejs +20 -4
- package/layout/_partial/main/post_list/post_card.ejs +13 -1
- package/layout/_partial/plugins/comments/giscus/script.ejs +0 -1
- package/layout/_partial/plugins/parser/head.ejs +3 -0
- package/layout/_partial/plugins/parser/katex/head.ejs +3 -0
- package/layout/_partial/plugins/parser/katex/script.ejs +4 -0
- package/layout/_partial/plugins/parser/mathjax/script.ejs +20 -0
- package/layout/_partial/plugins/parser/mermaid/script.ejs +29 -0
- package/layout/_partial/plugins/parser/script.ejs +9 -0
- package/layout/_partial/scripts/index.ejs +19 -5
- package/layout/_partial/sidebar/index.ejs +1 -1
- package/layout/_partial/widgets/markdown.ejs +7 -2
- package/layout/_partial/widgets/toc.ejs +1 -1
- package/layout/archive.ejs +54 -37
- package/layout/page.ejs +1 -4
- package/layout/post.ejs +1 -7
- package/layout/wiki.ejs +1 -4
- package/package.json +1 -1
- package/scripts/events/index.js +2 -0
- package/scripts/events/lib/authors.js +21 -0
- package/scripts/events/lib/doc_tree.js +1 -2
- package/scripts/events/lib/links.js +17 -0
- package/scripts/generators/author.js +22 -0
- package/scripts/tags/index.js +5 -0
- package/scripts/tags/lib/albums.js +47 -0
- package/scripts/tags/lib/audio.js +23 -0
- package/scripts/tags/lib/copy.js +11 -13
- package/scripts/tags/lib/friends.js +13 -24
- package/scripts/tags/lib/gallery.js +6 -5
- package/scripts/tags/lib/grid.js +30 -30
- package/scripts/tags/lib/md.js +20 -0
- package/scripts/tags/lib/posters.js +47 -0
- package/scripts/tags/lib/sites.js +15 -24
- package/scripts/tags/lib/swiper.js +1 -1
- package/scripts/tags/lib/video.js +23 -0
- package/source/css/_common/media.styl +9 -0
- package/source/css/_common/toast.styl +25 -5
- package/source/css/_custom.styl +2 -1
- package/source/css/_defines/func.styl +11 -0
- package/source/css/_defines/theme.styl +2 -2
- package/source/css/_layout/list.styl +10 -12
- package/source/css/_layout/main.styl +4 -0
- package/source/css/_layout/md.styl +3 -0
- package/source/css/_layout/pages/archives.styl +10 -10
- package/source/css/_layout/partial/bread-nav.styl +3 -5
- package/source/css/_layout/partial/cover.styl +1 -0
- package/source/css/_layout/partial/navbar.styl +5 -5
- package/source/css/_layout/tag-plugins/banner.styl +24 -10
- package/source/css/_layout/tag-plugins/copy.styl +16 -13
- package/source/css/_layout/tag-plugins/folding.styl +6 -0
- package/source/css/_layout/tag-plugins/friends.styl +10 -37
- package/source/css/_layout/tag-plugins/gallery.styl +32 -15
- package/source/css/_layout/tag-plugins/grid.styl +3 -10
- package/source/css/_layout/tag-plugins/link.styl +2 -5
- package/source/css/_layout/tag-plugins/note.styl +7 -0
- package/source/css/_layout/tag-plugins/sites.styl +11 -39
- package/source/css/_layout/tag-plugins/tabs.styl +2 -0
- package/source/css/_layout/widgets/ghrepo.styl +1 -4
- package/source/css/_layout/widgets/toc_common.styl +22 -8
- package/source/css/_plugins/copycode.styl +18 -16
- package/source/css/_plugins/fancybox.styl +1 -4
- package/source/css/_plugins/index.styl +1 -1
- package/source/css/_plugins/lazyload.styl +4 -4
- package/source/js/main.js +7 -9
- package/source/js/plugins/copycode.js +1 -1
- package/source/js/plugins/friends.js +11 -11
- package/source/js/plugins/marked.js +50 -0
- package/source/js/plugins/sites.js +13 -14
- package/_data/links.yml +0 -7
- package/layout/mathjax.ejs +0 -29
- package/layout/mermaid.ejs +0 -32
package/_config.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
######## Stellar info ########
|
|
2
2
|
stellar:
|
|
3
|
-
version: '1.
|
|
3
|
+
version: '1.24.0'
|
|
4
4
|
homepage: 'https://xaoxuu.com/wiki/stellar/'
|
|
5
5
|
repo: 'https://github.com/xaoxuu/hexo-theme-stellar'
|
|
6
6
|
cdn_css: # Use cdn links instead of /css/main.css
|
|
@@ -8,6 +8,10 @@ stellar:
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
######## head tags ########
|
|
11
|
+
preconnect:
|
|
12
|
+
# - https://gcore.jsdelivr.net
|
|
13
|
+
# - https://unpkg.com
|
|
14
|
+
|
|
11
15
|
open_graph:
|
|
12
16
|
enable: true
|
|
13
17
|
twitter_id: # for open_graph meta
|
|
@@ -55,6 +59,8 @@ breadcrumb:
|
|
|
55
59
|
article:
|
|
56
60
|
# 如果没有指定封面,是否根据 tags 作为关键词搜索封面图片?
|
|
57
61
|
auto_cover: false # search from https://source.unsplash.com/
|
|
62
|
+
# 封面图宽高比
|
|
63
|
+
cover_ratio: 2.4
|
|
58
64
|
# 如果没有指定横幅,是否根据 tags 作为关键词搜索横幅图片?
|
|
59
65
|
auto_banner: false # search from https://source.unsplash.com/
|
|
60
66
|
# 如果没有指定 excerpt 和 description,将自动取多长的内容作为文章摘要?
|
|
@@ -107,6 +113,7 @@ comments:
|
|
|
107
113
|
# giscus
|
|
108
114
|
# https://giscus.app/zh-CN
|
|
109
115
|
giscus:
|
|
116
|
+
src: https://giscus.app/client.js
|
|
110
117
|
data-repo: xxx/xxx # [在此输入仓库]
|
|
111
118
|
data-repo-id: # [在此输入仓库 ID]
|
|
112
119
|
data-category: # [在此输入分类名]
|
|
@@ -208,7 +215,7 @@ footer:
|
|
|
208
215
|
# - '[关于本站](/)'
|
|
209
216
|
# - '[GitHub](/)'
|
|
210
217
|
content: | # 支持 Markdown 格式
|
|
211
|
-
本站由 [
|
|
218
|
+
本站由 [${author.name}](/) 使用 [${theme.name} ${theme.version}](${theme.tree}) 主题创建。
|
|
212
219
|
本博客所有文章除特别声明外,均采用 [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) 许可协议,转载请注明出处。
|
|
213
220
|
# 主题用户越多,开发者维护和更新的积极性就越高,如果您喜欢本主题,请在适当的位置显示主题信息和仓库链接以表支持。
|
|
214
221
|
|
|
@@ -240,7 +247,9 @@ tag_plugins:
|
|
|
240
247
|
# {% image %}
|
|
241
248
|
image:
|
|
242
249
|
fancybox: false # true, false
|
|
243
|
-
|
|
250
|
+
# {% copy xxx %}
|
|
251
|
+
copy:
|
|
252
|
+
toast: 复制成功
|
|
244
253
|
# {% timeline %}
|
|
245
254
|
timeline:
|
|
246
255
|
max-height: 80vh
|
|
@@ -296,6 +305,7 @@ plugins:
|
|
|
296
305
|
fcircle: /js/plugins/fcircle.js
|
|
297
306
|
weibo: /js/plugins/weibo.js
|
|
298
307
|
memos: /js/plugins/memos.js
|
|
308
|
+
marked: /js/plugins/marked.js
|
|
299
309
|
|
|
300
310
|
marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
|
|
301
311
|
|
|
@@ -332,7 +342,7 @@ plugins:
|
|
|
332
342
|
# 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
|
|
333
343
|
# 使用twikoo评论可以写: .tk-content img:not([class*="emo"])
|
|
334
344
|
# 使用waline评论可以写: #waline_container .vcontent img
|
|
335
|
-
selector: .
|
|
345
|
+
selector: .fancybox img # 多个选择器用英文逗号隔开
|
|
336
346
|
|
|
337
347
|
# swiper
|
|
338
348
|
swiper:
|
|
@@ -352,15 +362,15 @@ plugins:
|
|
|
352
362
|
# 需在Markdown文件开头加入mathjax: true
|
|
353
363
|
# 推荐使用Pandoc: npm uninstall hexo-renderer-marked --save & npm install hexo-renderer-pandoc --save
|
|
354
364
|
mathjax:
|
|
355
|
-
|
|
356
|
-
|
|
365
|
+
# set <mathjax: true> to enable in page's front-matter
|
|
366
|
+
js: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML
|
|
357
367
|
|
|
358
368
|
# Katex - The fastest math typesetting library for the web
|
|
359
369
|
# https://katex.org/docs/autorender.html
|
|
360
370
|
# https://github.com/KaTeX/KaTeX
|
|
361
371
|
# 使用 hexo-renderer-markdown-it-plus 作为公式渲染器:npm uninstall hexo-renderer-marked --save npm install hexo-renderer-markdown-it-plus --save
|
|
362
372
|
katex:
|
|
363
|
-
|
|
373
|
+
# set <katex: true> to enable in page's front-matter
|
|
364
374
|
min_css: <link rel="stylesheet" href="https://gcore.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css" integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
|
|
365
375
|
min_js: <script defer src="https://gcore.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.js" integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4" crossorigin="anonymous"></script>
|
|
366
376
|
auto_render_min_js: <script defer src="https://gcore.jsdelivr.net/npm/katex@0.16.4/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"onload="renderMathInElement(document.body);"></script>
|
|
@@ -375,7 +385,8 @@ plugins:
|
|
|
375
385
|
# B -->|option 2| C(Section C)
|
|
376
386
|
# ```
|
|
377
387
|
mermaid:
|
|
378
|
-
|
|
388
|
+
# set <mermaid: true> to enable in page's front-matter
|
|
389
|
+
style_optimization: false # use custom style in stellar
|
|
379
390
|
# js: https://unpkg.com/mermaid@9.0.0/dist/mermaid.min.js
|
|
380
391
|
js: https://cdn.jsdelivr.net/npm/mermaid@v9/dist/mermaid.min.js
|
|
381
392
|
# Available themes: default | dark | forest | neutral
|
|
@@ -387,6 +398,7 @@ plugins:
|
|
|
387
398
|
js: /js/plugins/copycode.js
|
|
388
399
|
default_text: 'Copy'
|
|
389
400
|
success_text: 'Copied'
|
|
401
|
+
toast: 复制成功
|
|
390
402
|
|
|
391
403
|
# AI 摘要
|
|
392
404
|
# https://github.com/zhheo/Post-Abstract-AI
|
|
@@ -419,7 +431,7 @@ style:
|
|
|
419
431
|
# 动态颜色(会根据明暗主题重设明度值,只用关心色相和饱和度即可)
|
|
420
432
|
background: 'hsl(212 16% 98%)' # 浅色背景颜色
|
|
421
433
|
block: 'hsl(212 8% 95%)' # 块背景颜色
|
|
422
|
-
code: 'hsl(14 100% 48%)' # 行内代码颜色
|
|
434
|
+
code: 'hsl(220 20% 10%)' # 'hsl(14 100% 48%)' # 行内代码颜色
|
|
423
435
|
text: 'hsl(0 0% 20%)' # 文本颜色
|
|
424
436
|
# 主题色配置(不会根据明暗动态调整,请设置为通用的颜色)
|
|
425
437
|
theme: 'hsl(192 98% 55%)' # 主题色
|
package/_data/widgets.yml
CHANGED
|
@@ -34,6 +34,7 @@ recent:
|
|
|
34
34
|
layout: recent
|
|
35
35
|
rss: # /atom.xml # npm i hexo-generator-feed
|
|
36
36
|
limit: 5 # Count of posts
|
|
37
|
+
|
|
37
38
|
# TOC (valid only in layout:post/wiki)
|
|
38
39
|
toc:
|
|
39
40
|
layout: toc
|
|
@@ -41,6 +42,8 @@ toc:
|
|
|
41
42
|
min_depth: 2
|
|
42
43
|
max_depth: 5
|
|
43
44
|
fallback: recent # Use a backup widget when toc does not exist.
|
|
45
|
+
collapse: false # true / false / auto
|
|
46
|
+
|
|
44
47
|
# github user info
|
|
45
48
|
ghuser:
|
|
46
49
|
layout: ghuser
|
package/languages/en.yml
CHANGED
package/languages/zh-CN.yml
CHANGED
package/languages/zh-TW.yml
CHANGED
package/layout/_partial/head.ejs
CHANGED
|
@@ -67,18 +67,38 @@ function og_args() {
|
|
|
67
67
|
}
|
|
68
68
|
return Object.assign(args, page.open_graph);
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
function preconnect() {
|
|
72
|
+
var el = '';
|
|
73
|
+
for (let href of (theme.preconnect || [])) {
|
|
74
|
+
el += `<link rel="preconnect" href="${href}" crossorigin>`;
|
|
75
|
+
}
|
|
76
|
+
return el;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function custom_inject() {
|
|
80
|
+
var el = '';
|
|
81
|
+
for (let item of (config.inject?.head || [])) {
|
|
82
|
+
el += item;
|
|
83
|
+
}
|
|
84
|
+
for (let item of (theme.inject?.head || [])) {
|
|
85
|
+
el += item;
|
|
86
|
+
}
|
|
87
|
+
for (let item of (page.inject?.head || [])) {
|
|
88
|
+
el += item;
|
|
89
|
+
}
|
|
90
|
+
return el;
|
|
91
|
+
}
|
|
92
|
+
|
|
70
93
|
%>
|
|
94
|
+
|
|
71
95
|
<head>
|
|
72
|
-
<%- meta_generator() %>
|
|
73
|
-
<meta name="hexo-theme" content="<%- stellar_info('tree') %>">
|
|
74
96
|
<meta charset="utf-8">
|
|
97
|
+
<meta name="hexo-theme" content="<%- stellar_info('tree') %>" theme-name="<%- stellar_info('name') %>" theme-version="<%- stellar_info('version') %>">
|
|
75
98
|
<%- generate_robots() %>
|
|
76
|
-
|
|
99
|
+
<%- meta_generator() %>
|
|
77
100
|
<meta http-equiv='x-dns-prefetch-control' content='on' />
|
|
78
|
-
|
|
79
|
-
<link rel="preconnect" href="https://gcore.jsdelivr.net" crossorigin>
|
|
80
|
-
<link rel='dns-prefetch' href='//unpkg.com'>
|
|
81
|
-
|
|
101
|
+
<%- preconnect() %>
|
|
82
102
|
<meta name="renderer" content="webkit">
|
|
83
103
|
<meta name="force-rendering" content="webkit">
|
|
84
104
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
|
@@ -115,16 +135,6 @@ function og_args() {
|
|
|
115
135
|
<%- css(theme.style.codeblock.highlightjs_theme) %>
|
|
116
136
|
<% } %>
|
|
117
137
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<%- theme.plugins.katex.min_js %>
|
|
121
|
-
<%- theme.plugins.katex.auto_render_min_js %>
|
|
122
|
-
<% } %>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<% if (config.inject && config.inject.head){ %>
|
|
126
|
-
<% (config.inject.head||[]).forEach(function(item){ %>
|
|
127
|
-
<%- item %>
|
|
128
|
-
<% }) %>
|
|
129
|
-
<% } %>
|
|
138
|
+
<%- partial('plugins/parser/head') %>
|
|
139
|
+
<%- custom_inject() %>
|
|
130
140
|
</head>
|
|
@@ -40,25 +40,36 @@ function layoutDiv() {
|
|
|
40
40
|
var license = ''
|
|
41
41
|
if (page.layout == 'post') {
|
|
42
42
|
if (theme.article.license && (page.license != false)) {
|
|
43
|
-
license =
|
|
43
|
+
license = page.license || theme.article.license
|
|
44
44
|
}
|
|
45
45
|
} else if (page.layout == 'wiki' && page.wiki) {
|
|
46
46
|
let proj = theme.wiki.tree[page.wiki]
|
|
47
47
|
if (page.license != null) {
|
|
48
|
-
license =
|
|
48
|
+
license = page.license || theme.article.license
|
|
49
49
|
} else if (proj?.license != null) {
|
|
50
50
|
if (proj.license == true) {
|
|
51
|
-
license =
|
|
51
|
+
license = theme.article.license
|
|
52
52
|
} else {
|
|
53
|
-
license =
|
|
53
|
+
license = proj.license
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
if (license.length > 0) {
|
|
58
|
+
var author = null
|
|
59
|
+
if (theme.authors) {
|
|
60
|
+
if (page.author?.length > 0 && theme.authors[page.author] != null) {
|
|
61
|
+
author = theme.authors[page.author]
|
|
62
|
+
} else {
|
|
63
|
+
author = theme.default_author
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (author) {
|
|
67
|
+
license = license.replace('${author.name}', author.name).replace('${author.url}', author.url)
|
|
68
|
+
}
|
|
58
69
|
el += `
|
|
59
70
|
<section id="license">
|
|
60
71
|
<div class="header"><span>${__('meta.license')}</span></div>
|
|
61
|
-
<div class="body">${license}</div>
|
|
72
|
+
<div class="body">${markdown(license)}</div>
|
|
62
73
|
</section>
|
|
63
74
|
`
|
|
64
75
|
}
|
|
@@ -1,41 +1,35 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const content = theme.footer.content
|
|
2
|
+
const content = theme.footer.content?.replace('${author.name}', (config.author || 'Anonymity'))?.replace('${theme.name}', stellar_info('name'))?.replace('${theme.version}', stellar_info('version'))?.replace('${theme.tree}', stellar_info('tree'))
|
|
3
3
|
function layoutDiv() {
|
|
4
|
-
var el = ''
|
|
5
|
-
el += '<footer class="page-footer reveal fs12">'
|
|
6
|
-
el += '<hr>'
|
|
4
|
+
var el = ''
|
|
5
|
+
el += '<footer class="page-footer reveal fs12">'
|
|
6
|
+
el += '<hr>'
|
|
7
7
|
// sitemap
|
|
8
8
|
if (theme.footer.sitemap && Object.keys(theme.footer.sitemap).length > 0) {
|
|
9
|
-
el += '<div class="sitemap">'
|
|
9
|
+
el += '<div class="sitemap">'
|
|
10
10
|
for (let group of Object.keys(theme.footer.sitemap)) {
|
|
11
|
-
let items = theme.footer.sitemap[group]
|
|
11
|
+
let items = theme.footer.sitemap[group]
|
|
12
12
|
if (items == undefined || items.length == 0) {
|
|
13
|
-
continue
|
|
13
|
+
continue
|
|
14
14
|
}
|
|
15
|
-
el += '<div class="sitemap-group">'
|
|
16
|
-
el += '<span class="fs14">' + group + '</span>'
|
|
15
|
+
el += '<div class="sitemap-group">'
|
|
16
|
+
el += '<span class="fs14">' + group + '</span>'
|
|
17
17
|
items.forEach((item, i) => {
|
|
18
|
-
el += '<a href="' + url_for(md_link(item)) + '">'
|
|
19
|
-
el += __(md_text(item))
|
|
20
|
-
el += '</a>'
|
|
18
|
+
el += '<a href="' + url_for(md_link(item)) + '">'
|
|
19
|
+
el += __(md_text(item))
|
|
20
|
+
el += '</a>'
|
|
21
21
|
});
|
|
22
|
-
el += '</div>'
|
|
22
|
+
el += '</div>'
|
|
23
23
|
}
|
|
24
|
-
el += '</div>'
|
|
24
|
+
el += '</div>'
|
|
25
25
|
}
|
|
26
26
|
// footer
|
|
27
|
-
el += '<div class="text">'
|
|
27
|
+
el += '<div class="text">'
|
|
28
28
|
if (content) {
|
|
29
|
-
|
|
30
|
-
el += markdown(content);
|
|
31
|
-
} else if ((typeof content == 'object') && content.constructor == Array) {
|
|
32
|
-
content.forEach((item, i) => {
|
|
33
|
-
el += markdown(item);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
29
|
+
el += markdown(content)
|
|
36
30
|
}
|
|
37
|
-
el += '</div></footer>'
|
|
38
|
-
return el
|
|
31
|
+
el += '</div></footer>'
|
|
32
|
+
return el
|
|
39
33
|
}
|
|
40
34
|
%>
|
|
41
35
|
<%- layoutDiv() %>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<%
|
|
2
|
+
function layoutDiv() {
|
|
3
|
+
const author = page.author
|
|
4
|
+
var el = ``
|
|
5
|
+
el += `<div class="tag-plugin banner author">`
|
|
6
|
+
if (author.banner) {
|
|
7
|
+
el += `<img class="bg" src="${author.banner}">`
|
|
8
|
+
}
|
|
9
|
+
el += `
|
|
10
|
+
<div class="content">
|
|
11
|
+
<div class="top">
|
|
12
|
+
<button class="back cap" onclick="window.history.back()">
|
|
13
|
+
<svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor">
|
|
14
|
+
<path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path>
|
|
15
|
+
</svg>
|
|
16
|
+
</button>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="bottom">
|
|
19
|
+
<img class="avatar" src="${author.avatar}">
|
|
20
|
+
<div class="text-area">
|
|
21
|
+
<p class="text title">${author.name}</p>
|
|
22
|
+
<div class="text subtitle">${author.description || ""}</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
`
|
|
27
|
+
el += `</div>`
|
|
28
|
+
return el
|
|
29
|
+
}
|
|
30
|
+
%>
|
|
31
|
+
<%- layoutDiv() %>
|
|
@@ -35,13 +35,29 @@ function layoutDiv() {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
el += '</div>';
|
|
38
|
-
//
|
|
38
|
+
// 作者
|
|
39
|
+
var author = null
|
|
40
|
+
if (theme.authors) {
|
|
41
|
+
if (page.author?.length > 0 && theme.authors[page.author] != null) {
|
|
42
|
+
author = theme.authors[page.author]
|
|
43
|
+
} else {
|
|
44
|
+
author = theme.default_author
|
|
45
|
+
}
|
|
46
|
+
}
|
|
39
47
|
el += '<div id="post-meta">';
|
|
48
|
+
if (author) {
|
|
49
|
+
let link = `<a href="${url_for(author.path)}">${author.name}</a>`
|
|
50
|
+
el += `<span class="author">${__("meta.created_author", link)}</span>`
|
|
51
|
+
} else {
|
|
52
|
+
el += `<span class="author">${__("meta.created")}</span>`
|
|
53
|
+
}
|
|
54
|
+
// 发布日期
|
|
40
55
|
el += `
|
|
41
|
-
<span
|
|
56
|
+
<span class="created"><time datetime="${date_xml(page.date)}">${date(page.date, config.date_format)}</time></span>
|
|
42
57
|
`;
|
|
58
|
+
// 更新日期
|
|
43
59
|
el += `
|
|
44
|
-
<span>${__("meta.updated")} <time datetime="${date_xml(page.updated)}">${date(page.updated, config.date_format)}</time></span>
|
|
60
|
+
<span class="updated">${__("symbol.comma") + __("meta.updated")} <time datetime="${date_xml(page.updated)}">${date(page.updated, config.date_format)}</time></span>
|
|
45
61
|
`;
|
|
46
62
|
el += '</div>';
|
|
47
63
|
|
|
@@ -84,7 +100,7 @@ function layoutDiv() {
|
|
|
84
100
|
el += '</div>';
|
|
85
101
|
el += '</div>';
|
|
86
102
|
|
|
87
|
-
|
|
103
|
+
const repo = page.repo || proj?.repo
|
|
88
104
|
if (repo) {
|
|
89
105
|
el += `
|
|
90
106
|
<div class="right ghrepo stellar-ghinfo-api" api="${theme.api_host.ghapi}/repos/${repo}">
|
|
@@ -68,8 +68,20 @@ function div_default() {
|
|
|
68
68
|
|
|
69
69
|
// meta
|
|
70
70
|
el += '<div class="meta cap">';
|
|
71
|
-
// time
|
|
72
71
|
el += '<span class="cap" id="post-meta">';
|
|
72
|
+
// author
|
|
73
|
+
var author = null
|
|
74
|
+
if (theme.authors) {
|
|
75
|
+
if (page.author?.length > 0 && theme.authors[page.author] != null) {
|
|
76
|
+
author = theme.authors[page.author]
|
|
77
|
+
} else {
|
|
78
|
+
author = theme.default_author
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (author) {
|
|
82
|
+
el += author.name + ' '
|
|
83
|
+
}
|
|
84
|
+
// time
|
|
73
85
|
el += __("meta.created") + ' ' + '<time datetime="' + date_xml(post.date) + '">' + date(post.date, config.date_format) + '</time>';
|
|
74
86
|
el += '</span>';
|
|
75
87
|
// cat
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script type="text/javascript" src="<%- theme.plugins.mathjax.js %>"></script>
|
|
2
|
+
<script type="text/x-mathjax-config">
|
|
3
|
+
MathJax.Hub.Config({
|
|
4
|
+
tex2jax: {
|
|
5
|
+
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
|
6
|
+
processEscapes: true
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
MathJax.Hub.Config({
|
|
10
|
+
tex2jax: {
|
|
11
|
+
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
MathJax.Hub.Queue(function() {
|
|
15
|
+
var all = MathJax.Hub.getAllJax(), i;
|
|
16
|
+
for(i=0; i < all.length; i += 1) {
|
|
17
|
+
all[i].SourceElement().parentNode.className += ' has-jax';
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script type="text/javascript" src="<%- theme.plugins.mermaid.js %>"></script>
|
|
2
|
+
<script>
|
|
3
|
+
var mermaid_config = {
|
|
4
|
+
startOnLoad: true,
|
|
5
|
+
theme:
|
|
6
|
+
"<%- theme.style.darkmode %>" == "auto" &&
|
|
7
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
8
|
+
? "dark"
|
|
9
|
+
: "<%- theme.plugins.mermaid.theme %>",
|
|
10
|
+
logLevel: 3,
|
|
11
|
+
themeVariables: {
|
|
12
|
+
darkMode: true
|
|
13
|
+
},
|
|
14
|
+
flowchart: {
|
|
15
|
+
useMaxWidth: false,
|
|
16
|
+
htmlLabels: true,
|
|
17
|
+
curve: "linear"
|
|
18
|
+
},
|
|
19
|
+
gantt: {
|
|
20
|
+
axisFormat: "%Y/%m/%d"
|
|
21
|
+
},
|
|
22
|
+
sequence: {
|
|
23
|
+
actorMargin: 50
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (window.mermaid) {
|
|
27
|
+
mermaid.initialize(mermaid_config);
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
<%
|
|
2
|
+
|
|
3
|
+
function custom_inject() {
|
|
4
|
+
var el = '';
|
|
5
|
+
for (let item of (config.inject?.script || [])) {
|
|
6
|
+
el += item;
|
|
7
|
+
}
|
|
8
|
+
for (let item of (theme.inject?.script || [])) {
|
|
9
|
+
el += item;
|
|
10
|
+
}
|
|
11
|
+
for (let item of (page.inject?.script || [])) {
|
|
12
|
+
el += item;
|
|
13
|
+
}
|
|
14
|
+
return el;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
%>
|
|
1
18
|
<script type="text/javascript">
|
|
2
19
|
const stellar = {
|
|
3
20
|
// 懒加载 css https://github.com/filamentgroup/loadCSS
|
|
@@ -157,10 +174,7 @@
|
|
|
157
174
|
|
|
158
175
|
<!-- optional -->
|
|
159
176
|
<%- partial('../plugins/comments/script') %>
|
|
177
|
+
<%- partial('../plugins/parser/script') %>
|
|
160
178
|
|
|
161
179
|
<!-- inject -->
|
|
162
|
-
|
|
163
|
-
<% config.inject.script.forEach(function(js) { %>
|
|
164
|
-
<%- js %>
|
|
165
|
-
<% }) %>
|
|
166
|
-
<% } %>
|
|
180
|
+
<%- custom_inject() %>
|
|
@@ -7,7 +7,7 @@ if (page.layout === 'wiki' && page.wiki) {
|
|
|
7
7
|
if (page.sidebar == undefined) {
|
|
8
8
|
if (page.layout == 'post' && page.content) {
|
|
9
9
|
page.sidebar = theme.sidebar.widgets.post;
|
|
10
|
-
} else if (page.layout == 'wiki' && page.
|
|
10
|
+
} else if (page.layout == 'wiki' && page.wiki) {
|
|
11
11
|
let proj = theme.wiki.tree[page.wiki];
|
|
12
12
|
if (proj?.sidebar) {
|
|
13
13
|
page.sidebar = proj.sidebar;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%
|
|
2
2
|
function layoutDiv() {
|
|
3
|
-
if (!item.content?.length) return ''
|
|
3
|
+
if (!item.content?.length && !item.src?.length) return ''
|
|
4
4
|
var el = '';
|
|
5
5
|
el += '<widget class="widget-wrapper markdown">';
|
|
6
6
|
if (item.title?.length > 0) {
|
|
@@ -9,7 +9,12 @@ function layoutDiv() {
|
|
|
9
9
|
el += '</div>';
|
|
10
10
|
}
|
|
11
11
|
el += '<div class="widget-body fs14">';
|
|
12
|
-
|
|
12
|
+
if (item.content) {
|
|
13
|
+
el += markdown(item.content);
|
|
14
|
+
}
|
|
15
|
+
if (item.src) {
|
|
16
|
+
el += `<div class="stellar-marked-api md-marked" src="${item.src}"></div>`
|
|
17
|
+
}
|
|
13
18
|
el += '</div>';
|
|
14
19
|
el += '</widget>';
|
|
15
20
|
return el;
|
|
@@ -66,7 +66,7 @@ function layoutDiv(fallback) {
|
|
|
66
66
|
|
|
67
67
|
var el = '';
|
|
68
68
|
if (type.length > 0) {
|
|
69
|
-
el +=
|
|
69
|
+
el += `<widget class="widget-wrapper toc ${type}" id="data-toc" collapse="${item.collapse}">`;
|
|
70
70
|
if (page.layout !== 'wiki') {
|
|
71
71
|
// post 布局
|
|
72
72
|
el += layoutTocHeader(page.toc_title);
|