hexo-theme-stellar 1.19.0 → 1.20.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.
Files changed (57) hide show
  1. package/_config.yml +32 -8
  2. package/layout/_partial/cover/wiki_cover.ejs +1 -1
  3. package/layout/_partial/head.ejs +2 -2
  4. package/layout/_partial/main/article/ai_abstract.ejs +3 -2
  5. package/layout/_partial/main/article/article_footer.ejs +87 -50
  6. package/layout/_partial/main/article/read_next.ejs +17 -12
  7. package/layout/_partial/main/navbar/breadcrumb.ejs +53 -15
  8. package/layout/_partial/main/navbar/list_post.ejs +6 -4
  9. package/layout/_partial/main/navbar/list_wiki.ejs +4 -3
  10. package/layout/_partial/plugins/comments/beaudar/script.ejs +1 -1
  11. package/layout/_partial/plugins/comments/giscus/script.ejs +1 -1
  12. package/layout/_partial/plugins/comments/layout.ejs +2 -2
  13. package/layout/_partial/plugins/comments/utterances/script.ejs +1 -1
  14. package/layout/_partial/sidebar/header.ejs +1 -1
  15. package/layout/_partial/sidebar/index.ejs +3 -3
  16. package/layout/_partial/widgets/ghissues.ejs +1 -1
  17. package/layout/_partial/widgets/ghrepo.ejs +1 -1
  18. package/layout/_partial/widgets/recent.ejs +3 -3
  19. package/layout/_partial/widgets/related.ejs +9 -8
  20. package/layout/_partial/widgets/toc.ejs +15 -10
  21. package/layout/index.ejs +7 -4
  22. package/layout/mermaid.ejs +8 -4
  23. package/layout/page.ejs +3 -0
  24. package/layout/wiki.ejs +3 -0
  25. package/package.json +1 -1
  26. package/scripts/events/lib/doc_tree.js +123 -92
  27. package/scripts/filters/index.js +4 -1
  28. package/scripts/tags/index.js +2 -2
  29. package/scripts/tags/inline-labels.js +2 -2
  30. package/scripts/tags/lib/ablock.js +1 -1
  31. package/scripts/tags/lib/checkbox.js +1 -1
  32. package/scripts/tags/lib/folders.js +1 -1
  33. package/scripts/tags/lib/folding.js +1 -1
  34. package/scripts/tags/lib/hashtag.js +36 -0
  35. package/scripts/tags/lib/image.js +5 -1
  36. package/scripts/tags/lib/mark.js +1 -1
  37. package/scripts/tags/lib/note.js +1 -1
  38. package/scripts/tags/lib/okr.js +140 -0
  39. package/scripts/tags/lib/toc.js +1 -1
  40. package/source/css/_common/highlight.styl +2 -0
  41. package/source/css/_custom.styl +2 -2
  42. package/source/css/_defines/theme.styl +0 -1
  43. package/source/css/_layout/md.styl +10 -7
  44. package/source/css/_layout/partial/bread-nav.styl +32 -0
  45. package/source/css/_layout/partial/paginator.styl +7 -3
  46. package/source/css/_layout/tag-plugins/common.styl +30 -39
  47. package/source/css/_layout/tag-plugins/folding.styl +1 -1
  48. package/source/css/_layout/tag-plugins/hashtag.styl +17 -0
  49. package/source/css/_layout/tag-plugins/mark.styl +2 -5
  50. package/source/css/_layout/tag-plugins/note.styl +1 -1
  51. package/source/css/_layout/tag-plugins/okr.styl +106 -0
  52. package/source/css/_plugins/mermaid.styl +125 -10
  53. package/source/js/main.js +1 -1
  54. package/source/js/plugins/copycode.js +1 -3
  55. package/source/js/plugins/linkcard.js +1 -1
  56. package/scripts/tags/lib/tag.js +0 -35
  57. package/source/css/_layout/tag-plugins/tag.styl +0 -13
@@ -0,0 +1,140 @@
1
+ /**
2
+ * okr.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ *
4
+ * {% okr o1 percent:0.5 status:delay %}
5
+ * title (only one line)
6
+ * note
7
+ * <!-- okr kr1 percent:1 -->
8
+ * title (only one line)
9
+ * note
10
+ * {% endokr %}
11
+ *
12
+ */
13
+
14
+ 'use strict'
15
+
16
+ function splitContentAndNote(input) {
17
+ var arr = input.trim().split('\n').filter(item => item.trim().length > 0)
18
+ if (arr.length == 0) {
19
+ return {title:'', note:''}
20
+ }
21
+ const title = arr.shift()
22
+ const note = arr.join('\n')
23
+ return {title:title, note:note}
24
+ }
25
+
26
+ function generateKRList(ctx, contentArray) {
27
+ if (contentArray.length < 3) {
28
+ console.error('invalid okr tag:', contentArray);
29
+ return []
30
+ }
31
+ var result = []
32
+ var krTagIndexes = []
33
+ for (let index = 0; index < contentArray.length; index++) {
34
+ const element = contentArray[index];
35
+ if (element.startsWith('kr')) {
36
+ krTagIndexes.push(index)
37
+ }
38
+ }
39
+ for (let index of krTagIndexes) {
40
+ if (index >= contentArray.length) {
41
+ break
42
+ }
43
+ const tagStr = contentArray[index]
44
+ const contentStr = contentArray[index+1]
45
+ if (contentStr.startsWith('kr')) {
46
+ continue
47
+ }
48
+ result.push({
49
+ krMeta: ctx.args.map(tagStr.split(/\s+/), ['percent', 'status'], 'krIndex'),
50
+ krBody: splitContentAndNote(contentStr)
51
+ })
52
+ }
53
+ return result
54
+ }
55
+
56
+ function layoutItem(ctx, type, index, title, note, color, label, percent) {
57
+ const percentStr = (percent * 100).toString().replace(/\.\d*/, '')
58
+ return `
59
+ <div class="okr-item ${type}">
60
+ <div class="okr-left">
61
+ <span class="title">${index.toUpperCase()}</span>
62
+ </div>
63
+ <div class="okr-center">
64
+ <span class="title">${title}</span>
65
+ <div class="note">${ctx.render.renderSync({text: note, engine: 'markdown'}).split('\n').join('')}</div>
66
+ </div>
67
+ <div class="okr-right colorful" color="${color}">
68
+ <div class="labels">
69
+ <span class="status label">${label}</span>
70
+ <span class="status percent">${percentStr}%</span>
71
+ </div>
72
+ <div class="progress">
73
+ <div class="fill" style="width:${percentStr}%;"></div>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ `
78
+ }
79
+
80
+ module.exports = ctx => function(args, content = '') {
81
+ args = ctx.args.map(args, ['percent', 'status', 'color'], 'oIndex')
82
+ var contentArray = content.split(/<!--\s*okr (.*?)\s*-->/g).filter(item => item.trim().length > 0)
83
+ if (contentArray.length < 3) {
84
+ console.error('invalid okr tag:', contentArray);
85
+ return ''
86
+ }
87
+ const statusList = ctx.theme.config.tag_plugins.okr.status
88
+ const oMeta = args
89
+ const oBody = splitContentAndNote(contentArray.shift())
90
+ const krList = generateKRList(ctx, contentArray)
91
+
92
+ var el_krs = ''
93
+ var krPercentList = []
94
+ for (let kr of krList) {
95
+ const { krMeta, krBody } = kr
96
+ const krPercent = Number(krMeta.percent) || 0
97
+ if (krMeta == null || krBody == null) {
98
+ continue
99
+ }
100
+ var status = null
101
+ if (krMeta.status && statusList[krMeta.status]) {
102
+ status = statusList[krMeta.status]
103
+ }
104
+ if (status == null) {
105
+ if (krPercent >= 1) {
106
+ status = statusList['finished']
107
+ } else {
108
+ status = statusList['in_track']
109
+ }
110
+ }
111
+ krPercentList.push(krPercent)
112
+ el_krs += layoutItem(ctx, 'kr', krMeta.krIndex, krBody.title, krBody.note, status.color, status.label, krPercent)
113
+ }
114
+ const krPercentSum = krPercentList.reduce(
115
+ (accumulator, currentValue) => accumulator + currentValue,
116
+ 0,
117
+ );
118
+
119
+ const oPercent = Number(oMeta.percent) || (krPercentSum / krPercentList.length).toFixed(2)
120
+ var status = null
121
+ if (args.status != null && args.status && statusList[args.status]) {
122
+ status = statusList[args.status]
123
+ }
124
+ if (status == null) {
125
+ if (oPercent >= 1) {
126
+ status = statusList['finished']
127
+ } else {
128
+ status = statusList['in_track']
129
+ }
130
+ }
131
+
132
+ var el = ''
133
+ el += '<div class="tag-plugin colorful okr"'
134
+ el += ' ' + ctx.args.joinTags(args, ['color']).join(' ')
135
+ el += '>'
136
+ el += layoutItem(ctx, 'o', oMeta.oIndex, oBody.title, oBody.note, status.color, status.label, oPercent)
137
+ el += el_krs
138
+ el += '</div>'
139
+ return el
140
+ }
@@ -43,7 +43,7 @@ module.exports = ctx => function(args) {
43
43
  el += '</summary>'
44
44
 
45
45
  if (args.wiki) {
46
- const proj = ctx.theme.config.wiki.projects[args.wiki]
46
+ const proj = ctx.theme.config.wiki.tree[args.wiki]
47
47
  if (proj == undefined) {
48
48
  return ''
49
49
  }
@@ -171,6 +171,8 @@ table:not([class])
171
171
  content: "Go"
172
172
  &.typescript .code:before,&.ts .code:before
173
173
  content: "TS"
174
+ &.matlab .code:before
175
+ content: "MATLAB"
174
176
 
175
177
 
176
178
 
@@ -44,8 +44,8 @@ $fs-14 = .875rem
44
44
  $fs-13 = .8125rem
45
45
  $fs-12 = .75rem
46
46
 
47
- $fs-h1 = 1.75rem // 32px
48
- $fs-h2 = 1.5rem // 24px
47
+ $fs-h1 = 2rem // 32px
48
+ $fs-h2 = 1.75rem // 28px
49
49
  $fs-h3 = 1.375rem // 22px
50
50
  $fs-h4 = 1.125rem // 18px
51
51
  $fs-h5 = $fs-15
@@ -39,7 +39,6 @@ set_text_light()
39
39
  --block-border: hsl($color-block-h, $color-block-s, 90)
40
40
  --block-hover: hsl($color-block-h, $color-block-s, 92)
41
41
  set_text_dark()
42
- --theme-bg2: $color-theme
43
42
  --theme-link: $color-link
44
43
 
45
44
  set_darkmode()
@@ -47,6 +47,11 @@ h1.article-title
47
47
  &:hover
48
48
  a.headerlink:before
49
49
  opacity: 1
50
+ blockquote, .tag-plugin
51
+ h2,h3,h4,h5,h6
52
+ margin-top: 0.25em
53
+ margin-bottom: 0.25em
54
+ padding-top: 0
50
55
 
51
56
  .md-text.content:first-child
52
57
  padding-top: 0
@@ -82,7 +87,7 @@ h1.article-title
82
87
  opacity: 0
83
88
  content: '#'
84
89
  position: absolute
85
- margin-left: -0.75em
90
+ margin-left: -0.6em
86
91
  h2
87
92
  margin-top: 2rem
88
93
  border-bottom: 1px solid var(--block-border)
@@ -139,7 +144,10 @@ h1.article-title
139
144
  left: 0
140
145
  right: 0
141
146
  height: 1px
142
- opacity: 0.8
147
+ if hexo-config('style.link.underline') == true
148
+ opacity: 0.8
149
+ else
150
+ opacity: 0
143
151
  background: var(--theme-link)
144
152
  trans1: all
145
153
  &:hover
@@ -153,8 +161,3 @@ h1.article-title
153
161
  bottom: 0
154
162
  left: -2px
155
163
  right: -2px
156
- .md-text li:not([class]) a:not([class]):before, .md-text p:not([class]) a:not([class]):before
157
- background unset !important
158
-
159
- .md-text li:not([class]) a:not([class]):hover:before, .md-text p:not([class]) a:not([class]):hover:before
160
- background var(--theme-link) !important
@@ -3,6 +3,8 @@
3
3
  padding: 0.25rem 1rem 0
4
4
  color: var(--text-p3)
5
5
  font-weight: 500
6
+ display: flex
7
+ justify-content: space-between
6
8
  div#breadcrumb
7
9
  display: flex
8
10
  align-items: center
@@ -17,3 +19,33 @@
17
19
  color: $color-hover
18
20
  div#post-meta
19
21
  margin-top: 2px
22
+ span+span
23
+ margin-left: 8px
24
+ visibility: hidden
25
+ &:hover
26
+ div#post-meta
27
+ span+span
28
+ visibility: visible
29
+
30
+ .bread-nav .ghrepo
31
+ font-size: $fs-13
32
+ display: flex
33
+ flex-direction: column
34
+ align-items: flex-start
35
+ border-left: 1px solid var(--text-meta)
36
+ padding-left: 8px
37
+ a
38
+ display: flex
39
+ align-items: center
40
+ color: var(--text-p2)
41
+ svg
42
+ margin-right: 4px
43
+ &.bold
44
+ font-weight: 600
45
+ color: var(--text-p1)
46
+ span
47
+ margin-left: 4px
48
+ &:hover
49
+ color: var(--theme-link)
50
+ a+a
51
+ margin-top: 8px
@@ -9,11 +9,16 @@
9
9
  border-radius: $border-card
10
10
  overflow: hidden
11
11
  box-shadow: 0 2px 8px 0px rgba(0, 0, 0, 0.03)
12
+ color: var(--text-p3)
12
13
  .page-number
13
14
  padding: 4px 8px
14
15
  border-radius: 8px
15
- background: var(--block)
16
16
  margin: 2px
17
+ a.page-number
18
+ color: var(--text-p3)
19
+ &:hover
20
+ color: var(--text-p1)
21
+ background: var(--block)
17
22
  .extend
18
23
  text-align: center
19
24
  background-size: contain
@@ -29,9 +34,8 @@
29
34
  background-image: url('https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/arrow/f049bbd4e88ec.svg')
30
35
  .current
31
36
  font-family: $ff-code
32
- color: var(--text-p3)
37
+ background: var(--block)
33
38
  .extend
34
- color: var(--text-p3)
35
39
  padding: 1rem
36
40
  line-height: 0
37
41
  filter: grayscale(100%)
@@ -13,8 +13,7 @@ set_text_black()
13
13
 
14
14
  set_dynamic_color($theme)
15
15
  --theme: $theme
16
- --theme-bg1: hsl(hue($theme), 90, 90)
17
- --theme-bg2: hsl(hue($theme), 80, 95)
16
+ --theme-block: hsl(hue($theme), 90, 92)
18
17
  --theme-border: hsl(hue($theme), 50, 80)
19
18
  --text-p0: hsl(hue($theme), 55, 16)
20
19
  --text-p1: hsl(hue($theme), 55, 20)
@@ -23,87 +22,79 @@ set_dynamic_color($theme)
23
22
  .tag-plugin
24
23
  --theme: var(--text-p1)
25
24
  --theme-border: var(--block-border)
26
- --theme-bg1: hsl(hue($color-theme), 90, 90)
27
- --theme-bg2: var(--block)
28
- &.tag
29
- --text-p2: hsl(hue($color-theme), 90, 24)
25
+ --theme-block: var(--block)
30
26
 
31
- .tag-plugin[color='red']
27
+ .colorful[color='red']
32
28
  set_dynamic_color($c-red)
33
- .tag-plugin[color='orange']
29
+ .colorful[color='orange']
34
30
  set_dynamic_color($c-orange)
35
- .tag-plugin[color='yellow']
31
+ .colorful[color='yellow']
36
32
  set_dynamic_color($c-yellow)
37
- .tag-plugin[color='green']
33
+ .colorful[color='green']
38
34
  set_dynamic_color($c-green)
39
- .tag-plugin[color='cyan']
35
+ .colorful[color='cyan']
40
36
  set_dynamic_color($c-cyan)
41
- .tag-plugin[color='blue']
37
+ .colorful[color='blue']
42
38
  set_dynamic_color($c-blue)
43
- .tag-plugin[color='purple']
39
+ .colorful[color='purple']
44
40
  set_dynamic_color($c-purple)
45
41
 
46
- .tag-plugin[color='light']
47
- --theme-bg1: hsl(0 0 88%)
48
- --theme-bg2: white
42
+ .colorful[color='light']
43
+ --theme-block: white
49
44
  set_text_black()
50
45
 
51
- .tag-plugin[color='dark']
52
- --theme-bg1: hsl(0 0 12%)
53
- --theme-bg2: #333
46
+ .colorful[color='dark']
47
+ --theme-block: #333
54
48
  set_text_white()
55
49
 
56
- .tag-plugin[color='warning']
50
+ .colorful[color='warning']
57
51
  --theme: $c-yellow
58
52
  --theme-border: #ffe659
59
- --theme-bg2: #ffe659
53
+ --theme-block: #ffe659
60
54
  --theme-link: #ff453a
61
55
 
62
- .tag-plugin[color='error']
56
+ .colorful[color='error']
63
57
  --theme: $c-yellow
64
58
  --theme-border: #ff453a
65
- --theme-bg2: #ff453a
59
+ --theme-block: #ff453a
66
60
  --theme-link: #ffe659
67
61
  set_text_white()
68
62
 
69
63
  set_darkmode_tags()
70
64
  set_dynamic_color($theme)
71
65
  --theme: $theme
72
- --theme-bg1: hsl(hue($theme), 50, 16)
73
- --theme-bg2: hsl(hue($theme), 16, 16)
66
+ --theme-block: hsl(hue($theme), 16, 16)
74
67
  --theme-border: hsl(hue($theme), 50, 24)
75
68
  --text-p0: hsl(hue($theme), 100, 85)
76
69
  --text-p1: hsl(hue($theme), 50, 75)
77
70
  --text-p2: hsl(hue($theme), 80, 72)
78
71
  .tag-plugin.tag
79
72
  set_dynamic_color($color-theme)
80
- .tag-plugin[color='red']
73
+ .colorful[color='red']
81
74
  set_dynamic_color($c-red)
82
- .tag-plugin[color='orange']
75
+ .colorful[color='orange']
83
76
  set_dynamic_color($c-orange)
84
- .tag-plugin[color='yellow']
77
+ .colorful[color='yellow']
85
78
  set_dynamic_color($c-yellow)
86
- .tag-plugin[color='green']
79
+ .colorful[color='green']
87
80
  set_dynamic_color($c-green)
88
- .tag-plugin[color='cyan']
81
+ .colorful[color='cyan']
89
82
  set_dynamic_color($c-cyan)
90
- .tag-plugin[color='blue']
83
+ .colorful[color='blue']
91
84
  set_dynamic_color($c-blue)
92
- .tag-plugin[color='purple']
85
+ .colorful[color='purple']
93
86
  set_dynamic_color($c-purple)
94
- .tag-plugin[color='light']
87
+ .colorful[color='light']
95
88
  --theme-border: white
96
- --theme-bg1: hsl(0 0 88%)
97
- --theme-bg2: #fff
89
+ --theme-block: #fff
98
90
  set_text_black()
99
91
 
100
- .tag-plugin[color='dark']
92
+ .colorful[color='dark']
101
93
  --theme-border: black
102
- --theme-bg1: hsl(0 0 12%)
103
- --theme-bg2: #111
94
+ --theme-block: #111
104
95
  set_text_white()
105
96
 
106
- .tag-plugin[color='warning'],.tag-plugin[color='light']
97
+ .colorful[color='warning'],.colorful[color='light']
107
98
  set_text_black()
108
99
 
109
100
  if hexo-config('style.darkmode') == 'auto'
@@ -3,7 +3,7 @@ details.folding
3
3
  padding: 1rem
4
4
  margin: 1rem 0
5
5
  border-radius: $border-block
6
- background: var(--theme-bg2)
6
+ background: var(--theme-block)
7
7
  border: 1px solid var(--theme-border)
8
8
  summary
9
9
  cursor: pointer
@@ -0,0 +1,17 @@
1
+ .md-text .tag-plugin.hashtag
2
+ padding: 0px 8px
3
+ border-radius: 100px
4
+ background: var(--theme-block)
5
+ color: var(--text-p2)
6
+ margin: 2px 0
7
+ display: inline-flex
8
+ align-items: center
9
+ font-size: $fs-13
10
+ font-weight: 500
11
+ trans2 background color
12
+ span
13
+ margin: 0 2px
14
+ &:hover
15
+ background: var(--text-p2)
16
+ color: var(--theme-block)
17
+
@@ -1,8 +1,5 @@
1
1
  .md-text .tag-plugin.mark
2
- padding: 0 1px
2
+ padding: 1px 2px
3
3
  border-radius: 2px
4
- background: var(--theme-bg2)
5
- border: 1px solid var(--theme-border)
4
+ background: var(--theme-block)
6
5
  color: var(--text-p0)
7
- &[color=dark]
8
- border-color: var(--theme-bg2)
@@ -2,7 +2,7 @@
2
2
  position: relative
3
3
  padding: 0.25rem 1rem
4
4
  border-radius: $border-block
5
- background: var(--theme-bg2)
5
+ background: var(--theme-block)
6
6
  overflow: hidden
7
7
  if hexo-config('tag_plugins.note.border') == true
8
8
  border: 1px solid var(--theme-border)
@@ -0,0 +1,106 @@
1
+ .md-text .tag-plugin.okr
2
+ position: relative
3
+ border-radius: $border-block
4
+ background: var(--theme-block)
5
+ border: 1px solid var(--theme-border)
6
+ if hexo-config('tag_plugins.okr.border') == true
7
+ border: 1px solid var(--theme-border)
8
+ overflow: hidden
9
+ color: var(--text-p1)
10
+ line-height: 1.5
11
+ .o
12
+ .title
13
+ font-size: $fs-15
14
+ .note
15
+ font-size: $fs-14
16
+ p
17
+ font-size: $fs-14
18
+ .kr
19
+ .title
20
+ font-size: $fs-14
21
+ .note
22
+ font-size: $fs-14
23
+ p,li,.tag-plugin
24
+ font-size: $fs-14
25
+
26
+ .title
27
+ font-weight: 600
28
+ display: block
29
+ .note
30
+ font-weight: 400
31
+ display: block
32
+ margin-top: 0.5rem
33
+ >p,>ul
34
+ margin-top: 0.25rem
35
+ margin-bottom: 0.25rem
36
+ >.tag-plugin
37
+ margin-top: 0.25rem
38
+ margin-bottom: 0.25rem
39
+ >*:last-child
40
+ margin-bottom: 0
41
+ .status
42
+ font-size: $fs-12
43
+ padding: 2px 4px
44
+ border-radius: 2px
45
+ .okr-item.o
46
+ border-bottom: 4px solid var(--theme-border)
47
+ .okr-item.kr+.okr-item.kr
48
+ border-top: 1px dashed var(--theme-border)
49
+
50
+
51
+ .tag-plugin.okr .okr-item
52
+ display: grid
53
+ grid-template-columns: 3.2rem auto 100px
54
+ grid-column-gap: 0.75rem
55
+ padding: 1rem
56
+ .okr-left .title
57
+ background: var(--card)
58
+ border-radius: 1rem
59
+ text-align: center
60
+ padding: 0 0.5rem
61
+ .labels
62
+ display: flex
63
+ justify-content: space-between
64
+ align-items: flex-start
65
+ position relative
66
+ .label
67
+ background: var(--theme-block)
68
+ color: var(--text-p1)
69
+
70
+ .progress
71
+ margin-top: 4px
72
+ height: 4px
73
+ border-radius: 2px
74
+ position: relative
75
+ background: var(--card)
76
+ .fill
77
+ position: absolute
78
+ background: var(--theme)
79
+ border-radius: 2px
80
+ top: 0
81
+ left: 0
82
+ bottom: 0
83
+ &:before
84
+ content: ''
85
+ position absolute
86
+ top: -4px
87
+ bottom: -4px
88
+ right: -4px
89
+ width: 8px
90
+ height: 12px
91
+ border-radius: 8px
92
+ background: white
93
+ box-shadow: $boxshadow-button
94
+ &:after
95
+ content: ''
96
+ position absolute
97
+ top: -2px
98
+ bottom: -2px
99
+ right: -2px
100
+ width: 4px
101
+ height: 8px
102
+ border-radius: 4px
103
+ background: var(--theme)
104
+
105
+
106
+