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.
Files changed (74) hide show
  1. package/_config.yml +13 -5
  2. package/_data/widgets.yml +4 -1
  3. package/languages/en.yml +5 -0
  4. package/languages/zh-CN.yml +5 -0
  5. package/languages/zh-TW.yml +5 -0
  6. package/layout/404.ejs +1 -1
  7. package/layout/_partial/cover/wiki_cover.ejs +1 -1
  8. package/layout/_partial/main/article/article_footer.ejs +2 -2
  9. package/layout/_partial/main/post_list/paginator.ejs +5 -9
  10. package/layout/_partial/main/post_list/post_card.ejs +1 -1
  11. package/layout/_partial/main/post_list/wiki_card.ejs +1 -1
  12. package/layout/_partial/plugins/comments/layout.ejs +1 -1
  13. package/layout/_partial/scripts/index.ejs +9 -0
  14. package/layout/_partial/sidebar/index.ejs +3 -3
  15. package/layout/_partial/{sidebar/widgets → widgets}/ghissues.ejs +2 -2
  16. package/layout/_partial/{sidebar/widgets → widgets}/ghrepo.ejs +2 -2
  17. package/layout/_partial/{sidebar/widgets → widgets}/ghuser.ejs +3 -3
  18. package/layout/_partial/{sidebar/widgets → widgets}/markdown.ejs +2 -2
  19. package/layout/_partial/{sidebar/widgets → widgets}/recent.ejs +5 -6
  20. package/layout/_partial/{sidebar/widgets → widgets}/related.ejs +2 -2
  21. package/layout/_partial/widgets/search.ejs +31 -0
  22. package/layout/_partial/{sidebar/widgets → widgets}/tagcloud.ejs +2 -2
  23. package/layout/_partial/{sidebar/widgets → widgets}/timeline.ejs +2 -2
  24. package/layout/_partial/{sidebar/widgets → widgets}/toc.ejs +2 -2
  25. package/layout/page.ejs +1 -1
  26. package/layout/post.ejs +1 -1
  27. package/layout/wiki.ejs +1 -1
  28. package/package.json +1 -1
  29. package/scripts/generators/search.js +103 -0
  30. package/source/css/_common/base.styl +1 -1
  31. package/source/css/_common/highlight.styl +5 -5
  32. package/source/css/_common/span.styl +1 -0
  33. package/source/css/_layout/index.styl +1 -0
  34. package/source/css/_layout/list.styl +1 -1
  35. package/source/css/_layout/md.styl +12 -13
  36. package/source/css/_layout/pages/error.styl +2 -2
  37. package/source/css/_layout/partial/article-footer.styl +4 -4
  38. package/source/css/_layout/partial/paginator.styl +16 -5
  39. package/source/css/_layout/partial/related.styl +6 -14
  40. package/source/css/_layout/sidebar/footer.styl +1 -3
  41. package/source/css/_layout/sidebar/header.styl +112 -0
  42. package/source/css/_layout/sidebar/sidebar.styl +3 -115
  43. package/source/css/_layout/tag-plugins/about.styl +1 -1
  44. package/source/css/_layout/tag-plugins/checkbox.styl +1 -1
  45. package/source/css/_layout/tag-plugins/copy.styl +1 -1
  46. package/source/css/_layout/tag-plugins/emoji.styl +1 -1
  47. package/source/css/_layout/tag-plugins/frame.styl +5 -5
  48. package/source/css/_layout/tag-plugins/inline-labels.styl +1 -1
  49. package/source/css/_layout/tag-plugins/link.styl +6 -6
  50. package/source/css/_layout/tag-plugins/mark.styl +3 -4
  51. package/source/css/_layout/tag-plugins/navbar.styl +1 -1
  52. package/source/css/_layout/tag-plugins/note.styl +7 -7
  53. package/source/css/_layout/tag-plugins/poetry.styl +2 -2
  54. package/source/css/_layout/tag-plugins/quot.styl +7 -7
  55. package/source/css/_layout/tag-plugins/tabs.styl +1 -1
  56. package/source/css/_layout/tag-plugins/timeline.styl +3 -3
  57. package/source/css/_layout/widgets/ghrepo.styl +34 -0
  58. package/source/css/_layout/widgets/ghuser.styl +95 -0
  59. package/source/css/_layout/widgets/recent.styl +15 -0
  60. package/source/css/_layout/widgets/related.styl +8 -0
  61. package/source/css/_layout/widgets/search.styl +3 -0
  62. package/source/css/_layout/widgets/tagcloud.styl +8 -0
  63. package/source/css/_layout/widgets/timeline.styl +17 -0
  64. package/source/css/_layout/{sidebar → widgets}/toc_blog.styl +1 -1
  65. package/source/css/_layout/{sidebar → widgets}/toc_common.styl +7 -4
  66. package/source/css/_layout/{sidebar → widgets}/toc_wiki.styl +3 -7
  67. package/source/css/_layout/widgets/widgets.styl +60 -0
  68. package/source/css/_plugins/index.styl +4 -0
  69. package/source/css/_plugins/search/local-search.styl +89 -0
  70. package/source/js/main.js +42 -6
  71. package/source/js/search/local-search.js +153 -0
  72. package/source/css/_layout/sidebar/ghrepo.styl +0 -36
  73. package/source/css/_layout/sidebar/ghuser.styl +0 -98
  74. 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.16.2'
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
@@ -2,7 +2,10 @@
2
2
  # layout即组件布局,支持自定义的有:
3
3
  # - markdown: 渲染 md 文本
4
4
  #
5
-
5
+ search:
6
+ layout: search
7
+ filter: auto # auto or 'path'
8
+
6
9
  ghrepo:
7
10
  layout: ghrepo
8
11
  related:
package/languages/en.yml CHANGED
@@ -41,6 +41,11 @@ page:
41
41
  why: The address may be entered incorrectly or the address has been deleted.
42
42
  action: Back to Home
43
43
 
44
+ search:
45
+ search: Search
46
+ search_in: Search in %s
47
+ no_results: No Results!
48
+
44
49
  message:
45
50
  copied: Copied!
46
51
 
@@ -41,6 +41,11 @@ page:
41
41
  why: 可能是输入地址有误或该地址已被删除
42
42
  action: 返回主页
43
43
 
44
+ search:
45
+ search: 站内搜索
46
+ search_in: 在 %s 中搜索
47
+ no_results: 没有找到内容!
48
+
44
49
  message:
45
50
  copied: 复制成功
46
51
 
@@ -41,6 +41,11 @@ page:
41
41
  why: 可能是網址有誤或已經刪除
42
42
  action: 返回首頁
43
43
 
44
+ search:
45
+ search: 站內搜索
46
+ search_in: 在 %s 中搜索
47
+ no_results: 沒有找到內容!
48
+
44
49
  message:
45
50
  copied: 複製成功
46
51
 
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.latyout == 'post' && page.cover) {
73
+ if (page.layout == 'post' && page.cover) {
74
74
  el += '&pics=' + page.cover;
75
- } else if (page.latyout == 'wiki' && page.logo && page.logo.src) {
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
- <a class='paginator prev<%- page.prev != 0 ? "" : " disable" %>' href='<%- url_for(page.prev_link) %>'>
4
- <img src='https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/arrow/f049bbd4e88ec.svg'/>
5
- </a>
6
- <div class='paginator current'>
7
- <%- page.current %><span class='sep'></span><%- page.total %>
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
  <% } %>
@@ -11,7 +11,7 @@ if (poster) {
11
11
  }
12
12
  function div_default() {
13
13
  var el = '';
14
- el += '<article class="md">';
14
+ el += '<article class="md-text">';
15
15
 
16
16
  // 封面
17
17
  if (obj.image || theme.article.auto_cover) {
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  function layoutDiv() {
3
3
  var el = '';
4
- el += '<article class="md">';
4
+ el += '<article class="md-text">';
5
5
  if (proj.logo && proj.logo.src) {
6
6
  el += '<div class="preview">';
7
7
  el += '<img src="' + proj.logo.src + '" alt="logo"';
@@ -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 += '<div class="widget-wrap logo-wrap wiki"><div class="widget-body">';
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></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 += '<div class="widget-wrap" id="timeline">';
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 += '</div>';
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 += '<div class="widget-wrap" id="repo-info">';
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 += '</div>';
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 += '<div class="widget-wrap" id="github-user">';
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 += '</div>';
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 += '<div class="widget-wrap" id="markdown">';
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 += '</div>';
14
+ el += '</widget>';
15
15
  return el;
16
16
  }
17
17
  %>
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  function layoutDiv() {
3
- var el = '<div class="widget-wrap" id="recent">';
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
- if (proj && proj.name) {
37
- el += proj.name + ' / ';
38
- } else if (post.wiki) {
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 += '</div>';
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 += '<div class="widget-wrap" id="related">';
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 += '</div>';
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 += '<div class="widget-wrap" id="tagcloud">';
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 += '</div>';
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 += '<div class="widget-wrap" id="timeline">';
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 += '</div>';
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 += '<div class="widget-wrap ' + type + '" id="toc">';
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 += '</div>';
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 md ' + page.layout + (page.indent ? ' indent' : '') + scrollreveal() + '">';
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 %> md <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
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 md <%- page.layout %><%- scrollreveal() %>'>
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.16.2",
3
+ "version": "1.17.1",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -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
+ })
@@ -12,7 +12,7 @@ a
12
12
  &:hover
13
13
  color: $color-hover
14
14
 
15
- .md p:not([class])
15
+ .md-text p:not([class])
16
16
  text-align: convert(hexo-config('style.text-align'))
17
17
 
18
18
  hr
@@ -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
- article.md .highlight, pre:not([class]):has(>code)
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
- article.md .highlight
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
- article.md .gist
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
- article.md pre
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
- article.md .highlight
109
+ .md-text .highlight
110
110
  .code
111
111
  vertical-align: top
112
112
  &:before
@@ -3,6 +3,7 @@ span.dot,span.sep
3
3
  margin: 0 .25em
4
4
  span.dot:before
5
5
  content: '·'
6
+ font-weight: 900
6
7
  span.sep:before
7
8
  content: '/'
8
9
  padding-left: 2px
@@ -1,4 +1,5 @@
1
1
  @import 'partial/*'
2
2
  @import 'tag-plugins/*'
3
3
  @import 'sidebar/*'
4
+ @import 'widgets/*'
4
5
  @import 'pages/*'