hexo-theme-stellar 1.17.2 → 1.18.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 (88) hide show
  1. package/README.md +2 -2
  2. package/_config.yml +35 -57
  3. package/_data/widgets.yml +0 -15
  4. package/layout/_partial/plugins/comments/artalk/layout.ejs +19 -0
  5. package/layout/_partial/plugins/comments/artalk/script.ejs +25 -0
  6. package/layout/_partial/plugins/comments/layout.ejs +4 -4
  7. package/layout/_partial/scripts/index.ejs +1 -1
  8. package/layout/_partial/sidebar/header.ejs +4 -4
  9. package/layout/_partial/sidebar/index.ejs +4 -4
  10. package/layout/_partial/widgets/search.ejs +1 -0
  11. package/layout/_partial/widgets/toc.ejs +1 -1
  12. package/package.json +1 -1
  13. package/scripts/generators/search.js +2 -0
  14. package/scripts/tags/index.js +32 -6
  15. package/scripts/tags/inline-labels.js +27 -27
  16. package/scripts/tags/lib/ablock.js +33 -0
  17. package/scripts/tags/lib/about.js +48 -0
  18. package/scripts/tags/lib/checkbox.js +30 -0
  19. package/scripts/tags/{copy.js → lib/copy.js} +23 -23
  20. package/scripts/tags/lib/emoji.js +40 -0
  21. package/scripts/tags/{folders.js → lib/folders.js} +22 -22
  22. package/scripts/tags/lib/folding.js +30 -0
  23. package/scripts/tags/lib/frame.js +66 -0
  24. package/scripts/tags/lib/friends.js +53 -0
  25. package/scripts/tags/{ghcard.js → lib/ghcard.js} +18 -18
  26. package/scripts/tags/lib/grid.js +49 -0
  27. package/scripts/tags/{image.js → lib/image.js} +38 -38
  28. package/scripts/tags/lib/link.js +78 -0
  29. package/scripts/tags/lib/mark.js +23 -0
  30. package/scripts/tags/lib/navbar.js +57 -0
  31. package/scripts/tags/lib/note.js +35 -0
  32. package/scripts/tags/lib/poetry.js +47 -0
  33. package/scripts/tags/lib/quot.js +55 -0
  34. package/scripts/tags/lib/sites.js +57 -0
  35. package/scripts/tags/lib/swiper.js +36 -0
  36. package/scripts/tags/lib/tabs.js +33 -33
  37. package/scripts/tags/lib/tag.js +35 -0
  38. package/scripts/tags/lib/timeline.js +78 -0
  39. package/scripts/tags/lib/toc.js +73 -0
  40. package/source/css/_common/highlight.styl +0 -3
  41. package/source/css/_custom.styl +13 -27
  42. package/source/css/_defines/theme.styl +47 -34
  43. package/source/css/_layout/md.styl +14 -12
  44. package/source/css/_layout/partial/paginator.styl +2 -1
  45. package/source/css/_layout/partial/related.styl +8 -6
  46. package/source/css/_layout/sidebar/header.styl +2 -2
  47. package/source/css/_layout/tag-plugins/common.styl +51 -65
  48. package/source/css/_layout/tag-plugins/folders.styl +8 -8
  49. package/source/css/_layout/tag-plugins/folding.styl +10 -11
  50. package/source/css/_layout/tag-plugins/{split.styl → grid.styl} +4 -4
  51. package/source/css/_layout/tag-plugins/link.styl +1 -1
  52. package/source/css/_layout/tag-plugins/mark.styl +2 -2
  53. package/source/css/_layout/tag-plugins/navbar.styl +1 -1
  54. package/source/css/_layout/tag-plugins/note.styl +3 -1
  55. package/source/css/_layout/tag-plugins/poetry.styl +26 -25
  56. package/source/css/_layout/tag-plugins/quot.styl +45 -58
  57. package/source/css/_layout/tag-plugins/tag.styl +13 -0
  58. package/source/css/_layout/widgets/ghuser.styl +19 -15
  59. package/source/css/_layout/widgets/search.styl +102 -1
  60. package/source/css/_layout/widgets/toc_common.styl +1 -1
  61. package/source/css/_plugins/aplayer.styl +3 -0
  62. package/source/css/_plugins/comments/artalk.styl +4 -0
  63. package/source/css/_plugins/comments/twikoo.styl +0 -1
  64. package/source/css/_plugins/comments/utterances.styl +1 -1
  65. package/source/css/_plugins/index.styl +4 -3
  66. package/source/css/_plugins/swiper.styl +7 -4
  67. package/source/js/main.js +7 -5
  68. package/source/js/plugins/weibo.js +116 -0
  69. package/scripts/tags/about.js +0 -48
  70. package/scripts/tags/border.js +0 -35
  71. package/scripts/tags/checkbox.js +0 -38
  72. package/scripts/tags/emoji.js +0 -40
  73. package/scripts/tags/folding.js +0 -30
  74. package/scripts/tags/frame.js +0 -66
  75. package/scripts/tags/friends.js +0 -53
  76. package/scripts/tags/lib/users.js +0 -22
  77. package/scripts/tags/link.js +0 -79
  78. package/scripts/tags/mark.js +0 -23
  79. package/scripts/tags/navbar.js +0 -57
  80. package/scripts/tags/note.js +0 -37
  81. package/scripts/tags/poetry.js +0 -48
  82. package/scripts/tags/quot.js +0 -51
  83. package/scripts/tags/sites.js +0 -57
  84. package/scripts/tags/split.js +0 -49
  85. package/scripts/tags/swiper.js +0 -38
  86. package/scripts/tags/timeline.js +0 -81
  87. package/scripts/tags/toc.js +0 -72
  88. package/source/css/_plugins/search/local-search.styl +0 -87
@@ -0,0 +1,57 @@
1
+ /**
2
+ * navbar.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% navbar [markdown link] ... %}
6
+ *
7
+ * example:
8
+ * {% navbar active:1 [Home](/) [About](/about/) [Comments](#comments) %}
9
+ */
10
+
11
+ 'use strict'
12
+
13
+ module.exports = ctx => function(args) {
14
+ if (args.length == 0) {
15
+ return
16
+ }
17
+ args = ctx.args.map(args, ['active'], ['links'])
18
+ if (args.links) {
19
+ args.links = args.links.split(' ')
20
+ }
21
+ var el = '<div class="tag-plugin navbar"><nav class="cap">'
22
+ function layoutItem(a, i) {
23
+ var text = ''
24
+ var href = ''
25
+ var el = '<a'
26
+ if ((i+1).toString() === args.active) {
27
+ el += ' class="active"'
28
+ }
29
+ if (a.includes('](')) {
30
+ // markdown
31
+ let tmp = a.split('](')
32
+ if (tmp.length > 1) {
33
+ text = tmp[0]
34
+ if (text.length > 1) {
35
+ text = text.substring(1, text.length)
36
+ }
37
+ href = tmp[1]
38
+ if (href.length > 1) {
39
+ href = href.substring(0, href.length-1)
40
+ }
41
+ el += ' href="' + href + '"'
42
+ }
43
+ } else {
44
+ el += ' href="#' + a + '"'
45
+ text = a
46
+ }
47
+ el += '>'
48
+ el += text
49
+ el += '</a>'
50
+ return el
51
+ }
52
+ (args.links || []).forEach((item, i) => {
53
+ el += layoutItem(item, i)
54
+ })
55
+ el += '</nav></div>'
56
+ return el
57
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * note.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% note [color:color] [title] content %}
6
+ */
7
+
8
+ 'use strict'
9
+
10
+ module.exports = ctx => function(args) {
11
+ args = ctx.args.map(args, ['color'], ['title', 'content'])
12
+ if (args.content == undefined || args.content.length <= 0) {
13
+ args.content = args.title
14
+ args.title = ''
15
+ }
16
+ const { title } = args
17
+ if (args.color == null) {
18
+ args.color = ctx.theme.config.tag_plugins.note.default_color
19
+ }
20
+ var el = ''
21
+ // header
22
+ el += '<div class="tag-plugin note"'
23
+ el += ' ' + ctx.args.joinTags(args, ['color', 'child']).join(' ')
24
+ el += '>'
25
+ // title
26
+ if (title && title.length > 0) {
27
+ el += '<div class="title">' + title + '</div>'
28
+ }
29
+ // content
30
+ el += '<div class="body">'
31
+ el += ctx.render.renderSync({text: args.content, engine: 'markdown'}).split('\n').join('')
32
+ el += '</div></div>'
33
+
34
+ return el
35
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * poetry.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * poetry:
6
+ * {% poetry [title] [author:作者] [date:日期] [footer:footer] %}
7
+ * body
8
+ * {% endpoetry %}
9
+ *
10
+ */
11
+
12
+ 'use strict'
13
+
14
+ module.exports = ctx => function(args, content) {
15
+ var el = ''
16
+ args = ctx.args.map(args, ['author', 'date', 'footer'], ['title'])
17
+
18
+ el += '<div class="tag-plugin poetry"'
19
+ el += '>'
20
+ el += '<div class="content">'
21
+ if (args.title) {
22
+ el += '<div class="title">'
23
+ el += args.title
24
+ el += '</div>'
25
+ }
26
+ if (args.author || args.date) {
27
+ el += '<div class="meta">'
28
+ if (args.author) {
29
+ el += '<span>' + args.author + '</span>'
30
+ }
31
+ if (args.date) {
32
+ el += '<span>' + args.date + '</span>'
33
+ }
34
+ el += '</div>'
35
+ }
36
+ el += '<div class="body">'
37
+ el += ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')
38
+ el += '</div>'
39
+ if (args.footer) {
40
+ el += '<div class="footer">'
41
+ el += args.footer
42
+ el += '</div>'
43
+ }
44
+ el += '</div>'
45
+ el += '</div>'
46
+ return el
47
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * quot.js v1.2 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * quot:
6
+ * {% quot [el:h2] [icon:default] text %}
7
+ *
8
+ */
9
+
10
+ 'use strict'
11
+
12
+ module.exports = ctx => function(args) {
13
+ var el = ''
14
+ args = ctx.args.map(args, ['el', 'icon'], ['text'])
15
+ if (!args.el) {
16
+ args.el = 'p'
17
+ }
18
+
19
+ var type = ''
20
+ if (args.icon && args.icon != 'square' && args.icon != 'quotes') {
21
+ type = ' type="icon"'
22
+ } else {
23
+ type = ' type="text"'
24
+ }
25
+ function content() {
26
+ if (!args.icon) {
27
+ return args.text
28
+ }
29
+ var el = ''
30
+ const cfg = ctx.theme.config.tag_plugins.quot[args.icon]
31
+ if (cfg && cfg.prefix) {
32
+ el += '<img class="icon prefix" src="' + cfg.prefix + '" />'
33
+ }
34
+ el += args.text
35
+ if (cfg && cfg.suffix) {
36
+ el += '<img class="icon suffix" src="' + cfg.suffix + '" />'
37
+ }
38
+ return el
39
+ }
40
+ if (args.el.includes('h')) {
41
+ el += '<div' + ' class="tag-plugin quot">'
42
+ el += '<' + args.el + ' class="content" id="' + args.text + '"' + type + '>'
43
+ el += '<a href="#' + args.text + '" class="headerlink" title="' + args.text + '"></a>'
44
+ el += content()
45
+ el += '</' + args.el + '>'
46
+ el += '</div>'
47
+ } else {
48
+ el += '<div' + ' class="tag-plugin quot">'
49
+ el += '<' + args.el + ' class="content"' + type + '>'
50
+ el += content()
51
+ el += '</' + args.el + '>'
52
+ el += '</div>'
53
+ }
54
+ return el
55
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * sites.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% sites [group] [repo:owner/repo] [api:http] %}
6
+ */
7
+
8
+ 'use strict'
9
+
10
+ module.exports = ctx => function(args) {
11
+ args = ctx.args.map(args, ['repo', 'api'], ['group'])
12
+ var links = ctx.locals.get('data').links
13
+ if (links == undefined) {
14
+ links = {}
15
+ }
16
+ var api
17
+ if (args.api) {
18
+ api = args.api
19
+ } else if (args.repo) {
20
+ api = 'https://api.vlts.cc/output_data/v2/' + args.repo
21
+ }
22
+
23
+ var el = '<div class="tag-plugin sites-wrap">'
24
+ if (api) {
25
+ el += '<div class="stellar-sites-api"'
26
+ el += ' api="' + api + '"'
27
+ el += '>'
28
+ el += '<div class="group-body"></div>'
29
+ el += '</div>'
30
+ } else if (args.group) {
31
+ function cell(item) {
32
+ if (item.url && item.title) {
33
+ var cell = '<div class="site-card">'
34
+ cell += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="' + item.url + '">'
35
+ cell += '<img src="' + (item.screenshot || ('https://screenshot-api.xaoxuu.com/api?url=' + item.url + '&width=1280&height=720')) + '" onerror="javascript:this.removeAttribute(&quot;data-src&quot;);this.src=&quot;' + ctx.theme.config.default.cover + '&quot;;"/>'
36
+ cell += '<div class="info">'
37
+ cell += '<img src="' + (item.avatar || ctx.theme.config.default.link) + '" onerror="javascript:this.removeAttribute(&quot;data-src&quot;);this.src=&quot;' + ctx.theme.config.default.link + '&quot;;"/>'
38
+ cell += '<span class="title">' + item.title + '</span>'
39
+ cell += '<span class="desc">' + (item.description || item.url) + '</span>'
40
+ cell += '</div>'
41
+ cell += '</a></div>'
42
+ return cell
43
+ } else {
44
+ return ''
45
+ }
46
+ }
47
+ el += '<div class="group-body">'
48
+ const items = links[args.group] || []
49
+ items.forEach((item, i) => {
50
+ el += cell(item)
51
+ })
52
+ el += '</div>'
53
+ }
54
+
55
+ el += '</div>'
56
+ return el
57
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * swiper.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% swiper [width:max] [effect:cards] %}
6
+ * ![img](src)
7
+ * {% endswiper %}
8
+ */
9
+
10
+ 'use strict'
11
+
12
+ module.exports = ctx => function(args, content) {
13
+ args = ctx.args.map(args, ['width', 'effect'])
14
+ var el = ''
15
+ function slide() {
16
+ let imgs = ctx.render.renderSync({text: content, engine: 'markdown'})
17
+ imgs = imgs.match(/<img(.*?)src="(.*?)"(.*?)>/gi)
18
+ if (imgs && imgs.length > 0) {
19
+ imgs.forEach((img, i) => {
20
+ img = img.replace('<img src', '<img no-lazy src')
21
+ el += '<div class="swiper-slide">' + img + '</div>'
22
+ })
23
+ }
24
+ }
25
+ el += '<div class="tag-plugin gallery swiper" id="swiper-api"'
26
+ el += ' ' + ctx.args.joinTags(args, ['width', 'effect']).join(' ')
27
+ el += '>'
28
+ el += '<div class="swiper-wrapper">'
29
+ slide()
30
+ el += '</div>'
31
+ el += '<div class="swiper-pagination"></div>'
32
+ el += '<div class="swiper-button-prev blur"></div>'
33
+ el += '<div class="swiper-button-next blur"></div>'
34
+ el += '</div>'
35
+ return el
36
+ }
@@ -2,58 +2,58 @@
2
2
  * tabs.js v2 | 基于NexT修改: https://theme-next.js.org/docs/tag-plugins/tabs
3
3
  */
4
4
 
5
- 'use strict';
5
+ 'use strict'
6
6
 
7
- var tab_index = 0;
7
+ var tab_index = 0
8
8
 
9
9
  module.exports = ctx => function(args, content = '') {
10
- var el = '';
11
10
  var arr = content.split(/<!--\s*tab (.*?)\s*-->/g).filter(item => item.trim().length > 0)
12
11
  if (arr.length < 1) {
13
- return el;
12
+ return ''
14
13
  }
15
- var tabs = [];
14
+ var tabs = []
16
15
  arr.forEach((item, i) => {
17
16
  if (i % 2 == 0) {
18
17
  tabs.push({
19
18
  header: item
20
- });
19
+ })
21
20
  } else if (tabs.length > 0) {
22
- var tab = tabs[tabs.length-1];
21
+ var tab = tabs[tabs.length-1]
23
22
  if (tab.body == undefined) {
24
- tab.body = item;
23
+ tab.body = item
25
24
  } else {
26
- tab.body += '\n' + item;
25
+ tab.body += '\n' + item
27
26
  }
28
27
  }
29
- });
28
+ })
30
29
 
31
- args = ctx.args.map(args, ['active', 'align']);
32
- const tabName = 'tab_' + ++tab_index;
33
- const tabActive = Number(args.active) || 0;
30
+ args = ctx.args.map(args, ['active', 'align'])
31
+ const tabName = 'tab_' + ++tab_index
32
+ const tabActive = Number(args.active) || 0
34
33
 
35
- let tabId = 0;
36
- let tabNav = '';
37
- let tabContent = '';
34
+ let tabId = 0
35
+ let tabNav = ''
36
+ let tabContent = ''
38
37
  tabs.forEach((tab, i) => {
39
- let content = ctx.render.renderSync({ text: (tab.body || ''), engine: 'markdown' }).trim();
40
- const abbr = tabName + ' ' + ++tabId;
41
- const href = abbr.toLowerCase().split(' ').join('-');
42
- const isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : '';
43
- tabNav += `<li class="tab${isActive}"><a href="#${href}">${tab.header || abbr}</a></li>`;
44
- tabContent += `<div class="tab-pane${isActive}" id="${href}">${content}</div>`;
45
- });
38
+ let content = ctx.render.renderSync({ text: (tab.body || ''), engine: 'markdown' }).trim()
39
+ const abbr = tabName + ' ' + ++tabId
40
+ const href = abbr.toLowerCase().split(' ').join('-')
41
+ const isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : ''
42
+ tabNav += `<li class="tab${isActive}"><a href="#${href}">${tab.header || abbr}</a></li>`
43
+ tabContent += `<div class="tab-pane${isActive}" id="${href}">${content}</div>`
44
+ })
46
45
 
47
- tabNav = `<ul class="nav-tabs">${tabNav}</ul>`;
48
- tabContent = `<div class="tab-content">${tabContent}</div>`;
46
+ tabNav = `<ul class="nav-tabs">${tabNav}</ul>`
47
+ tabContent = `<div class="tab-content">${tabContent}</div>`
49
48
 
50
- el += '<div class="tag-plugin tabs"';
49
+ var el = ''
50
+ el += '<div class="tag-plugin tabs"'
51
51
  if (args.align != undefined) {
52
- el += ' align="' + args.align + '"';
52
+ el += ' align="' + args.align + '"'
53
53
  }
54
- el += 'id="' + tabName.toLowerCase().split(' ').join('-') + '"';
55
- el += '">';
56
- el += tabNav + tabContent;
57
- el += '</div>';
58
- return el;
59
- };
54
+ el += 'id="' + tabName.toLowerCase().split(' ').join('-') + '"'
55
+ el += '>'
56
+ el += tabNav + tabContent
57
+ el += '</div>'
58
+ return el
59
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * tag.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% tag text href [color:color] %}
6
+ *
7
+ */
8
+
9
+ 'use strict'
10
+
11
+ const tag_colors = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple']
12
+ var tag_index = 0
13
+
14
+ module.exports = ctx => function(args) {
15
+ args = ctx.args.map(args, ['color'], ['text', 'href'])
16
+ if (args.color == null) {
17
+ const default_color = ctx.theme.config.tag_plugins.tag?.default_color
18
+ if (default_color) {
19
+ args.color = default_color
20
+ } else {
21
+ args.color = tag_colors[tag_index]
22
+ tag_index += 1
23
+ if (tag_index >= tag_colors.length) {
24
+ tag_index = 0
25
+ }
26
+ }
27
+ }
28
+ var el = ''
29
+ el += '<a class="tag-plugin tag"'
30
+ el += ' ' + ctx.args.joinTags(args, ['color', 'href']).join(' ')
31
+ el += '>'
32
+ el += args.text
33
+ el += '</a>'
34
+ return el
35
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * timeline.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ *
4
+ * {% timeline %}
5
+ *
6
+ * <!-- node header1 -->
7
+ * what happened 1
8
+ *
9
+ * <!-- node header2 -->
10
+ * what happened 2
11
+ *
12
+ * {% endtimeline %}
13
+ */
14
+
15
+ 'use strict'
16
+
17
+ function layoutNodeTitle(ctx, content) {
18
+ var el = ''
19
+ el += '<div class="header">'
20
+ if (content && content.length > 0) {
21
+ el += ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')
22
+ }
23
+ el += '</div>'
24
+ return el
25
+ }
26
+
27
+ function layoutNodeContent(ctx, content) {
28
+ var el = ''
29
+ el += '<div class="body fs14">'
30
+ if (content && content.length > 0) {
31
+ el += ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')
32
+ }
33
+ el += '</div>'
34
+ return el
35
+ }
36
+
37
+ module.exports = ctx => function(args, content = '') {
38
+ args = ctx.args.map(args, ['api', 'user', 'type', 'limit', 'hide'])
39
+ var el = ''
40
+ if (!args.type) {
41
+ args.type = 'timeline'
42
+ }
43
+ if (args.api && args.api.length > 0) {
44
+ el += '<div class="tag-plugin timeline stellar-' + args.type + '-api"'
45
+ el += ' ' + ctx.args.joinTags(args, ['api', 'user', 'limit', 'hide']).join(' ')
46
+ el += '>'
47
+ } else {
48
+ el += '<div class="tag-plugin timeline">'
49
+ }
50
+
51
+ var arr = content.split(/<!--\s*node (.*?)\s*-->/g).filter(item => item.trim().length > 0)
52
+ if (arr.length > 0) {
53
+ var nodes = []
54
+ arr.forEach((item, i) => {
55
+ if (i % 2 == 0) {
56
+ nodes.push({
57
+ header: item
58
+ })
59
+ } else if (nodes.length > 0) {
60
+ var node = nodes[nodes.length-1]
61
+ if (node.body == undefined) {
62
+ node.body = item
63
+ } else {
64
+ node.body += '\n' + item
65
+ }
66
+ }
67
+ })
68
+ nodes.forEach((node, i) => {
69
+ el += '<div class="timenode" index="' + (i) + '">'
70
+ el += layoutNodeTitle(ctx, node.header)
71
+ el += layoutNodeContent(ctx, node.body)
72
+ el += '</div>'
73
+ })
74
+ }
75
+
76
+ el += '</div>'
77
+ return el
78
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * toc.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% toc wiki:xxx [title] [open:true] [display:mobile] %}
6
+ */
7
+
8
+ 'use strict'
9
+
10
+ function layoutDocTree(ctx, pages) {
11
+ const url_for = require('hexo-util').url_for.bind(ctx)
12
+ var el = ''
13
+ el += '<ul class="toc">'
14
+ pages.forEach((p, i) => {
15
+ el += '<li>'
16
+ el += '<a class="list-link" href="' + url_for(p.path) + '">'
17
+ el += '<span>' + (p.title || p.seo_title) + '</span>'
18
+ el += '</a>'
19
+ el += '</li>'
20
+ })
21
+ el += '</ul>'
22
+ return el
23
+ }
24
+
25
+ module.exports = ctx => function(args) {
26
+ args = ctx.args.map(args, ['wiki', 'open', 'display'], ['title'])
27
+
28
+ var el = ''
29
+ el += '<div class="tag-plugin toc"'
30
+ el += ' ' + ctx.args.joinTags(args, ['display']).join(' ')
31
+ if (args.display === 'mobile') {
32
+ el += ' style="display:none"'
33
+ }
34
+ el += '>'
35
+
36
+ el += '<details class="toc"'
37
+ if (args.open != 'false') {
38
+ el += ' open'
39
+ }
40
+ el += '>'
41
+ el += '<summary>'
42
+ el += args.title || 'TOC'
43
+ el += '</summary>'
44
+
45
+ if (args.wiki) {
46
+ const proj = ctx.theme.config.wiki.projects[args.wiki]
47
+ if (proj == undefined) {
48
+ return ''
49
+ }
50
+ if (proj.sections && proj.sections.length > 1) {
51
+ el += '<div class="body fs14 multi">'
52
+ proj.sections.forEach((sec, i) => {
53
+ el += '<section>'
54
+ el += '<div class="header">'
55
+ el += sec.title
56
+ el += '</div>'
57
+ el += layoutDocTree(ctx, sec.pages)
58
+ el += '</section>'
59
+ })
60
+ el += '</div>'
61
+ } else {
62
+ el += '<div class="body fs14">'
63
+ el += '<div class="body">'
64
+ el += layoutDocTree(ctx, proj.pages)
65
+ el += '</div>'
66
+ el += '</div>'
67
+ }
68
+ }
69
+ el += '</details>'
70
+ // end
71
+ el += '</div>'
72
+ return el
73
+ }
@@ -15,7 +15,6 @@ p>code:not([class]),li>code:not([class])
15
15
  border-radius: $border-block
16
16
  overflow: hidden
17
17
  background: var(--block)
18
- border: 1px solid var(--block-border)
19
18
  line-height: 1.5
20
19
  font-family: $ff-code
21
20
  box-sizing: border-box
@@ -35,7 +34,6 @@ p>code:not([class]),li>code:not([class])
35
34
  background: var(--block-hover)
36
35
  border-top-left-radius: "calc(%s - 1px)" % $border-block
37
36
  border-top-right-radius: "calc(%s - 1px)" % $border-block
38
- border-bottom: 1px solid var(--block-border)
39
37
  span
40
38
  margin-right: 4px
41
39
  >table
@@ -102,7 +100,6 @@ table:not([class])
102
100
  >.hljs
103
101
  padding: 1rem
104
102
  border-radius: $border-block
105
- border: 1px solid var(--block-border)
106
103
  line-height: 1.5
107
104
  box-sizing: border-box
108
105
 
@@ -1,31 +1,17 @@
1
1
  @require('_defines/const')
2
2
 
3
3
  // 通用主题色
4
- $color-theme = convert(hexo-config('style.color.common.theme'))
5
- $color-accent = convert(hexo-config('style.color.common.accent'))
6
- $color-link = convert(hexo-config('style.color.common.link'))
7
- $color-button = convert(hexo-config('style.color.common.button'))
8
- $color-hover = convert(hexo-config('style.color.common.hover'))
9
-
10
- // 浅色
11
- $light-background = convert(hexo-config('style.color.light.background'))
12
- $light-block = convert(hexo-config('style.color.light.block'))
13
- $light-card = convert(hexo-config('style.color.light.card'))
14
- $light-title = convert(hexo-config('style.color.light.title'))
15
- $light-text = convert(hexo-config('style.color.light.text'))
16
- $light-code = convert(hexo-config('style.color.light.code'))
17
-
18
- // 深色
19
- $dark-background = convert(hexo-config('style.color.dark.background'))
20
- $dark-block = convert(hexo-config('style.color.dark.block'))
21
- $dark-card = convert(hexo-config('style.color.dark.card'))
22
- $dark-title = convert(hexo-config('style.color.dark.title'))
23
- $dark-text = convert(hexo-config('style.color.dark.text'))
24
- $dark-code = convert(hexo-config('style.color.dark.code'))
25
-
26
- // 移动端深色背景(OLED调成纯黑可以省电)
27
- $dark-background-mobile = convert(hexo-config('style.color.dark.background-mobile'))
28
-
4
+ $color-theme = convert(hexo-config('style.color.theme'))
5
+ $color-accent = convert(hexo-config('style.color.accent'))
6
+ $color-link = convert(hexo-config('style.color.link'))
7
+ $color-button = convert(hexo-config('style.color.button'))
8
+ $color-hover = convert(hexo-config('style.color.hover'))
9
+
10
+ // 动态颜色
11
+ $color-background = convert(hexo-config('style.color.background'))
12
+ $color-block = convert(hexo-config('style.color.block'))
13
+ $color-code = convert(hexo-config('style.color.code'))
14
+ $color-text = convert(hexo-config('style.color.text'))
29
15
 
30
16
  // @font-face
31
17
  // font-family: 'Dosis'
@@ -55,7 +41,7 @@ $fs-13 = .8125rem
55
41
  $fs-12 = .75rem
56
42
 
57
43
  $fs-h1 = 1.75rem // 32px
58
- $fs-h2 = 1.5rem // 24px
44
+ $fs-h2 = 1.5rem // 24px
59
45
  $fs-h3 = 1.375rem // 22px
60
46
  $fs-h4 = 1.125rem // 18px
61
47
  $fs-h5 = $fs-15
@@ -64,7 +50,7 @@ $fs-p = $fs-15
64
50
  $fs-code = $fs-13
65
51
 
66
52
  $border-card = 12px
67
- $border-block = 8px
53
+ $border-block = 6px
68
54
  $border-image = 6px
69
55
 
70
56
  // 可以动态变化的属性