hexo-theme-stellar 1.8.0 → 1.10.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 +85 -22
- package/languages/en.yml +0 -5
- package/languages/zh-CN.yml +0 -5
- package/languages/zh-TW.yml +0 -5
- package/layout/404.ejs +1 -1
- package/layout/_partial/cover/post_cover.ejs +25 -3
- package/layout/_partial/head.ejs +11 -0
- package/layout/_partial/main/footer.ejs +6 -17
- package/layout/_partial/main/header/index.ejs +1 -1
- package/layout/_partial/plugins/comments/giscus/layout.ejs +39 -0
- package/layout/_partial/plugins/comments/giscus/script.ejs +26 -0
- package/layout/_partial/plugins/comments/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/valine/script.ejs +1 -1
- package/layout/_partial/scripts/index.ejs +5 -3
- package/layout/_partial/sidebar/index.ejs +3 -1
- package/layout/_partial/sidebar/widgets/ghuser.ejs +59 -0
- package/layout/_partial/sidebar/widgets/repo_info.ejs +28 -9
- package/layout/mathjax.ejs +29 -0
- package/layout/page.ejs +1 -1
- package/layout/post.ejs +4 -1
- package/layout/wiki.ejs +1 -1
- package/package.json +1 -1
- package/scripts/tags/about.js +12 -13
- package/scripts/tags/friends.js +2 -3
- package/scripts/tags/ghcard.js +2 -2
- package/scripts/tags/index.js +3 -0
- package/scripts/tags/lib/users.js +22 -0
- package/scripts/tags/sites.js +2 -3
- package/scripts/tags/timeline.js +30 -25
- package/source/css/_common/base.styl +2 -0
- package/source/css/_common/button.styl +1 -1
- package/source/css/_common/cap.styl +1 -0
- package/source/css/_common/device.styl +2 -2
- package/source/css/_common/highlight.styl +18 -6
- package/source/css/_common/html.styl +2 -0
- package/source/css/_common/loading.styl +5 -0
- package/source/css/_common/pre.styl +6 -0
- package/source/css/_custom.styl +17 -1
- package/source/css/_defines/const.styl +1 -0
- package/source/css/_defines/theme.styl +1 -1
- package/source/css/_layout/layout.styl +2 -2
- package/source/css/_layout/main.styl +3 -3
- package/source/css/_layout/md.styl +39 -13
- package/source/css/_layout/partial/article-footer.styl +0 -2
- package/source/css/_layout/partial/footer.styl +4 -2
- package/source/css/_layout/partial/navbar.styl +1 -1
- package/source/css/_layout/partial/paginator.styl +4 -0
- package/source/css/_layout/partial/related.styl +3 -0
- package/source/css/_layout/sidebar/ghuser.styl +80 -0
- package/source/css/_layout/sidebar/repo_info.styl +4 -1
- package/source/css/_layout/sidebar/sidebar.styl +3 -4
- package/source/css/_layout/tag-plugins/about.styl +13 -16
- package/source/css/_layout/tag-plugins/common.styl +1 -1
- package/source/css/_layout/tag-plugins/folding.styl +2 -0
- package/source/css/_layout/tag-plugins/friends.styl +3 -6
- package/source/css/_layout/tag-plugins/inline-labels.styl +1 -0
- package/source/css/_layout/tag-plugins/link.styl +2 -1
- package/source/css/_layout/tag-plugins/note.styl +8 -0
- package/source/css/_layout/tag-plugins/sites.styl +2 -6
- package/source/css/_layout/tag-plugins/tabs.styl +5 -0
- package/source/css/_layout/tag-plugins/timeline.styl +85 -2
- package/source/css/_layout/tag-plugins/toc.styl +1 -1
- package/source/css/_plugins/comments/utterances.styl +3 -0
- package/source/css/_plugins/comments/waline.styl +61 -0
- package/source/css/_plugins/index.styl +2 -0
- package/source/js/main.js +13 -15
- package/source/js/plugins/friends.js +5 -5
- package/source/js/plugins/ghinfo.js +73 -0
- package/source/js/plugins/sites.js +1 -1
- package/source/js/plugins/timeline.js +122 -0
package/_config.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
######## Stellar info ########
|
|
2
2
|
stellar:
|
|
3
|
-
version: '1.
|
|
3
|
+
version: '1.10.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
|
|
@@ -25,7 +25,7 @@ sidebar:
|
|
|
25
25
|
# about: '[关于](/about/)'
|
|
26
26
|
# Sidebar widgets
|
|
27
27
|
widget_layout:
|
|
28
|
-
index: [welcome, recent] # for home/wiki/categories/tags/archives/404 pages
|
|
28
|
+
index: [welcome, recent, ghuser_mini] # for home/wiki/categories/tags/archives/404 pages
|
|
29
29
|
page: [welcome, toc] # for pages using 'layout:page'
|
|
30
30
|
post: [toc, repo_info] # for pages using 'layout:post'
|
|
31
31
|
wiki: [toc, repo_info, wiki_more] # for pages using 'layout:wiki'
|
|
@@ -42,6 +42,18 @@ sidebar:
|
|
|
42
42
|
min_depth: 2
|
|
43
43
|
max_depth: 5
|
|
44
44
|
fallback: recent # Use a backup widget when toc does not exist.
|
|
45
|
+
# github user info
|
|
46
|
+
ghuser:
|
|
47
|
+
layout: ghuser
|
|
48
|
+
api: https://api.github.com
|
|
49
|
+
username: github # your github login username
|
|
50
|
+
avatar: true
|
|
51
|
+
ghuser_mini:
|
|
52
|
+
layout: ghuser
|
|
53
|
+
header: # GitHub Info
|
|
54
|
+
api: https://api.github.com
|
|
55
|
+
username: github # your github login username
|
|
56
|
+
avatar: false
|
|
45
57
|
# welcome
|
|
46
58
|
welcome:
|
|
47
59
|
layout: markdown
|
|
@@ -65,15 +77,17 @@ breadcrumb:
|
|
|
65
77
|
|
|
66
78
|
######## Article ########
|
|
67
79
|
article:
|
|
68
|
-
# 如果没有指定封面,是否根据 tags
|
|
80
|
+
# 如果没有指定封面,是否根据 tags 作为关键词搜索封面图片?
|
|
69
81
|
auto_cover: false # search from https://source.unsplash.com/
|
|
82
|
+
# 如果没有指定横幅,是否根据 tags 作为关键词搜索横幅图片?
|
|
83
|
+
auto_banner: false # search from https://source.unsplash.com/
|
|
70
84
|
# 如果没有指定 excerpt 和 description,将自动取多长的内容作为文章摘要?
|
|
71
85
|
auto_excerpt: 200
|
|
72
86
|
# 分类颜色
|
|
73
87
|
category_color:
|
|
74
88
|
'新闻稿': '#DA0F47'
|
|
75
89
|
# 文章许可协议
|
|
76
|
-
license: '本文采用
|
|
90
|
+
license: '本文采用[署名-非商业性使用-相同方式共享 4.0 国际](https://creativecommons.org/licenses/by-nc-sa/4.0/)许可协议,转载请注明出处。'
|
|
77
91
|
# 分享
|
|
78
92
|
share: # [wechat, weibo, email, link]
|
|
79
93
|
# 相关文章,需要安装插件 (for layout: post)
|
|
@@ -84,7 +98,6 @@ article:
|
|
|
84
98
|
auto_cover: true # 如果没有封面就根据 tags 作为关键词搜索封面,开了此项将不会自动从文章中提取首张图片作为封面了。
|
|
85
99
|
|
|
86
100
|
|
|
87
|
-
|
|
88
101
|
######## Comments ########
|
|
89
102
|
comments:
|
|
90
103
|
service: # beaudar, utterances, valine, twikoo, waline
|
|
@@ -109,6 +122,23 @@ comments:
|
|
|
109
122
|
issue-number:
|
|
110
123
|
theme: preferred-color-scheme
|
|
111
124
|
label:
|
|
125
|
+
# giscus
|
|
126
|
+
# https://giscus.app/zh-CN
|
|
127
|
+
giscus:
|
|
128
|
+
data-repo: xxx/xxx # [在此输入仓库]
|
|
129
|
+
data-repo-id: # [在此输入仓库 ID]
|
|
130
|
+
data-category: # [在此输入分类名]
|
|
131
|
+
data-category-id:
|
|
132
|
+
data-mapping: pathname
|
|
133
|
+
data-strict: 0
|
|
134
|
+
data-reactions-enabled: 1
|
|
135
|
+
data-emit-metadata: 0
|
|
136
|
+
data-input-position: top # top, bottom
|
|
137
|
+
data-theme: preferred_color_scheme
|
|
138
|
+
data-lang: zh-CN
|
|
139
|
+
data-loading: lazy
|
|
140
|
+
crossorigin: anonymous
|
|
141
|
+
|
|
112
142
|
valine:
|
|
113
143
|
js: https://fastly.jsdelivr.net/gh/XuxuGood/simple-blog-cdn@main/js/Valine.min.js
|
|
114
144
|
appId: # your appId
|
|
@@ -140,7 +170,7 @@ comments:
|
|
|
140
170
|
js: https://unpkg.com/@waline/client@v2/dist/waline.js
|
|
141
171
|
css: https://unpkg.com/@waline/client@v2/dist/waline.css
|
|
142
172
|
# Waline server address url, you should set this to your own link
|
|
143
|
-
serverURL:
|
|
173
|
+
serverURL:
|
|
144
174
|
|
|
145
175
|
# If false, comment count will only be displayed in post page, not in home page
|
|
146
176
|
commentCount: true
|
|
@@ -154,12 +184,13 @@ comments:
|
|
|
154
184
|
|
|
155
185
|
# Custom emoji
|
|
156
186
|
# emoji:
|
|
157
|
-
# - https://unpkg.com/@waline/emojis@1.0
|
|
158
|
-
# - https://unpkg.com/@waline/emojis@1.0
|
|
159
|
-
# - https://unpkg.com/@waline/emojis@1.0
|
|
160
|
-
# - https://unpkg.com/@waline/emojis@1.0
|
|
161
|
-
# - https://unpkg.com/@waline/emojis@1.0
|
|
162
|
-
# - https://unpkg.com/@waline/emojis@1.0
|
|
187
|
+
# - https://unpkg.com/@waline/emojis@1.1.0/weibo
|
|
188
|
+
# - https://unpkg.com/@waline/emojis@1.1.0/alus
|
|
189
|
+
# - https://unpkg.com/@waline/emojis@1.1.0/bilibili
|
|
190
|
+
# - https://unpkg.com/@waline/emojis@1.1.0/qq
|
|
191
|
+
# - https://unpkg.com/@waline/emojis@1.1.0/tieba
|
|
192
|
+
# - https://unpkg.com/@waline/emojis@1.1.0/tw-emoji
|
|
193
|
+
# - https://unpkg.com/@waline/emojis@1.1.0/bmoji
|
|
163
194
|
|
|
164
195
|
# Comment infomation, valid meta are nick, mail and link
|
|
165
196
|
# meta:
|
|
@@ -212,9 +243,10 @@ footer:
|
|
|
212
243
|
# '更多':
|
|
213
244
|
# - '[关于本站](/)'
|
|
214
245
|
# - '[GitHub](/)'
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
246
|
+
content: | # 支持 Markdown 格式
|
|
247
|
+
本站由 [@anonymity](/) 使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar) 主题创建。
|
|
248
|
+
本博客所有文章除特别声明外,均采用 [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) 许可协议,转载请注明出处。
|
|
249
|
+
# 主题用户越多,开发者维护和更新的积极性就越高,如果您喜欢本主题,请在适当的位置显示主题信息和仓库链接以表支持。
|
|
218
250
|
|
|
219
251
|
|
|
220
252
|
######## Tag Plugins ########
|
|
@@ -234,14 +266,17 @@ tag_plugins:
|
|
|
234
266
|
prefix: https://s2.loli.net/2022/01/04/UvHcsa73jQPnobq.png
|
|
235
267
|
# {% emoji %}
|
|
236
268
|
emoji:
|
|
237
|
-
default: https://fastly.jsdelivr.net/gh/
|
|
269
|
+
default: https://fastly.jsdelivr.net/gh/cdn-x/emoji/qq/%s.gif
|
|
238
270
|
twemoji: https://fastly.jsdelivr.net/gh/twitter/twemoji/assets/svg/%s.svg
|
|
239
|
-
qq: https://fastly.jsdelivr.net/gh/
|
|
240
|
-
aru: https://fastly.jsdelivr.net/gh/
|
|
241
|
-
tieba: https://fastly.jsdelivr.net/gh/
|
|
271
|
+
qq: https://fastly.jsdelivr.net/gh/cdn-x/emoji/qq/%s.gif
|
|
272
|
+
aru: https://fastly.jsdelivr.net/gh/cdn-x/emoji/aru-l/%s.gif
|
|
273
|
+
tieba: https://fastly.jsdelivr.net/gh/cdn-x/emoji/tieba/%s.png
|
|
242
274
|
# {% image %}
|
|
243
275
|
image:
|
|
244
276
|
fancybox: # true, false
|
|
277
|
+
# {% timeline %}
|
|
278
|
+
timeline:
|
|
279
|
+
max-height: 80vh
|
|
245
280
|
|
|
246
281
|
|
|
247
282
|
######## JS Plugins ########
|
|
@@ -250,9 +285,15 @@ plugins:
|
|
|
250
285
|
# jquery
|
|
251
286
|
jquery: https://fastly.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js
|
|
252
287
|
|
|
253
|
-
#
|
|
254
|
-
|
|
255
|
-
|
|
288
|
+
# stellar api
|
|
289
|
+
stellar:
|
|
290
|
+
sites: /js/plugins/sites.js
|
|
291
|
+
friends: /js/plugins/friends.js
|
|
292
|
+
ghinfo: /js/plugins/ghinfo.js
|
|
293
|
+
timeline: /js/plugins/timeline.js
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
|
|
256
297
|
|
|
257
298
|
## optional plugins ##
|
|
258
299
|
# preload
|
|
@@ -304,9 +345,30 @@ plugins:
|
|
|
304
345
|
css: https://unpkg.com/heti/umd/heti.min.css
|
|
305
346
|
js: https://unpkg.com/heti/umd/heti-addon.min.js
|
|
306
347
|
|
|
348
|
+
# MathJax
|
|
349
|
+
# 需在Markdown文件开头加入mathjax: true
|
|
350
|
+
# 推荐使用Pandoc: npm uninstall hexo-renderer-marked --save & npm install hexo-renderer-pandoc --save
|
|
351
|
+
mathjax:
|
|
352
|
+
enable: false
|
|
353
|
+
cdn: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML
|
|
354
|
+
|
|
355
|
+
# Katex - The fastest math typesetting library for the web
|
|
356
|
+
# https://katex.org/docs/autorender.html
|
|
357
|
+
# https://github.com/KaTeX/KaTeX
|
|
358
|
+
# 使用 hexo-renderer-markdown-it-plus 作为公式渲染器:npm uninstall hexo-renderer-marked --save npm install hexo-renderer-markdown-it-plus --save
|
|
359
|
+
katex:
|
|
360
|
+
enable: false
|
|
361
|
+
min_css: <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css" integrity="sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC" crossorigin="anonymous">
|
|
362
|
+
min_js: <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.js" integrity="sha384-X/XCfMm41VSsqRNQgDerQczD69XqmjOOOwYQvr/uuC+j4OPoNhVgjdGFwhvN02Ja" crossorigin="anonymous"></script>
|
|
363
|
+
auto_render_min_js: <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"onload="renderMathInElement(document.body);"></script>
|
|
307
364
|
|
|
308
365
|
style:
|
|
309
366
|
darkmode: auto # auto / always / false
|
|
367
|
+
smooth_scroll: true # true / false
|
|
368
|
+
font-family:
|
|
369
|
+
logo: system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif
|
|
370
|
+
body: system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif
|
|
371
|
+
code: Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif
|
|
310
372
|
theme:
|
|
311
373
|
light: '#f8f8f8'
|
|
312
374
|
dark: '#313438'
|
|
@@ -315,6 +377,7 @@ style:
|
|
|
315
377
|
background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp
|
|
316
378
|
codeblock:
|
|
317
379
|
scrollbar: 4px
|
|
380
|
+
highlightjs_theme: https://fastly.jsdelivr.net/gh/highlightjs/cdn-release@11.5.0/build/styles/atom-one-dark.min.css
|
|
318
381
|
|
|
319
382
|
default:
|
|
320
383
|
avatar: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
|
package/languages/en.yml
CHANGED
|
@@ -36,11 +36,6 @@ meta:
|
|
|
36
36
|
day: days ago
|
|
37
37
|
month: months ago
|
|
38
38
|
|
|
39
|
-
footer:
|
|
40
|
-
license: 'All articles in this blog are licensed under %s unless stating additionally.'
|
|
41
|
-
info_not_open_source: 'This site was deployed by %s using %s.'
|
|
42
|
-
info_open_source: 'This site was deployed by %s using %s. You can find the source code in %s.'
|
|
43
|
-
|
|
44
39
|
page:
|
|
45
40
|
error:
|
|
46
41
|
what: Page Not Found
|
package/languages/zh-CN.yml
CHANGED
package/languages/zh-TW.yml
CHANGED
package/layout/404.ejs
CHANGED
|
@@ -1,15 +1,37 @@
|
|
|
1
1
|
<%
|
|
2
2
|
function div() {
|
|
3
3
|
var el = '';
|
|
4
|
-
if (page.banner == undefined || page.banner == false) {
|
|
4
|
+
if ((page.banner == undefined || page.banner == false) && !theme.article.auto_banner) {
|
|
5
5
|
return el;
|
|
6
6
|
}
|
|
7
|
+
var url;
|
|
8
|
+
if (page.banner != undefined) {
|
|
9
|
+
if (page.banner.includes('/')) {
|
|
10
|
+
url = page.banner;
|
|
11
|
+
} else {
|
|
12
|
+
url = 'https://source.unsplash.com/2000x400/?' + page.banner;
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
// 自动以 tags 作为关键词搜索封面
|
|
16
|
+
if (page.tags) {
|
|
17
|
+
var params = '';
|
|
18
|
+
page.tags.reverse().forEach((tag, i) => {
|
|
19
|
+
if (i > 0) {
|
|
20
|
+
params += ',';
|
|
21
|
+
}
|
|
22
|
+
params += tag.name;
|
|
23
|
+
});
|
|
24
|
+
url = 'https://source.unsplash.com/2000x400/?' + params;
|
|
25
|
+
} else {
|
|
26
|
+
url = 'https://source.unsplash.com/random/2000x400';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
7
29
|
el += '<div class="l_cover post' + scrollreveal() + '">';
|
|
8
30
|
el += '<div class="cover">';
|
|
9
31
|
if (theme.plugins.lazyload && theme.plugins.lazyload.enable) {
|
|
10
|
-
el += '<div class="lazy img bg" data-bg="' +
|
|
32
|
+
el += '<div class="lazy img bg" data-bg="' + url + '"></div>';
|
|
11
33
|
} else {
|
|
12
|
-
el += '<div class="lazy img bg" style="background-image:url("' +
|
|
34
|
+
el += '<div class="lazy img bg" style="background-image:url("' + url + '")"></div>';
|
|
13
35
|
}
|
|
14
36
|
el += '</div>';
|
|
15
37
|
el += '</div>';
|
package/layout/_partial/head.ejs
CHANGED
|
@@ -82,6 +82,17 @@ function og_args() {
|
|
|
82
82
|
<%- favicon_tag(config.favicon) %>
|
|
83
83
|
<% } %>
|
|
84
84
|
|
|
85
|
+
<% if (config.highlight && config.highlight.enable == true && config.highlight.hljs == true) { %>
|
|
86
|
+
<%- css(theme.style.codeblock.highlightjs_theme) %>
|
|
87
|
+
<% } %>
|
|
88
|
+
|
|
89
|
+
<% if (theme.plugins.katex && theme.plugins.katex.enable) { %>
|
|
90
|
+
<%- theme.plugins.katex.min_css %>
|
|
91
|
+
<%- theme.plugins.katex.min_js %>
|
|
92
|
+
<%- theme.plugins.katex.auto_render_min_js %>
|
|
93
|
+
<% } %>
|
|
94
|
+
|
|
95
|
+
|
|
85
96
|
<% if (config.inject && config.inject.head){ %>
|
|
86
97
|
<% (config.inject.head||[]).forEach(function(item){ %>
|
|
87
98
|
<%- item %>
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const
|
|
3
|
-
const using = '[' + stellar_info('name') + '](' + stellar_info('tree') + ' "v' + stellar_info('version') + '")';
|
|
4
|
-
const source = theme.footer.source;
|
|
5
|
-
const more = theme.footer.more;
|
|
2
|
+
const content = theme.footer.content;
|
|
6
3
|
function layoutDiv() {
|
|
7
4
|
var el = '';
|
|
8
5
|
el += '<footer class="page-footer reveal fs12">';
|
|
@@ -28,19 +25,11 @@ function layoutDiv() {
|
|
|
28
25
|
}
|
|
29
26
|
// footer
|
|
30
27
|
el += '<div class="text">';
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} else {
|
|
37
|
-
el += markdown(__('footer.info_not_open_source', author, using));
|
|
38
|
-
}
|
|
39
|
-
if (more) {
|
|
40
|
-
if ((typeof more == 'string') && more.constructor == String) {
|
|
41
|
-
el += markdown(more);
|
|
42
|
-
} else if ((typeof more == 'object') && more.constructor == Array) {
|
|
43
|
-
more.forEach((item, i) => {
|
|
28
|
+
if (content) {
|
|
29
|
+
if ((typeof content == 'string') && content.constructor == String) {
|
|
30
|
+
el += markdown(content);
|
|
31
|
+
} else if ((typeof content == 'object') && content.constructor == Array) {
|
|
32
|
+
content.forEach((item, i) => {
|
|
44
33
|
el += markdown(item);
|
|
45
34
|
});
|
|
46
35
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<%
|
|
2
|
+
function layoutDiv() {
|
|
3
|
+
const cmt = 'giscus';
|
|
4
|
+
// 合并配置参数
|
|
5
|
+
var config = Object.assign({}, theme.comments[cmt]);
|
|
6
|
+
if (page.layout === 'wiki' && page.wiki) {
|
|
7
|
+
let proj = theme.wiki.projects[page.wiki];
|
|
8
|
+
if (proj[cmt] != undefined) {
|
|
9
|
+
Object.assign(config, proj[cmt]);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
Object.assign(config, page[cmt]);
|
|
13
|
+
// 合并评论数据
|
|
14
|
+
if (page.comment_id != undefined) {
|
|
15
|
+
config['data-mapping'] = 'specific';
|
|
16
|
+
config['data-term'] = page.comment_id;
|
|
17
|
+
} else if (page.layout === 'wiki' && page.wiki) {
|
|
18
|
+
let proj = theme.wiki.projects[page.wiki];
|
|
19
|
+
if (proj.comment_id != undefined) {
|
|
20
|
+
config['data-mapping'] = 'specific';
|
|
21
|
+
config['data-term'] = proj.comment_id;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// 布局
|
|
25
|
+
var el = '';
|
|
26
|
+
el += '<div id="' + cmt + '"';
|
|
27
|
+
for (let key of Object.keys(config)) {
|
|
28
|
+
if (config[key] !== null) {
|
|
29
|
+
el += ' ' + key + '="' + config[key] + '"';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
el += '></div>';
|
|
33
|
+
return el;
|
|
34
|
+
}
|
|
35
|
+
%>
|
|
36
|
+
|
|
37
|
+
<svg class="loading" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2709"><path d="M832 512c0-176-144-320-320-320V128c211.2 0 384 172.8 384 384h-64zM192 512c0 176 144 320 320 320v64C300.8 896 128 723.2 128 512h64z" p-id="2710"></path></svg>
|
|
38
|
+
|
|
39
|
+
<%- layoutDiv() %>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
function loadJS() {
|
|
3
|
+
const els = document.querySelectorAll("#comments #giscus");
|
|
4
|
+
if (els.length === 0) return;
|
|
5
|
+
els.forEach((el, i) => {
|
|
6
|
+
try {
|
|
7
|
+
el.innerHTML = '';
|
|
8
|
+
} catch (error) {
|
|
9
|
+
console.log(error);
|
|
10
|
+
}
|
|
11
|
+
var script = document.createElement('script');
|
|
12
|
+
script.src = 'https://giscus.app/client.js';
|
|
13
|
+
script.async = true;
|
|
14
|
+
for (let key of Object.keys(el.attributes)) {
|
|
15
|
+
let attr = el.attributes[key];
|
|
16
|
+
if (['class', 'id'].includes(attr.name) === false) {
|
|
17
|
+
script.setAttribute(attr.name, attr.value);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
el.appendChild(script);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
window.addEventListener('DOMContentLoaded', (event) => {
|
|
24
|
+
loadJS();
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
@@ -9,7 +9,7 @@ if (theme.comments.service && theme.comments.service.length > 0) {
|
|
|
9
9
|
if (loadComment && page.layout == 'wiki' && page.wiki) {
|
|
10
10
|
let proj = theme.wiki.projects[page.wiki];
|
|
11
11
|
if (proj.comment_title != undefined && page.comment_title == undefined) {
|
|
12
|
-
if (['utterances', 'beaudar'].includes(theme.comments.service)) {
|
|
12
|
+
if (['utterances', 'beaudar', 'giscus'].includes(theme.comments.service)) {
|
|
13
13
|
page.comment_title = proj.comment_title;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -103,11 +103,13 @@
|
|
|
103
103
|
|
|
104
104
|
// required plugins (only load if needs)
|
|
105
105
|
stellar.plugins = {
|
|
106
|
-
jQuery: '<%- url_for(theme.plugins.jquery || "https://fastly.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js") %>'
|
|
107
|
-
sitesjs: '<%- url_for(theme.plugins.sitesjs) %>',
|
|
108
|
-
friendsjs: '<%- url_for(theme.plugins.friendsjs) %>',
|
|
106
|
+
jQuery: '<%- url_for(theme.plugins.jquery || "https://fastly.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js") %>'
|
|
109
107
|
};
|
|
110
108
|
|
|
109
|
+
// stellar js
|
|
110
|
+
stellar.plugins.stellar = Object.assign(<%- JSON.stringify(theme.plugins.stellar) %>);
|
|
111
|
+
|
|
112
|
+
stellar.plugins.marked = Object.assign(<%- JSON.stringify(theme.plugins.marked) %>);
|
|
111
113
|
// optional plugins
|
|
112
114
|
if ('<%- theme.plugins.lazyload.enable %>' == 'true') {
|
|
113
115
|
stellar.plugins.lazyload = Object.assign(<%- JSON.stringify(theme.plugins.lazyload) %>);
|
|
@@ -69,6 +69,8 @@ function layoutFooterDiv() {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
%>
|
|
72
|
-
|
|
72
|
+
<% if (page.header == undefined || page.header == 'left' || page.header == 'auto') { %>
|
|
73
|
+
<%- partial('header', {where: 'sidebar'}) %>
|
|
74
|
+
<% } %>
|
|
73
75
|
<%- layoutWidgets() %>
|
|
74
76
|
<%- layoutFooterDiv() %>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<%
|
|
2
|
+
var btns = [];
|
|
3
|
+
btns.push({
|
|
4
|
+
key: 'followers',
|
|
5
|
+
desc: 'followers',
|
|
6
|
+
href: '?tab=followers'
|
|
7
|
+
});
|
|
8
|
+
btns.push({
|
|
9
|
+
key: 'following',
|
|
10
|
+
desc: 'following',
|
|
11
|
+
href: '?tab=following'
|
|
12
|
+
});
|
|
13
|
+
btns.push({
|
|
14
|
+
key: 'public_repos',
|
|
15
|
+
desc: 'repos',
|
|
16
|
+
href: '?tab=repositories'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function layoutDiv() {
|
|
20
|
+
var el = '';
|
|
21
|
+
if (item.username == undefined || item.username.length == 0) {
|
|
22
|
+
return el;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
el += '<div class="widget-wrap" id="github-user">';
|
|
26
|
+
// header
|
|
27
|
+
if (item.header && item.header.length > 0) {
|
|
28
|
+
el += '<div class="widget-header cap dis-select">';
|
|
29
|
+
el += '<span class="name">' + item.header + '</span>';
|
|
30
|
+
el += '</div>';
|
|
31
|
+
}
|
|
32
|
+
// body
|
|
33
|
+
el += '<div class="widget-body stellar-ghinfo-api" api="' + item.api + '/users/' + item.username + '">';
|
|
34
|
+
if (item.avatar) {
|
|
35
|
+
el += '<div class="avatar" ><img no-lazy type="img" id="avatar_url" src="' + config.avatar + '"></div>';
|
|
36
|
+
}
|
|
37
|
+
// username
|
|
38
|
+
el += '<p class="username" type="text" id="name" href="https://github.com/' + item.username + '"> </p>';
|
|
39
|
+
el += '<p class="bio" type="text" id="bio"> </p>';
|
|
40
|
+
|
|
41
|
+
el += '<div class="buttons">';
|
|
42
|
+
btns.forEach((btn, i) => {
|
|
43
|
+
el += '<a class="btn" href="https://github.com/' + item.username + '' + btn.href + '">';
|
|
44
|
+
el += '<span class="title" type="text" id="' + btn.key + '">0</span>';
|
|
45
|
+
el += '<span class="desc">' + btn.desc + '</span>';
|
|
46
|
+
el += '</a>';
|
|
47
|
+
});
|
|
48
|
+
el += '</div>';
|
|
49
|
+
// follow
|
|
50
|
+
el += '<a class="follow" href="https://github.com/' + item.username + '">';
|
|
51
|
+
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>';
|
|
52
|
+
el += 'Follow';
|
|
53
|
+
el += '</a>';
|
|
54
|
+
el += '</div>';
|
|
55
|
+
el += '</div>';
|
|
56
|
+
return el;
|
|
57
|
+
}
|
|
58
|
+
%>
|
|
59
|
+
<%- layoutDiv() %>
|
|
@@ -26,7 +26,7 @@ function layoutDiv() {
|
|
|
26
26
|
el += '</div>';
|
|
27
27
|
// body
|
|
28
28
|
el += '<div class="widget-body fs14">';
|
|
29
|
-
el += '<div class="items">';
|
|
29
|
+
el += '<div class="items stellar-ghinfo-api" api="https://api.github.xaoxuu.com/repos/' + repo + '">';
|
|
30
30
|
var items = [];
|
|
31
31
|
// GitHub
|
|
32
32
|
items.push({
|
|
@@ -34,6 +34,20 @@ function layoutDiv() {
|
|
|
34
34
|
text: 'GitHub',
|
|
35
35
|
href: 'https://github.com/' + repo
|
|
36
36
|
});
|
|
37
|
+
// Stars
|
|
38
|
+
items.push({
|
|
39
|
+
icon: '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg>',
|
|
40
|
+
text: 'Stars',
|
|
41
|
+
apiKey: 'stargazers_count',
|
|
42
|
+
href: 'https://github.com/' + repo + '/stargazers'
|
|
43
|
+
});
|
|
44
|
+
// Forks
|
|
45
|
+
items.push({
|
|
46
|
+
icon: '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg>',
|
|
47
|
+
text: 'Forks',
|
|
48
|
+
apiKey: 'forks_count',
|
|
49
|
+
href: 'https://github.com/' + repo + '/network/members'
|
|
50
|
+
});
|
|
37
51
|
// Releases
|
|
38
52
|
items.push({
|
|
39
53
|
icon: '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"></path></svg>',
|
|
@@ -43,15 +57,9 @@ function layoutDiv() {
|
|
|
43
57
|
// Download
|
|
44
58
|
items.push({
|
|
45
59
|
icon: '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M7.47 10.78a.75.75 0 001.06 0l3.75-3.75a.75.75 0 00-1.06-1.06L8.75 8.44V1.75a.75.75 0 00-1.5 0v6.69L4.78 5.97a.75.75 0 00-1.06 1.06l3.75 3.75zM3.75 13a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5z"></path></svg>',
|
|
46
|
-
text: 'Download',
|
|
60
|
+
text: 'Download Zip',
|
|
47
61
|
href: 'https://github.com/' + repo + '/archive/refs/heads/' + branch + '.zip'
|
|
48
62
|
});
|
|
49
|
-
// Issues
|
|
50
|
-
items.push({
|
|
51
|
-
icon: '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M8 9.5a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"></path><path fill-rule="evenodd" d="M8 0a8 8 0 100 16A8 8 0 008 0zM1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0z"></path></svg>',
|
|
52
|
-
text: 'Issues',
|
|
53
|
-
href: 'https://github.com/' + repo + '/issues'
|
|
54
|
-
});
|
|
55
63
|
items.forEach((item, i) => {
|
|
56
64
|
el += '<div class="line"></div>';
|
|
57
65
|
el += '<a class="item-link"';
|
|
@@ -59,8 +67,19 @@ function layoutDiv() {
|
|
|
59
67
|
el += ' href="' + url_for(item.href) + '"';
|
|
60
68
|
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
|
61
69
|
el += '>';
|
|
62
|
-
|
|
70
|
+
// left
|
|
71
|
+
el += '<div class="left">';
|
|
63
72
|
el += '<span>' + item.text + '</span>';
|
|
73
|
+
el += '</div>';
|
|
74
|
+
// right
|
|
75
|
+
el += '<div class="right">';
|
|
76
|
+
if (item.apiKey) {
|
|
77
|
+
el += '<span type="text" id="' + item.apiKey + '"></span>';
|
|
78
|
+
}
|
|
79
|
+
if (item.icon) {
|
|
80
|
+
el += item.icon;
|
|
81
|
+
}
|
|
82
|
+
el += '</div>';
|
|
64
83
|
el += '</a>';
|
|
65
84
|
});
|
|
66
85
|
el += '</div>';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<% if (theme.plugins.mathjax.enable){ %>
|
|
2
|
+
<script type="text/x-mathjax-config">
|
|
3
|
+
MathJax.Hub.Config({
|
|
4
|
+
tex2jax: {
|
|
5
|
+
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
|
6
|
+
processEscapes: true
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script type="text/x-mathjax-config">
|
|
12
|
+
MathJax.Hub.Config({
|
|
13
|
+
tex2jax: {
|
|
14
|
+
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script type="text/x-mathjax-config">
|
|
20
|
+
MathJax.Hub.Queue(function() {
|
|
21
|
+
var all = MathJax.Hub.getAllJax(), i;
|
|
22
|
+
for(i=0; i < all.length; i += 1) {
|
|
23
|
+
all[i].SourceElement().parentNode.className += ' has-jax';
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<script type="text/javascript" src="<%- theme.plugins.mathjax.cdn %>"></script>
|
|
29
|
+
<% } %>
|
package/layout/page.ejs
CHANGED
|
@@ -10,7 +10,7 @@ function layoutTitle() {
|
|
|
10
10
|
%>
|
|
11
11
|
<% if (page.h1 || page.title || (page.content && page.content.length > 0)) { %>
|
|
12
12
|
<%- partial('_partial/main/navbar/breadcrumb') %>
|
|
13
|
-
<article class='content md <%- page.layout %><%- scrollreveal() %>'>
|
|
13
|
+
<article class='content md <%- page.layout %><%- page.indent ? ' indent' : '' %><%- scrollreveal() %>'>
|
|
14
14
|
<%- layoutTitle() %>
|
|
15
15
|
<% if (page.content && page.content.length > 0) { %>
|
|
16
16
|
<%- page.content %>
|