hexo-theme-stellar 1.16.2 → 1.17.1
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 +13 -5
- package/_data/widgets.yml +4 -1
- package/languages/en.yml +5 -0
- package/languages/zh-CN.yml +5 -0
- package/languages/zh-TW.yml +5 -0
- package/layout/404.ejs +1 -1
- package/layout/_partial/cover/wiki_cover.ejs +1 -1
- package/layout/_partial/main/article/article_footer.ejs +2 -2
- package/layout/_partial/main/post_list/paginator.ejs +5 -9
- package/layout/_partial/main/post_list/post_card.ejs +1 -1
- package/layout/_partial/main/post_list/wiki_card.ejs +1 -1
- package/layout/_partial/plugins/comments/layout.ejs +1 -1
- package/layout/_partial/scripts/index.ejs +9 -0
- package/layout/_partial/sidebar/index.ejs +3 -3
- package/layout/_partial/{sidebar/widgets → widgets}/ghissues.ejs +2 -2
- package/layout/_partial/{sidebar/widgets → widgets}/ghrepo.ejs +2 -2
- package/layout/_partial/{sidebar/widgets → widgets}/ghuser.ejs +3 -3
- package/layout/_partial/{sidebar/widgets → widgets}/markdown.ejs +2 -2
- package/layout/_partial/{sidebar/widgets → widgets}/recent.ejs +5 -6
- package/layout/_partial/{sidebar/widgets → widgets}/related.ejs +2 -2
- package/layout/_partial/widgets/search.ejs +31 -0
- package/layout/_partial/{sidebar/widgets → widgets}/tagcloud.ejs +2 -2
- package/layout/_partial/{sidebar/widgets → widgets}/timeline.ejs +2 -2
- package/layout/_partial/{sidebar/widgets → widgets}/toc.ejs +2 -2
- package/layout/page.ejs +1 -1
- package/layout/post.ejs +1 -1
- package/layout/wiki.ejs +1 -1
- package/package.json +1 -1
- package/scripts/generators/search.js +103 -0
- package/source/css/_common/base.styl +1 -1
- package/source/css/_common/highlight.styl +5 -5
- package/source/css/_common/span.styl +1 -0
- package/source/css/_layout/index.styl +1 -0
- package/source/css/_layout/list.styl +1 -1
- package/source/css/_layout/md.styl +12 -13
- package/source/css/_layout/pages/error.styl +2 -2
- package/source/css/_layout/partial/article-footer.styl +4 -4
- package/source/css/_layout/partial/paginator.styl +16 -5
- package/source/css/_layout/partial/related.styl +6 -14
- package/source/css/_layout/sidebar/footer.styl +1 -3
- package/source/css/_layout/sidebar/header.styl +112 -0
- package/source/css/_layout/sidebar/sidebar.styl +3 -115
- package/source/css/_layout/tag-plugins/about.styl +1 -1
- package/source/css/_layout/tag-plugins/checkbox.styl +1 -1
- package/source/css/_layout/tag-plugins/copy.styl +1 -1
- package/source/css/_layout/tag-plugins/emoji.styl +1 -1
- package/source/css/_layout/tag-plugins/frame.styl +5 -5
- package/source/css/_layout/tag-plugins/inline-labels.styl +1 -1
- package/source/css/_layout/tag-plugins/link.styl +6 -6
- package/source/css/_layout/tag-plugins/mark.styl +3 -4
- package/source/css/_layout/tag-plugins/navbar.styl +1 -1
- package/source/css/_layout/tag-plugins/note.styl +7 -7
- package/source/css/_layout/tag-plugins/poetry.styl +2 -2
- package/source/css/_layout/tag-plugins/quot.styl +7 -7
- package/source/css/_layout/tag-plugins/tabs.styl +1 -1
- package/source/css/_layout/tag-plugins/timeline.styl +3 -3
- package/source/css/_layout/widgets/ghrepo.styl +34 -0
- package/source/css/_layout/widgets/ghuser.styl +95 -0
- package/source/css/_layout/widgets/recent.styl +15 -0
- package/source/css/_layout/widgets/related.styl +8 -0
- package/source/css/_layout/widgets/search.styl +3 -0
- package/source/css/_layout/widgets/tagcloud.styl +8 -0
- package/source/css/_layout/widgets/timeline.styl +17 -0
- package/source/css/_layout/{sidebar → widgets}/toc_blog.styl +1 -1
- package/source/css/_layout/{sidebar → widgets}/toc_common.styl +7 -4
- package/source/css/_layout/{sidebar → widgets}/toc_wiki.styl +3 -7
- package/source/css/_layout/widgets/widgets.styl +60 -0
- package/source/css/_plugins/index.styl +4 -0
- package/source/css/_plugins/search/local-search.styl +89 -0
- package/source/js/main.js +42 -6
- package/source/js/search/local-search.js +153 -0
- package/source/css/_layout/sidebar/ghrepo.styl +0 -36
- package/source/css/_layout/sidebar/ghuser.styl +0 -98
- package/source/css/_layout/sidebar/widgets.styl +0 -106
package/_config.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
######## Stellar info ########
|
|
2
2
|
stellar:
|
|
3
|
-
version: '1.
|
|
3
|
+
version: '1.17.1'
|
|
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,10 +25,10 @@ sidebar:
|
|
|
25
25
|
# about: '[关于](/about/)'
|
|
26
26
|
# Sidebar widgets
|
|
27
27
|
widgets:
|
|
28
|
-
index: welcome, recent, timeline # for home/wiki/categories/tags/archives/404 pages
|
|
28
|
+
index: welcome, recent, search, timeline # for home/wiki/categories/tags/archives/404 pages
|
|
29
29
|
page: welcome, toc # for pages using 'layout:page'
|
|
30
|
-
post: toc, ghrepo, ghissues # for pages using 'layout:post'
|
|
31
|
-
wiki: ghrepo, toc, ghissues, related # for pages using 'layout:wiki'
|
|
30
|
+
post: toc, ghrepo, search, ghissues # for pages using 'layout:post'
|
|
31
|
+
wiki: search, ghrepo, toc, ghissues, related # for pages using 'layout:wiki'
|
|
32
32
|
|
|
33
33
|
######## Index ########
|
|
34
34
|
post-index: # 近期发布 分类 标签 归档 and ...
|
|
@@ -51,7 +51,7 @@ article:
|
|
|
51
51
|
category_color:
|
|
52
52
|
'探索号': '#f44336'
|
|
53
53
|
# 文章许可协议
|
|
54
|
-
license: '本文采用[署名-非商业性使用-相同方式共享 4.0 国际](https://creativecommons.org/licenses/by-nc-sa/4.0/)许可协议,转载请注明出处。'
|
|
54
|
+
license: '本文采用 [署名-非商业性使用-相同方式共享 4.0 国际](https://creativecommons.org/licenses/by-nc-sa/4.0/) 许可协议,转载请注明出处。'
|
|
55
55
|
# 分享
|
|
56
56
|
share: # [wechat, weibo, email, link]
|
|
57
57
|
# 相关文章,需要安装插件 (for layout: post)
|
|
@@ -61,6 +61,14 @@ article:
|
|
|
61
61
|
max_count: 5
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
search:
|
|
65
|
+
service: local_search # local_search, todo...
|
|
66
|
+
local_search:
|
|
67
|
+
field: all # post, page, all
|
|
68
|
+
path: /search.json
|
|
69
|
+
content: true
|
|
70
|
+
|
|
71
|
+
|
|
64
72
|
######## Comments ########
|
|
65
73
|
comments:
|
|
66
74
|
service: # beaudar, utterances, twikoo, waline
|
package/_data/widgets.yml
CHANGED
package/languages/en.yml
CHANGED
package/languages/zh-CN.yml
CHANGED
package/languages/zh-TW.yml
CHANGED
package/layout/404.ejs
CHANGED
|
@@ -5,7 +5,7 @@ page.comment_title = '';
|
|
|
5
5
|
page.header = 'auto';
|
|
6
6
|
page.robots = 'none';
|
|
7
7
|
%>
|
|
8
|
-
<article class='md error-page'>
|
|
8
|
+
<article class='md-text error-page'>
|
|
9
9
|
<h1><img id='error' src='https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/404/1c830bfcd517d.svg' alt='404'></h1>
|
|
10
10
|
<p class='what'>
|
|
11
11
|
<strong>
|
|
@@ -19,7 +19,7 @@ function layoutWikiCover() {
|
|
|
19
19
|
cover = ['logo', 'title', 'description'];
|
|
20
20
|
}
|
|
21
21
|
el += '<div class="l_cover wiki' + scrollreveal() + '">';
|
|
22
|
-
el += '<article class="cover-wrap md">';
|
|
22
|
+
el += '<article class="cover-wrap md-text">';
|
|
23
23
|
|
|
24
24
|
if (logo && logo.src && cover.includes('logo')) {
|
|
25
25
|
el += '<div class="preview">';
|
|
@@ -70,9 +70,9 @@ function layoutDiv() {
|
|
|
70
70
|
} else if (item == 'weibo') {
|
|
71
71
|
el += ' href="https://service.weibo.com/share/share.php?url=' + page.permalink;
|
|
72
72
|
el += '&title=' + (page.seo_title || (page.title + ' - ' + config.title));
|
|
73
|
-
if (page.
|
|
73
|
+
if (page.layout == 'post' && page.cover) {
|
|
74
74
|
el += '&pics=' + page.cover;
|
|
75
|
-
} else if (page.
|
|
75
|
+
} else if (page.layout == 'wiki' && page.logo && page.logo.src) {
|
|
76
76
|
el += '&pics=' + page.logo.src;
|
|
77
77
|
}
|
|
78
78
|
el += '&summary=' + truncate(page.description || strip_html(page.excerpt || page.content), {length: 120});
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
<% if (is_home() && page.total > 1) { %>
|
|
2
2
|
<div class='paginator-wrap dis-select'>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</div>
|
|
9
|
-
<a class='paginator next<%- page.next != 0 ? "" : " disable" %>' href='<%- url_for(page.next_link) %>'>
|
|
10
|
-
<img src='https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/arrow/064b95430caf4.svg'/>
|
|
11
|
-
</a>
|
|
3
|
+
<%- paginator({
|
|
4
|
+
prev_text: '',
|
|
5
|
+
next_text: '',
|
|
6
|
+
force_prev_next:true
|
|
7
|
+
}) %>
|
|
12
8
|
</div>
|
|
13
9
|
<% } %>
|
|
@@ -31,7 +31,7 @@ if (cmt.service && page[cmt.service]) {
|
|
|
31
31
|
page.cmt = cmt;
|
|
32
32
|
%>
|
|
33
33
|
<% if (loadComment) { %>
|
|
34
|
-
<div class='related-wrap md reveal' id="comments">
|
|
34
|
+
<div class='related-wrap md-text reveal' id="comments">
|
|
35
35
|
<div class='cmt-title cap theme'>
|
|
36
36
|
<%- page.comment_title != undefined ? markdown(page.comment_title) : __('meta.comment_title') %>
|
|
37
37
|
</div>
|
|
@@ -107,6 +107,15 @@
|
|
|
107
107
|
jQuery: '<%- url_for(theme.plugins.jquery || "https://fastly.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js") %>'
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
+
if ('<%- theme.search.service %>') {
|
|
111
|
+
stellar.search = {};
|
|
112
|
+
stellar.search.service = '<%- theme.search.service %>';
|
|
113
|
+
if (stellar.search.service == 'local_search') {
|
|
114
|
+
let service_obj = Object.assign({}, <%- JSON.stringify(theme.search.local_search) %>);
|
|
115
|
+
stellar.search[stellar.search.service] = service_obj;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
110
119
|
// stellar js
|
|
111
120
|
stellar.plugins.stellar = Object.assign(<%- JSON.stringify(theme.plugins.stellar) %>);
|
|
112
121
|
|
|
@@ -47,7 +47,7 @@ function layoutWidgets() {
|
|
|
47
47
|
var el = '';
|
|
48
48
|
el += '<div class="widgets">';
|
|
49
49
|
if (page.layout == 'wiki' && proj && page.menu_id == 'wiki') {
|
|
50
|
-
el += '<
|
|
50
|
+
el += '<widget class="widget-wrapper logo-wrap wiki"><div class="widget-body">';
|
|
51
51
|
// all products
|
|
52
52
|
el += '<a style="filter: grayscale(100%)" class="wiki-home cap" href="' + url_for(config.wiki_dir) + '">';
|
|
53
53
|
el += '<svg aria-hidden="true" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor"><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></svg>';
|
|
@@ -69,7 +69,7 @@ function layoutWidgets() {
|
|
|
69
69
|
let sub = proj.subtitle;
|
|
70
70
|
el += layoutTitle(main, url, sub);
|
|
71
71
|
}
|
|
72
|
-
el += '</div></
|
|
72
|
+
el += '</div></widget>';
|
|
73
73
|
}
|
|
74
74
|
if (page.sidebar) {
|
|
75
75
|
page.sidebar.forEach((w, i) => {
|
|
@@ -87,7 +87,7 @@ function layoutWidgets() {
|
|
|
87
87
|
Object.assign(widget, w)
|
|
88
88
|
}
|
|
89
89
|
if (widget && widget.layout) {
|
|
90
|
-
el += partial('widgets/' + widget.layout, {item: widget})
|
|
90
|
+
el += partial('../widgets/' + widget.layout, {item: widget})
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -21,7 +21,7 @@ function layoutDiv() {
|
|
|
21
21
|
if (item.labels) {
|
|
22
22
|
item.api += '&labels=' + item.labels;
|
|
23
23
|
}
|
|
24
|
-
el += '<
|
|
24
|
+
el += '<widget class="widget-wrapper timeline">';
|
|
25
25
|
if (item.title) {
|
|
26
26
|
el += '<div class="widget-header cap theme dis-select">';
|
|
27
27
|
el += '<span class="name">' + item.title + '</span>';
|
|
@@ -37,7 +37,7 @@ function layoutDiv() {
|
|
|
37
37
|
el += '>';
|
|
38
38
|
el += '</div>';
|
|
39
39
|
el += '</div>';
|
|
40
|
-
el += '</
|
|
40
|
+
el += '</widget>';
|
|
41
41
|
return el;
|
|
42
42
|
}
|
|
43
43
|
%>
|
|
@@ -18,7 +18,7 @@ function layoutDiv() {
|
|
|
18
18
|
return el;
|
|
19
19
|
}
|
|
20
20
|
// 布局
|
|
21
|
-
el += '<
|
|
21
|
+
el += '<widget class="widget-wrapper ghrepo">';
|
|
22
22
|
// body
|
|
23
23
|
el += '<div class="widget-body">';
|
|
24
24
|
el += '<div class="items stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/repos/' + repo + '">';
|
|
@@ -45,7 +45,7 @@ function layoutDiv() {
|
|
|
45
45
|
el += '</a>';
|
|
46
46
|
el += '</div>';
|
|
47
47
|
el += '</div>';
|
|
48
|
-
el += '</
|
|
48
|
+
el += '</widget>';
|
|
49
49
|
return el;
|
|
50
50
|
}
|
|
51
51
|
%>
|
|
@@ -22,7 +22,7 @@ function layoutDiv() {
|
|
|
22
22
|
return el;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
el += '<
|
|
25
|
+
el += '<widget class="widget-wrapper ghuser">';
|
|
26
26
|
// body
|
|
27
27
|
el += '<div class="widget-body stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/users/' + item.username + '">';
|
|
28
28
|
if (item.avatar) {
|
|
@@ -47,10 +47,10 @@ function layoutDiv() {
|
|
|
47
47
|
el += '</a>';
|
|
48
48
|
// menu
|
|
49
49
|
if (item.menu) {
|
|
50
|
-
el += partial('../menu', {where: 'sidebar'});
|
|
50
|
+
el += partial('../sidebar/menu', {where: 'sidebar'});
|
|
51
51
|
}
|
|
52
52
|
el += '</div>';
|
|
53
|
-
el += '</
|
|
53
|
+
el += '</widget>';
|
|
54
54
|
return el;
|
|
55
55
|
}
|
|
56
56
|
%>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
function layoutDiv() {
|
|
3
3
|
if (!item.content?.length) return ''
|
|
4
4
|
var el = '';
|
|
5
|
-
el += '<
|
|
5
|
+
el += '<widget class="widget-wrapper markdown">';
|
|
6
6
|
if (item.title?.length > 0) {
|
|
7
7
|
el += '<div class="widget-header cap theme dis-select">';
|
|
8
8
|
el += '<span class="name">' + item.title + '</span>';
|
|
@@ -11,7 +11,7 @@ function layoutDiv() {
|
|
|
11
11
|
el += '<div class="widget-body fs14">';
|
|
12
12
|
el += markdown(item.content);
|
|
13
13
|
el += '</div>';
|
|
14
|
-
el += '</
|
|
14
|
+
el += '</widget>';
|
|
15
15
|
return el;
|
|
16
16
|
}
|
|
17
17
|
%>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%
|
|
2
2
|
function layoutDiv() {
|
|
3
|
-
var el = '<
|
|
3
|
+
var el = '<widget class="widget-wrapper recent">';
|
|
4
4
|
// header
|
|
5
5
|
el += '<div class="widget-header cap theme dis-select">';
|
|
6
6
|
el += '<span class="name">' + __("meta.recent_update") + '</span>';
|
|
@@ -33,10 +33,9 @@ function layoutDiv() {
|
|
|
33
33
|
el += '<span class="title">'
|
|
34
34
|
if (post.layout == 'wiki') {
|
|
35
35
|
let proj = theme.wiki.projects[post.wiki];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
el += post.wiki + ' / ';
|
|
36
|
+
let name = proj?.name || post?.wiki;
|
|
37
|
+
if (name) {
|
|
38
|
+
el += '<strong>' + name + '</strong>' + '<span class="dot"></span>';
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
el += (post.title || post.seo_title || post.wiki) + '</span>';
|
|
@@ -44,7 +43,7 @@ function layoutDiv() {
|
|
|
44
43
|
el += '';
|
|
45
44
|
});
|
|
46
45
|
el += '</div>';
|
|
47
|
-
el += '</
|
|
46
|
+
el += '</widget>';
|
|
48
47
|
return el;
|
|
49
48
|
}
|
|
50
49
|
%>
|
|
@@ -15,7 +15,7 @@ function layoutDiv() {
|
|
|
15
15
|
}
|
|
16
16
|
var el = '';
|
|
17
17
|
if (related.length > 0) {
|
|
18
|
-
el += '<
|
|
18
|
+
el += '<widget class="widget-wrapper related">';
|
|
19
19
|
el += '<div class="widget-header cap theme dis-select">';
|
|
20
20
|
var title = __('btn.wiki');
|
|
21
21
|
if (proj.tags && proj.tags[0]) {
|
|
@@ -34,7 +34,7 @@ function layoutDiv() {
|
|
|
34
34
|
el += '</a>';
|
|
35
35
|
});
|
|
36
36
|
el += '</div>';
|
|
37
|
-
el += '</
|
|
37
|
+
el += '</widget>';
|
|
38
38
|
}
|
|
39
39
|
return el;
|
|
40
40
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<%
|
|
2
|
+
function layoutDiv() {
|
|
3
|
+
var el = '<widget class="widget-wrapper search">'
|
|
4
|
+
el += '<div class="widget-body">'
|
|
5
|
+
el += '<div class="search-wrapper" id="search">'
|
|
6
|
+
el += '<form class="search-form">'
|
|
7
|
+
var filter = ''
|
|
8
|
+
if (item.filter == 'auto' && page.layout == 'wiki') {
|
|
9
|
+
let matches = page.path.match(/(.*?)\/(.*?)\//i)
|
|
10
|
+
if (matches?.length > 0) {
|
|
11
|
+
filter = matches[0]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
el += '<input type="text" class="search-input" id="search-input"'
|
|
15
|
+
if (filter.length > 0) {
|
|
16
|
+
filter = '/' + filter
|
|
17
|
+
el += ' data-filter="' + filter + '"'
|
|
18
|
+
el += ' placeholder="' + (item.placeholder || __('search.search_in', filter)) + '">'
|
|
19
|
+
} else {
|
|
20
|
+
el += ' placeholder="' + (item.placeholder || __('search.search')) + '">'
|
|
21
|
+
}
|
|
22
|
+
el += '</form>'
|
|
23
|
+
el += '<div id="search-result"></div>'
|
|
24
|
+
el += '<div class="search-no-result">' + __('search.no_results') + '</div>'
|
|
25
|
+
el += '</div>'
|
|
26
|
+
el += '</div>'
|
|
27
|
+
el += '</widget>'
|
|
28
|
+
return el
|
|
29
|
+
}
|
|
30
|
+
%>
|
|
31
|
+
<%- layoutDiv() %>
|
|
@@ -8,7 +8,7 @@ function layoutDiv() {
|
|
|
8
8
|
delete opts['title'];
|
|
9
9
|
delete opts['layout'];
|
|
10
10
|
opts.class = 'tag ';
|
|
11
|
-
el += '<
|
|
11
|
+
el += '<widget class="widget-wrapper tagcloud">';
|
|
12
12
|
if (item.title) {
|
|
13
13
|
el += '<div class="widget-header cap theme dis-select">';
|
|
14
14
|
el += '<span class="name">' + item.title + '</span>';
|
|
@@ -17,7 +17,7 @@ function layoutDiv() {
|
|
|
17
17
|
el += '<div class="widget-body fs14">';
|
|
18
18
|
el += tagcloud(site.tags, opts);
|
|
19
19
|
el += '</div>';
|
|
20
|
-
el += '</
|
|
20
|
+
el += '</widget>';
|
|
21
21
|
return el;
|
|
22
22
|
}
|
|
23
23
|
%>
|
|
@@ -4,7 +4,7 @@ function layoutDiv() {
|
|
|
4
4
|
if (item.api == undefined) {
|
|
5
5
|
return el;
|
|
6
6
|
}
|
|
7
|
-
el += '<
|
|
7
|
+
el += '<widget class="widget-wrapper timeline">';
|
|
8
8
|
if (item.title) {
|
|
9
9
|
el += '<div class="widget-header cap theme dis-select">';
|
|
10
10
|
el += '<span class="name">' + item.title + '</span>';
|
|
@@ -20,7 +20,7 @@ function layoutDiv() {
|
|
|
20
20
|
el += '>';
|
|
21
21
|
el += '</div>';
|
|
22
22
|
el += '</div>';
|
|
23
|
-
el += '</
|
|
23
|
+
el += '</widget>';
|
|
24
24
|
return el;
|
|
25
25
|
}
|
|
26
26
|
%>
|
|
@@ -63,7 +63,7 @@ function layoutDiv(fallback) {
|
|
|
63
63
|
|
|
64
64
|
var el = '';
|
|
65
65
|
if (type.length > 0) {
|
|
66
|
-
el += '<
|
|
66
|
+
el += '<widget class="widget-wrapper toc ' + type + '" id="toc">';
|
|
67
67
|
if (page.layout !== 'wiki') {
|
|
68
68
|
// post 布局
|
|
69
69
|
el += layoutTocHeader(page.toc_title);
|
|
@@ -90,7 +90,7 @@ function layoutDiv(fallback) {
|
|
|
90
90
|
el += '</div>';
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
el += '</
|
|
93
|
+
el += '</widget>';
|
|
94
94
|
} else if (item.fallback) {
|
|
95
95
|
el += partial(item.fallback, {item: theme.data.widgets[item.fallback]});
|
|
96
96
|
}
|
package/layout/page.ejs
CHANGED
|
@@ -15,7 +15,7 @@ function layoutDiv() {
|
|
|
15
15
|
if (page.h1 || page.title || (page.content && page.content.length > 0)) {
|
|
16
16
|
el += partial('_partial/main/navbar/breadcrumb');
|
|
17
17
|
}
|
|
18
|
-
el += '<article class="content
|
|
18
|
+
el += '<article class="md-text content ' + page.layout + (page.indent ? ' indent' : '') + scrollreveal() + '">';
|
|
19
19
|
el += layoutTitle();
|
|
20
20
|
if (page.content && page.content.length > 0) {
|
|
21
21
|
el += page.content;
|
package/layout/post.ejs
CHANGED
|
@@ -23,7 +23,7 @@ if (theme.plugins.heti && theme.plugins.heti.enable) {
|
|
|
23
23
|
<%- partial('mathjax') %>
|
|
24
24
|
<% } %>
|
|
25
25
|
<%- partial('_partial/main/navbar/breadcrumb') %>
|
|
26
|
-
<article class='content<%- heti %>
|
|
26
|
+
<article class='md-text content<%- heti %> <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
|
|
27
27
|
<%- layoutTitle() %>
|
|
28
28
|
<%- post.content %>
|
|
29
29
|
<%- partial('_partial/main/article/article_footer') %>
|
package/layout/wiki.ejs
CHANGED
|
@@ -30,7 +30,7 @@ function layoutTitle() {
|
|
|
30
30
|
}
|
|
31
31
|
%>
|
|
32
32
|
<%- partial('_partial/main/navbar/breadcrumb') %>
|
|
33
|
-
<article class='content
|
|
33
|
+
<article class='md-text content <%- page.layout %><%- scrollreveal() %>'>
|
|
34
34
|
<%- layoutTitle() %>
|
|
35
35
|
<%- page.content %>
|
|
36
36
|
<%- partial('_partial/main/article/article_footer') %>
|
package/package.json
CHANGED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://github.com/wzpan/hexo-generator-search
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
hexo.extend.generator.register('search_json_generator', function (locals) {
|
|
6
|
+
if (this.theme.config.search.service != 'local_search') {
|
|
7
|
+
return {}
|
|
8
|
+
}
|
|
9
|
+
var config = this.config
|
|
10
|
+
const { local_search } = this.theme.config.search
|
|
11
|
+
|
|
12
|
+
var searchfield = local_search.field
|
|
13
|
+
var content = local_search.content
|
|
14
|
+
|
|
15
|
+
var posts, pages
|
|
16
|
+
|
|
17
|
+
if (searchfield.trim() != '') {
|
|
18
|
+
searchfield = searchfield.trim()
|
|
19
|
+
if (searchfield == 'post'){
|
|
20
|
+
posts = locals.posts.sort('-date')
|
|
21
|
+
} else if (searchfield == 'page') {
|
|
22
|
+
pages = locals.pages
|
|
23
|
+
} else {
|
|
24
|
+
posts = locals.posts.sort('-date')
|
|
25
|
+
pages = locals.pages
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
posts = locals.posts.sort('-date')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var res = new Array()
|
|
32
|
+
var index = 0
|
|
33
|
+
|
|
34
|
+
if (posts) {
|
|
35
|
+
posts.each(function(post) {
|
|
36
|
+
if (post.indexing != undefined && !post.indexing) return
|
|
37
|
+
var temp_post = new Object()
|
|
38
|
+
if (post.title) {
|
|
39
|
+
temp_post.title = post.title
|
|
40
|
+
}
|
|
41
|
+
if (post.path) {
|
|
42
|
+
temp_post.url = config.root + post.path
|
|
43
|
+
}
|
|
44
|
+
if (content != false && post._content) {
|
|
45
|
+
temp_post.content = post._content
|
|
46
|
+
}
|
|
47
|
+
if (post.tags && post.tags.length > 0) {
|
|
48
|
+
var tags = []
|
|
49
|
+
post.tags.forEach(function (tag) {
|
|
50
|
+
tags.push(tag.name)
|
|
51
|
+
})
|
|
52
|
+
temp_post.tags = tags
|
|
53
|
+
}
|
|
54
|
+
if (post.categories && post.categories.length > 0) {
|
|
55
|
+
var categories = []
|
|
56
|
+
post.categories.forEach(function (cate) {
|
|
57
|
+
categories.push(cate.name)
|
|
58
|
+
})
|
|
59
|
+
temp_post.categories = categories
|
|
60
|
+
}
|
|
61
|
+
res[index] = temp_post
|
|
62
|
+
index += 1
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
if (pages) {
|
|
66
|
+
pages.each(function(page) {
|
|
67
|
+
if (page.indexing != undefined && !page.indexing) return
|
|
68
|
+
var temp_page = new Object()
|
|
69
|
+
if (page.title) {
|
|
70
|
+
temp_page.title = page.title
|
|
71
|
+
}
|
|
72
|
+
if (page.path) {
|
|
73
|
+
temp_page.url = config.root + page.path
|
|
74
|
+
}
|
|
75
|
+
if (content != false && page._content) {
|
|
76
|
+
temp_page.content = page._content
|
|
77
|
+
}
|
|
78
|
+
if (page.tags && page.tags.length > 0) {
|
|
79
|
+
var tags = new Array()
|
|
80
|
+
var tag_index = 0
|
|
81
|
+
page.tags.each(function (tag) {
|
|
82
|
+
tags[tag_index] = tag.name
|
|
83
|
+
})
|
|
84
|
+
temp_page.tags = tags
|
|
85
|
+
}
|
|
86
|
+
if (page.categories && page.categories.length > 0) {
|
|
87
|
+
temp_page.categories = []
|
|
88
|
+
(page.categories.each || page.categories.forEach)(function (item) {
|
|
89
|
+
temp_page.categories.push(item)
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
res[index] = temp_page
|
|
93
|
+
index += 1
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var json = JSON.stringify(res)
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
path: local_search.path,
|
|
101
|
+
data: json
|
|
102
|
+
}
|
|
103
|
+
})
|
|
@@ -10,7 +10,7 @@ p>code:not([class]),li>code:not([class])
|
|
|
10
10
|
border-radius: 4px
|
|
11
11
|
color: var(--text-code)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
.md-text .highlight, pre:not([class]):has(>code)
|
|
14
14
|
margin: var(--gap-p) 0
|
|
15
15
|
border-radius: $border-block
|
|
16
16
|
overflow: hidden
|
|
@@ -22,7 +22,7 @@ article.md .highlight, pre:not([class]):has(>code)
|
|
|
22
22
|
@media screen and (min-width: $device-mobile)
|
|
23
23
|
min-width: 180px
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
.md-text .highlight
|
|
26
26
|
position: relative
|
|
27
27
|
overflow: auto
|
|
28
28
|
display: block
|
|
@@ -75,7 +75,7 @@ article.md .highlight
|
|
|
75
75
|
.gutter+.code pre
|
|
76
76
|
padding-left: 0.25em
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
.md-text .gist
|
|
79
79
|
.gist-file
|
|
80
80
|
border: 1px solid var(--block-border)
|
|
81
81
|
border-radius: $border-block
|
|
@@ -96,7 +96,7 @@ table:not([class])
|
|
|
96
96
|
border-collapse: collapse
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
.md-text pre
|
|
100
100
|
>.caption
|
|
101
101
|
color: var(--text-p3)
|
|
102
102
|
>.hljs
|
|
@@ -106,7 +106,7 @@ article.md pre
|
|
|
106
106
|
line-height: 1.5
|
|
107
107
|
box-sizing: border-box
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
.md-text .highlight
|
|
110
110
|
.code
|
|
111
111
|
vertical-align: top
|
|
112
112
|
&:before
|