hexo-theme-stellar 1.16.0 → 1.16.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.16.0'
3
+ version: '1.16.2'
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
@@ -49,7 +49,7 @@ article:
49
49
  auto_excerpt: 200
50
50
  # 分类颜色
51
51
  category_color:
52
- '新闻稿': '#DA0F47'
52
+ '探索号': '#f44336'
53
53
  # 文章许可协议
54
54
  license: '本文采用[署名-非商业性使用-相同方式共享 4.0 国际](https://creativecommons.org/licenses/by-nc-sa/4.0/)许可协议,转载请注明出处。'
55
55
  # 分享
@@ -194,7 +194,7 @@ footer:
194
194
  tag_plugins:
195
195
  # {% note text %}
196
196
  note:
197
- default_color: '' # light, dark, red, orange, yellow, green, cyan, blue, purple
197
+ default_color: '' # light, dark, red, orange, yellow, green, cyan, blue, purple, warning, error
198
198
  # {% checkbox %}
199
199
  checkbox:
200
200
  interactive: false # enable interactive for user
@@ -219,6 +219,9 @@ tag_plugins:
219
219
  # {% timeline %}
220
220
  timeline:
221
221
  max-height: 80vh
222
+ # {% mark %}
223
+ mark:
224
+ default_color: dark # light, dark, red, orange, yellow, green, cyan, blue, purple, warning, error
222
225
 
223
226
 
224
227
  ######## JS Plugins ########
@@ -73,11 +73,21 @@ function layoutWidgets() {
73
73
  }
74
74
  if (page.sidebar) {
75
75
  page.sidebar.forEach((w, i) => {
76
- if (w in theme.data.widgets) {
77
- let widget = theme.data.widgets[w];
78
- if (widget && widget.layout) {
79
- el += partial('widgets/' + widget.layout, {item: widget});
80
- }
76
+ let name = ''
77
+ let widget = {}
78
+ if (typeof w == 'string') {
79
+ name = w
80
+ } else if (typeof w == 'object' && w.override) {
81
+ name = w.override
82
+ }
83
+ if (name in theme.data.widgets) {
84
+ Object.assign(widget, theme.data.widgets[name])
85
+ }
86
+ if (typeof w == 'object' && w.override) {
87
+ Object.assign(widget, w)
88
+ }
89
+ if (widget && widget.layout) {
90
+ el += partial('widgets/' + widget.layout, {item: widget})
81
91
  }
82
92
  });
83
93
  }
@@ -3,7 +3,9 @@ function layoutDiv() {
3
3
  var el = '';
4
4
  var repo;
5
5
  var branch = 'main';
6
- if (page.layout === 'wiki' && page.wiki) {
6
+ if (page.repo) {
7
+ repo = page.repo
8
+ } else if (page.layout === 'wiki' && page.wiki) {
7
9
  let proj = theme.wiki.projects[page.wiki];
8
10
  if (proj && proj.repo) {
9
11
  repo = proj.repo;
@@ -11,9 +13,6 @@ function layoutDiv() {
11
13
  branch = proj.branch;
12
14
  }
13
15
  }
14
- } else {
15
- // 其它的如果有设置 repo 也可以
16
- repo = page.repo;
17
16
  }
18
17
  if (repo == undefined) {
19
18
  return el;
@@ -3,7 +3,9 @@ function layoutDiv() {
3
3
  var el = '';
4
4
  var repo;
5
5
  var branch = 'main';
6
- if (page.layout === 'wiki' && page.wiki) {
6
+ if (page.repo) {
7
+ repo = page.repo
8
+ } else if (page.layout === 'wiki' && page.wiki) {
7
9
  let proj = theme.wiki.projects[page.wiki];
8
10
  if (proj && proj.repo) {
9
11
  repo = proj.repo;
@@ -11,9 +13,6 @@ function layoutDiv() {
11
13
  branch = proj.branch;
12
14
  }
13
15
  }
14
- } else {
15
- // 其它的如果有设置 repo 也可以
16
- repo = page.repo;
17
16
  }
18
17
  if (repo == undefined) {
19
18
  return el;
@@ -24,7 +24,7 @@ function layoutDiv() {
24
24
 
25
25
  el += '<div class="widget-wrap" id="github-user">';
26
26
  // body
27
- el += '<div class="widget-body stellar-ghinfo-api" api="' + item.api + '/users/' + item.username + '">';
27
+ el += '<div class="widget-body stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/users/' + item.username + '">';
28
28
  if (item.avatar) {
29
29
  el += '<div class="avatar" ><img no-lazy type="img" id="avatar_url" src="' + config.avatar + '"></div>';
30
30
  }
@@ -1,16 +1,16 @@
1
1
  <%
2
2
  function layoutDiv() {
3
+ if (!item.content?.length) return ''
3
4
  var el = '';
4
- if (item.content == undefined || item.content.length == 0) {
5
- return el;
6
- }
7
5
  el += '<div class="widget-wrap" id="markdown">';
6
+ if (item.title?.length > 0) {
8
7
  el += '<div class="widget-header cap theme dis-select">';
9
- el += '<span class="name">' + item.title + '</span>';
10
- el += '</div>';
11
- el += '<div class="widget-body fs14">';
12
- el += markdown(item.content);
8
+ el += '<span class="name">' + item.title + '</span>';
13
9
  el += '</div>';
10
+ }
11
+ el += '<div class="widget-body fs14">';
12
+ el += markdown(item.content);
13
+ el += '</div>';
14
14
  el += '</div>';
15
15
  return el;
16
16
  }
@@ -28,6 +28,7 @@ function layoutDiv() {
28
28
  el += '<div class="widget-body related-posts fs14">';
29
29
  arr.length = item.limit
30
30
  arr.forEach(post => {
31
+ if (!post) { return }
31
32
  el += '<a class="item title" href="' + url_for(post.link || post.path) + '">';
32
33
  el += '<span class="title">'
33
34
  if (post.layout == 'wiki') {
@@ -7,7 +7,7 @@ if (page.menu_id == undefined) {
7
7
  <% if (page.posts && (is_category() || is_tag())) { %>
8
8
  <%- partial('index') %>
9
9
  <% } else { %>
10
- <% page.title = __('btn.archives') + ' - ' + config.title; %>
10
+ <% page.title = __('btn.archives'); %>
11
11
  <%- partial('_partial/main/navbar/list_post') %>
12
12
  <div class='post-list'>
13
13
  <% var years = []; %>
@@ -5,7 +5,7 @@ if (page.menu_id == undefined) {
5
5
  }
6
6
  %>
7
7
  <% if (site.categories.length) { %>
8
- <% page.title = __('btn.categories') + ' - ' + config.title; %>
8
+ <% page.title = __('btn.categories'); %>
9
9
  <% page.layout = 'categories'; %>
10
10
  <%- partial('_partial/main/navbar/list_post') %>
11
11
  <div class='post-list'>
package/layout/tags.ejs CHANGED
@@ -5,7 +5,7 @@ if (page.menu_id == undefined) {
5
5
  }
6
6
  %>
7
7
  <% if (site.tags.length) { %>
8
- <% page.title = __('btn.tags') + ' - ' + config.title; %>
8
+ <% page.title = __('btn.tags'); %>
9
9
  <% page.layout = 'tags'; %>
10
10
  <%- partial('_partial/main/navbar/list_post') %>
11
11
  <div class='post-list'>
package/layout/wiki.ejs CHANGED
@@ -7,9 +7,9 @@ if (page.layout == undefined) {
7
7
  }
8
8
  if (page.title == undefined) {
9
9
  if (page.tagName) {
10
- page.title = page.tagName + ' - ' + config.title;
10
+ page.title = page.tagName;
11
11
  } else {
12
- page.title = __('btn.wiki') + ' - ' + config.title;
12
+ page.title = __('btn.wiki');
13
13
  }
14
14
  }
15
15
  function layoutTitle() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -10,6 +10,9 @@
10
10
 
11
11
  hexo.extend.tag.register('mark', function(args) {
12
12
  args = hexo.args.map(args, ['color'], ['text']);
13
+ if (args.color == null) {
14
+ args.color = hexo.theme.config.tag_plugins.mark.default_color
15
+ }
13
16
  var el = '';
14
17
  el += '<mark class="tag-plugin mark"';
15
18
  el += ' ' + hexo.args.joinTags(args, ['color']).join(' ');
@@ -66,13 +66,13 @@ set_text_black()
66
66
  --theme-bg: #333
67
67
  set_text_white()
68
68
 
69
- .tag-plugin.note[color='warning']
69
+ .tag-plugin[color='warning']
70
70
  --theme: $c-yellow
71
71
  --theme-border: #ffe659
72
72
  --theme-bg: #ffe659
73
73
  --theme-link: #ff453a
74
74
 
75
- .tag-plugin.note[color='error']
75
+ .tag-plugin[color='error']
76
76
  --theme: $c-yellow
77
77
  --theme-border: #ff453a
78
78
  --theme-bg: #ff453a
@@ -95,7 +95,7 @@ const StellarTimeline = {
95
95
  cell += '</p>';
96
96
  }
97
97
 
98
- cell += marked.parse(item.body);
98
+ cell += marked.parse(item.body || '');
99
99
  if (!hide.includes('footer')) {
100
100
  cell += '<div class="footer">';
101
101
  cell += '<div class="flex left">';