hexo-theme-stellar 1.18.0 → 1.18.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.
Files changed (87) hide show
  1. package/README.md +2 -2
  2. package/_config.yml +32 -34
  3. package/layout/404.ejs +1 -1
  4. package/layout/_partial/cover/wiki_cover.ejs +1 -1
  5. package/layout/_partial/plugins/comments/artalk/layout.ejs +19 -0
  6. package/layout/_partial/plugins/comments/artalk/script.ejs +25 -0
  7. package/layout/_partial/plugins/comments/layout.ejs +4 -4
  8. package/layout/_partial/scripts/index.ejs +1 -1
  9. package/layout/_partial/widgets/toc.ejs +1 -1
  10. package/package.json +1 -1
  11. package/scripts/tags/index.js +32 -6
  12. package/scripts/tags/inline-labels.js +27 -27
  13. package/scripts/tags/lib/ablock.js +33 -0
  14. package/scripts/tags/lib/about.js +48 -0
  15. package/scripts/tags/lib/checkbox.js +30 -0
  16. package/scripts/tags/{copy.js → lib/copy.js} +23 -23
  17. package/scripts/tags/lib/emoji.js +40 -0
  18. package/scripts/tags/{folders.js → lib/folders.js} +22 -22
  19. package/scripts/tags/lib/folding.js +30 -0
  20. package/scripts/tags/lib/frame.js +66 -0
  21. package/scripts/tags/lib/friends.js +53 -0
  22. package/scripts/tags/{ghcard.js → lib/ghcard.js} +18 -18
  23. package/scripts/tags/{grid.js → lib/grid.js} +20 -20
  24. package/scripts/tags/{image.js → lib/image.js} +38 -38
  25. package/scripts/tags/lib/link.js +78 -0
  26. package/scripts/tags/lib/mark.js +23 -0
  27. package/scripts/tags/lib/navbar.js +57 -0
  28. package/scripts/tags/lib/note.js +35 -0
  29. package/scripts/tags/lib/poetry.js +47 -0
  30. package/scripts/tags/{quot.js → lib/quot.js} +24 -24
  31. package/scripts/tags/lib/sites.js +57 -0
  32. package/scripts/tags/lib/swiper.js +36 -0
  33. package/scripts/tags/lib/tabs.js +33 -33
  34. package/scripts/tags/{tag.js → lib/tag.js} +13 -13
  35. package/scripts/tags/lib/timeline.js +78 -0
  36. package/scripts/tags/lib/toc.js +73 -0
  37. package/source/css/_common/base.styl +2 -2
  38. package/source/css/_common/blockquote.styl +2 -2
  39. package/source/css/_common/button.styl +38 -2
  40. package/source/css/_common/highlight.styl +11 -10
  41. package/source/css/_custom.styl +17 -8
  42. package/source/css/_defines/func.styl +1 -1
  43. package/source/css/_defines/theme.styl +5 -7
  44. package/source/css/_layout/list.styl +0 -1
  45. package/source/css/_layout/md.styl +15 -13
  46. package/source/css/_layout/pages/archives.styl +1 -1
  47. package/source/css/_layout/pages/error.styl +0 -1
  48. package/source/css/_layout/partial/related.styl +8 -6
  49. package/source/css/_layout/sidebar/header.styl +1 -1
  50. package/source/css/_layout/sidebar/sidebar.styl +2 -1
  51. package/source/css/_layout/tag-plugins/checkbox.styl +3 -4
  52. package/source/css/_layout/tag-plugins/common.styl +6 -6
  53. package/source/css/_layout/tag-plugins/copy.styl +1 -1
  54. package/source/css/_layout/tag-plugins/folders.styl +9 -9
  55. package/source/css/_layout/tag-plugins/folding.styl +5 -4
  56. package/source/css/_layout/tag-plugins/grid.styl +4 -1
  57. package/source/css/_layout/tag-plugins/link.styl +1 -1
  58. package/source/css/_layout/tag-plugins/note.styl +9 -10
  59. package/source/css/_layout/tag-plugins/quot.styl +6 -6
  60. package/source/css/_layout/tag-plugins/tabs.styl +2 -2
  61. package/source/css/_layout/tag-plugins/timeline.styl +1 -5
  62. package/source/css/_layout/tag-plugins/toc.styl +1 -1
  63. package/source/css/_layout/widgets/search.styl +28 -18
  64. package/source/css/_layout/widgets/toc_wiki.styl +1 -1
  65. package/source/css/_plugins/aplayer.styl +3 -0
  66. package/source/css/_plugins/comments/artalk.styl +4 -0
  67. package/source/css/_plugins/comments/utterances.styl +1 -1
  68. package/source/css/_plugins/index.styl +4 -0
  69. package/source/css/_plugins/swiper.styl +17 -7
  70. package/source/js/main.js +30 -6
  71. package/scripts/tags/ablock.js +0 -33
  72. package/scripts/tags/about.js +0 -48
  73. package/scripts/tags/checkbox.js +0 -38
  74. package/scripts/tags/emoji.js +0 -40
  75. package/scripts/tags/folding.js +0 -30
  76. package/scripts/tags/frame.js +0 -66
  77. package/scripts/tags/friends.js +0 -53
  78. package/scripts/tags/lib/users.js +0 -22
  79. package/scripts/tags/link.js +0 -79
  80. package/scripts/tags/mark.js +0 -23
  81. package/scripts/tags/navbar.js +0 -57
  82. package/scripts/tags/note.js +0 -35
  83. package/scripts/tags/poetry.js +0 -47
  84. package/scripts/tags/sites.js +0 -57
  85. package/scripts/tags/swiper.js +0 -38
  86. package/scripts/tags/timeline.js +0 -81
  87. package/scripts/tags/toc.js +0 -72
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Stellar 是一个内置文档系统的简约商务风 Hexo 主题,支持丰富的标签和动态数据组件,请配合 [文档](https://xaoxuu.com/wiki/stellar/) 使用。
4
4
 
5
- [![Star History Chart](https://api.star-history.com/svg?repos=xaoxuu/hexo-theme-stellar&type=Date)](https://star-history.com/#xaoxuu/hexo-theme-stellar&Date)
5
+ [![Stargazers over time](https://starchart.cc/xaoxuu/hexo-theme-stellar.svg)](https://starchart.cc/xaoxuu/hexo-theme-stellar)
6
6
 
7
7
 
8
8
  ## Getting Started
@@ -12,7 +12,7 @@ Check your environment:
12
12
  ```yaml
13
13
  Hexo: 5.4.0 ~ 6.3.0
14
14
  hexo-cli: 4.3.0 ~ latest
15
- node.js: 14.17.3 18.12.0
15
+ node.js: 14.17.3 ~ 18.12.0
16
16
  npm: 6.14.13 ~ 8.19.2
17
17
  ```
18
18
 
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.18.0'
3
+ version: '1.18.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
@@ -84,7 +84,7 @@ search:
84
84
 
85
85
  ######## Comments ########
86
86
  comments:
87
- service: # beaudar, utterances, twikoo, waline
87
+ service: # beaudar, utterances, giscus, twikoo, waline, artalk
88
88
  # beaudar
89
89
  # https://beaudar.lipk.org/
90
90
  beaudar:
@@ -128,22 +128,18 @@ comments:
128
128
  twikoo:
129
129
  js: https://fastly.jsdelivr.net/npm/twikoo@1.4.0/dist/twikoo.all.min.js # 建议锁定版本
130
130
  envId: https://xxx # vercel函数
131
+
132
+ # Waline
133
+ # https://waline.js.org/
131
134
  waline:
132
135
  js: https://unpkg.com/@waline/client@v2/dist/waline.js
133
136
  css: https://unpkg.com/@waline/client@v2/dist/waline.css
134
137
  # Waline server address url, you should set this to your own link
135
138
  serverURL:
136
-
137
139
  # If false, comment count will only be displayed in post page, not in home page
138
140
  commentCount: true
139
-
140
141
  # Pageviews count, Note: You should not enable both `waline.pageview` and `leancloud_visitors`.
141
142
  pageview: false
142
-
143
- # Custom locales
144
- # locale:
145
- # placeholder: Welcome to comment # Comment box placeholder
146
-
147
143
  # Custom emoji
148
144
  # emoji:
149
145
  # - https://unpkg.com/@waline/emojis@1.1.0/weibo
@@ -153,28 +149,16 @@ comments:
153
149
  # - https://unpkg.com/@waline/emojis@1.1.0/tieba
154
150
  # - https://unpkg.com/@waline/emojis@1.1.0/tw-emoji
155
151
  # - https://unpkg.com/@waline/emojis@1.1.0/bmoji
152
+
153
+ # Artalk
154
+ # https://artalk.js.org/
155
+ artalk:
156
+ css: https://unpkg.com/artalk@2.4.3/dist/Artalk.css
157
+ js: https://unpkg.com/artalk@2.4.3/dist/Artalk.js
158
+ server: # 后端服务地址
159
+ placeholder: ''
160
+ darkMode: auto
156
161
 
157
- # Comment infomation, valid meta are nick, mail and link
158
- # meta:
159
- # - nick
160
- # - mail
161
- # - link
162
-
163
- # Set required meta field, e.g.: [nick] | [nick, mail]
164
- # requiredMeta:
165
- # - nick
166
-
167
- # Language, available values: en-US, zh-CN, zh-TW, pt-BR, ru-RU, jp-JP
168
- # lang: zh-CN
169
-
170
- # Word limit, no limit when setting to 0
171
- # wordLimit: 0
172
-
173
- # Whether enable login, can choose from 'enable', 'disable' and 'force'
174
- # login: enable
175
-
176
- # comment per page
177
- # pageSize: 10
178
162
 
179
163
  ######## Footer ########
180
164
  footer:
@@ -213,9 +197,10 @@ footer:
213
197
 
214
198
  ######## Tag Plugins ########
215
199
  tag_plugins:
216
- # {% note text %}
200
+ # {% ablock %} / {% note %}
217
201
  note:
218
202
  default_color: '' # light, dark, red, orange, yellow, green, cyan, blue, purple, warning, error
203
+ border: true # true / false
219
204
  # {% checkbox %}
220
205
  checkbox:
221
206
  interactive: false # enable interactive for user
@@ -304,8 +289,8 @@ plugins:
304
289
  # swiper
305
290
  swiper:
306
291
  enable: true
307
- css: https://unpkg.com/swiper@6/swiper-bundle.min.css
308
- js: https://unpkg.com/swiper@6/swiper-bundle.min.js
292
+ css: https://unpkg.com/swiper@8/swiper-bundle.min.css
293
+ js: https://unpkg.com/swiper@8/swiper-bundle.min.js
309
294
 
310
295
 
311
296
  # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强
@@ -335,12 +320,22 @@ plugins:
335
320
  style:
336
321
  darkmode: auto # auto / always / false
337
322
  smooth_scroll: true # true / false
338
- font-size: 16px
323
+ font-size:
324
+ root: 16px
325
+ body: .9375rem # 15px
326
+ code: 85% # 14px
327
+ codeblock: 0.8125rem # 13px
339
328
  font-family:
340
329
  logo: 'system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif'
341
330
  body: 'system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif'
342
331
  code: 'Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif'
332
+ codeblock: 'Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif'
343
333
  text-align: left
334
+ border-radius:
335
+ card: 12px
336
+ block: 12px
337
+ bar: 6px
338
+ image: 6px
344
339
  color:
345
340
  # 动态颜色(会根据明暗主题重设明度值,只用关心色相和饱和度即可)
346
341
  background: 'hsl(212 16% 98%)' # 浅色背景颜色
@@ -362,6 +357,9 @@ style:
362
357
  loading:
363
358
  loading: 正在加载
364
359
  error: 加载失败,请稍后重试。
360
+ gradient: # https://webgradients.com/
361
+ start: 'linear-gradient(to right, #92fe9d 0%, #00c9ff 50%, #92fe9d 100%)'
362
+ search: 'linear-gradient(to right, #04F3FF, #08FFC6, #DDF730, #FFBD19, #FF1FE0, #C418FF, #04F3FF)'
365
363
 
366
364
  default:
367
365
  avatar: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
package/layout/404.ejs CHANGED
@@ -16,6 +16,6 @@ page.robots = 'none';
16
16
  <%- __('page.error.why') %>
17
17
  </p>
18
18
  <br><br>
19
- <a class='button theme' id='back' href="<%- config.root %>"><%- __('page.error.action') %></a>
19
+ <a class='button' id='back' href="<%- config.root %>"><%- __('page.error.action') %></a>
20
20
  </article>
21
21
  <%- partial('_partial/plugins/comments/layout') %>
@@ -39,7 +39,7 @@ function layoutWikiCover() {
39
39
  el += '<div class="description">' + desc + '</div>';
40
40
  }
41
41
  el += '<div class="start-wrap">';
42
- el += '<a class="button theme start" href="#start">' + (proj.start || __('btn.getting_started')) + '</a>';
42
+ el += '<a class="button start gradient" href="#start">' + (proj.start || __('btn.getting_started')) + '</a>';
43
43
  el += '</div>';
44
44
  el += '</article>';
45
45
  el += '</div>';
@@ -0,0 +1,19 @@
1
+ <%
2
+ function layoutDiv() {
3
+ var el = '';
4
+ el += '<div id="artalk_container"';
5
+ let cfg = {};
6
+ if (page.comment_id) {
7
+ cfg['comment_id'] = page.comment_id;
8
+ }
9
+ for (let key of Object.keys(cfg)) {
10
+ if (cfg[key]) {
11
+ el += ' ' + key + '="' + cfg[key] + '"';
12
+ }
13
+ }
14
+ el += '><svg class="loading" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2709"><path d="M832 512c0-176-144-320-320-320V128c211.2 0 384 172.8 384 384h-64zM192 512c0 176 144 320 320 320v64C300.8 896 128 723.2 128 512h64z" p-id="2710"></path></svg></div>';
15
+ return el;
16
+ }
17
+ %>
18
+
19
+ <%- layoutDiv() %>
@@ -0,0 +1,25 @@
1
+ <script>
2
+ function load_artalk() {
3
+ if (!document.querySelectorAll("#artalk_container")[0]) return;
4
+ stellar.loadCSS('<%- theme.comments.artalk.css %>');
5
+ stellar.loadScript('<%- theme.comments.artalk.js %>', {defer: true}).then(function () {
6
+ const el = document.getElementById("artalk_container");
7
+ var path = el.getAttribute('comment_id');
8
+ if (!path) {
9
+ path = decodeURI(window.location.pathname);
10
+ }
11
+ var artalk = new Artalk({
12
+ el: '#artalk_container',
13
+ pageKey: path,
14
+ pageTitle: '<%= page.title || page.seo_title %>',
15
+ server: '<%= theme.comments.artalk.server %>',
16
+ placeholder: '<%= theme.comments.artalk.placeholder %>',
17
+ site: '<%= config.title %>',
18
+ darkMode: '<%= theme.comments.artalk.darkMode %>'
19
+ })
20
+ });
21
+ }
22
+ window.addEventListener('DOMContentLoaded', (event) => {
23
+ load_artalk();
24
+ });
25
+ </script>
@@ -32,11 +32,11 @@ page.cmt = cmt;
32
32
  %>
33
33
  <% if (loadComment) { %>
34
34
  <div class='related-wrap md-text reveal' id="comments">
35
- <div class='cmt-title cap theme'>
35
+ <section class='header cmt-title cap theme'>
36
36
  <%- page.comment_title != undefined ? markdown(page.comment_title) : __('meta.comment_title') %>
37
- </div>
38
- <div class='cmt-body <%- cmt.service %>'>
37
+ </section>
38
+ <section class='body cmt-body <%- cmt.service %>'>
39
39
  <%- partial(cmt.service + '/layout') %>
40
- </div>
40
+ </section>
41
41
  </div>
42
42
  <% } %>
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- stellar = {
2
+ const stellar = {
3
3
  // 懒加载 css https://github.com/filamentgroup/loadCSS
4
4
  loadCSS: (href, before, media, attributes) => {
5
5
  var doc = window.document;
@@ -63,7 +63,7 @@ function layoutDiv(fallback) {
63
63
 
64
64
  var el = '';
65
65
  if (type.length > 0) {
66
- el += '<widget class="widget-wrapper toc ' + type + '" id="toc">';
66
+ el += '<widget class="widget-wrapper toc ' + type + '" id="data-toc">';
67
67
  if (page.layout !== 'wiki') {
68
68
  // post 布局
69
69
  el += layoutTocHeader(page.toc_title);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.18.0",
3
+ "version": "1.18.2",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -2,10 +2,36 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- const postTabs = require('./lib/tabs')(hexo);
6
- hexo.extend.tag.register('tabs', postTabs, true);
7
- hexo.extend.tag.register('subtabs', postTabs, true);
8
- hexo.extend.tag.register('subsubtabs', postTabs, true);
5
+ // container
6
+ hexo.extend.tag.register('tabs', require('./lib/tabs')(hexo), true)
7
+ hexo.extend.tag.register('ablock', require('./lib/ablock')(hexo), true)
8
+ hexo.extend.tag.register('about', require('./lib/about')(hexo), true)
9
+ hexo.extend.tag.register('folding', require('./lib/folding')(hexo), true)
10
+ hexo.extend.tag.register('folders', require('./lib/folders')(hexo), true)
11
+ hexo.extend.tag.register('grid', require('./lib/grid')(hexo), true)
12
+ hexo.extend.tag.register('swiper', require('./lib/swiper')(hexo), true)
9
13
 
10
- const users = require('./lib/users')(hexo);
11
- hexo.extend.tag.register('users', users);
14
+ // data
15
+ hexo.extend.tag.register('users', require('./lib/friends')(hexo))
16
+ hexo.extend.tag.register('friends', require('./lib/friends')(hexo))
17
+ hexo.extend.tag.register('sites', require('./lib/sites')(hexo))
18
+ hexo.extend.tag.register('ghcard', require('./lib/ghcard')(hexo))
19
+ hexo.extend.tag.register('toc', require('./lib/toc')(hexo))
20
+ hexo.extend.tag.register('timeline', require('./lib/timeline')(hexo), {ends: true})
21
+
22
+ // express
23
+ hexo.extend.tag.register('checkbox', require('./lib/checkbox')(hexo, 'checkbox'))
24
+ hexo.extend.tag.register('radio', require('./lib/checkbox')(hexo, 'radio'))
25
+ hexo.extend.tag.register('copy', require('./lib/copy')(hexo))
26
+ hexo.extend.tag.register('emoji', require('./lib/emoji')(hexo))
27
+ hexo.extend.tag.register('frame', require('./lib/frame')(hexo))
28
+ hexo.extend.tag.register('image', require('./lib/image')(hexo))
29
+ hexo.extend.tag.register('link', require('./lib/link')(hexo))
30
+ hexo.extend.tag.register('mark', require('./lib/mark')(hexo))
31
+ hexo.extend.tag.register('navbar', require('./lib/navbar')(hexo))
32
+ hexo.extend.tag.register('note', require('./lib/note')(hexo))
33
+ hexo.extend.tag.register('poetry', require('./lib/poetry')(hexo), true)
34
+ hexo.extend.tag.register('quot', require('./lib/quot')(hexo))
35
+ hexo.extend.tag.register('tag', require('./lib/tag')(hexo))
36
+
37
+ // others
@@ -5,40 +5,40 @@
5
5
  * {% psw 这是密码 %}
6
6
  */
7
7
 
8
- 'use strict';
8
+ 'use strict'
9
9
 
10
10
 
11
11
  hexo.extend.tag.register('u', function(args) {
12
- return `<u>${args.join(' ')}</u>`;
13
- });
12
+ return `<u>${args.join(' ')}</u>`
13
+ })
14
14
  hexo.extend.tag.register('emp', function(args) {
15
- return `<emp>${args.join(' ')}</emp>`;
16
- });
15
+ return `<emp>${args.join(' ')}</emp>`
16
+ })
17
17
  hexo.extend.tag.register('wavy', function(args) {
18
- return `<wavy>${args.join(' ')}</wavy>`;
19
- });
18
+ return `<wavy>${args.join(' ')}</wavy>`
19
+ })
20
20
  hexo.extend.tag.register('del', function(args) {
21
- return `<del>${args.join(' ')}</del>`;
22
- });
21
+ return `<del>${args.join(' ')}</del>`
22
+ })
23
23
  hexo.extend.tag.register('kbd', function(args) {
24
- return `<kbd>${args.join(' ')}</kbd>`;
25
- });
24
+ return `<kbd>${args.join(' ')}</kbd>`
25
+ })
26
26
  hexo.extend.tag.register('psw', function(args) {
27
- return `<psw>${args.join(' ')}</psw>`;
28
- });
27
+ return `<psw>${args.join(' ')}</psw>`
28
+ })
29
29
  hexo.extend.tag.register('sup', function(args) {
30
- args = hexo.args.map(args, ['color'], ['text']);
31
- var el = '';
32
- el += '<sup class="tag-plugin sup"' + ' ' + hexo.args.joinTags(args, ['color']).join(' ') + '>';
33
- el += args.text;
34
- el += '</sup>';
35
- return el;
36
- });
30
+ args = hexo.args.map(args, ['color'], ['text'])
31
+ var el = ''
32
+ el += '<sup class="tag-plugin sup"' + ' ' + hexo.args.joinTags(args, ['color']).join(' ') + '>'
33
+ el += args.text
34
+ el += '</sup>'
35
+ return el
36
+ })
37
37
  hexo.extend.tag.register('sub', function(args) {
38
- args = hexo.args.map(args, ['color'], ['text']);
39
- var el = '';
40
- el += '<sub class="tag-plugin sub"' + ' ' + hexo.args.joinTags(args, ['color']).join(' ') + '>';
41
- el += args.text;
42
- el += '</sub>';
43
- return el;
44
- });
38
+ args = hexo.args.map(args, ['color'], ['text'])
39
+ var el = ''
40
+ el += '<sub class="tag-plugin sub"' + ' ' + hexo.args.joinTags(args, ['color']).join(' ') + '>'
41
+ el += args.text
42
+ el += '</sub>'
43
+ return el
44
+ })
@@ -0,0 +1,33 @@
1
+ /**
2
+ * ablock.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% ablock [color:color] [child:codeblock/tabs] title %}
6
+ * body
7
+ * {% endablock %}
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ module.exports = ctx => function(args, content) {
13
+ args = ctx.args.map(args, ['color', 'child'], ['title'])
14
+ const { title } = args
15
+ if (args.color == null) {
16
+ args.color = ctx.theme.config.tag_plugins.note.default_color
17
+ }
18
+ var el = ''
19
+ // header
20
+ el += '<div class="tag-plugin note"'
21
+ el += ' ' + ctx.args.joinTags(args, ['color', 'child']).join(' ')
22
+ el += '>'
23
+ // title
24
+ if (title && title.length > 0) {
25
+ el += '<div class="title"><strong>' + title + '</strong></div>'
26
+ }
27
+ // content
28
+ el += '<div class="body">'
29
+ el += ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')
30
+ el += '</div></div>'
31
+
32
+ return el
33
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * about.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% about [avatar:xxx] [height:80px] %}
6
+ * title / body
7
+ * {% endabout %}
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ module.exports = ctx => function(args, content) {
13
+ const url_for = require('hexo-util').url_for.bind(ctx)
14
+ args = ctx.args.map(args, ['avatar', 'height', 'border', 'back'])
15
+ var rows = ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n')
16
+ var el = ''
17
+ // wrapper
18
+ el += '<div class="tag-plugin about">'
19
+ if (args.back) {
20
+ el += '<a class="nav-back cap" href="' + url_for(ctx.config.root) + '">'
21
+ el += '<svg aria-hidden="true" viewBox="0 0 16 16" 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>'
22
+ el += '</a>'
23
+ }
24
+ // avatar
25
+ var avatar_url = args.avatar
26
+ if (avatar_url) {
27
+ el += '<div class="about-header">'
28
+ el += '<div class="avatar">'
29
+ el += '<img src="' + avatar_url + '"'
30
+ if (args.border && args.border.length > 0) {
31
+ el += ' style="border-radius:' + args.border + '"'
32
+ }
33
+ if (args.height && args.height.length > 0) {
34
+ el += ' height="' + args.height + '"'
35
+ }
36
+ el += '/>'
37
+ el += '</div>'
38
+ el += '</div>'
39
+ }
40
+
41
+ // content
42
+ el += '<div class="about-body fs14">'
43
+ el += rows.join('')
44
+ el += '</div>'
45
+
46
+ el += '</div>'
47
+ return el
48
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * checkbox.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * radio.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
4
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
5
+ *
6
+ * {% checkbox [checked:false] [color:cyan] [symbol:plus/minus/times] text %}
7
+ * {% radio [checked:false] [color:cyan] text %}
8
+ */
9
+
10
+ 'use strict'
11
+
12
+ module.exports = (ctx, type) => function(args) {
13
+ args = ctx.args.map(args, ['color', 'checked', 'symbol'], ['text'])
14
+ var el = ''
15
+ // div
16
+ el += '<div class="tag-plugin checkbox"'
17
+ el += ' ' + ctx.args.joinTags(args, ['color', 'symbol']).join(' ')
18
+ el += '>'
19
+ // input
20
+ el += '<input type="' + (type || 'checkbox') + '"'
21
+ if (args.checked == 'true') {
22
+ el += ' checked="true"'
23
+ }
24
+ el += '/>'
25
+ // text
26
+ el += '<span>' + args.text + '</span>'
27
+ // div
28
+ el += '</div>'
29
+ return el
30
+ }
@@ -7,43 +7,43 @@
7
7
  *
8
8
  */
9
9
 
10
- 'use strict';
10
+ 'use strict'
11
11
 
12
- var copy_index = 0;
12
+ var copy_index = 0
13
13
 
14
- hexo.extend.tag.register('copy', function(args) {
15
- args = hexo.args.map(args, ['width', 'git'], ['text']);
14
+ module.exports = ctx => function(args) {
15
+ args = ctx.args.map(args, ['width', 'git'], ['text'])
16
16
  if (args == undefined || args.text == undefined) {
17
- return '';
17
+ return ''
18
18
  }
19
- var text = args.text;
19
+ var text = args.text
20
20
  if (args.git) {
21
21
  if (text.substr(0,1) == '/') {
22
- text = text.substring(1);
22
+ text = text.substring(1)
23
23
  }
24
24
  if (args.git == 'ssh') {
25
- text = 'git@github.com:' + text + '.git';
25
+ text = 'git@github.com:' + text + '.git'
26
26
  } else if (args.git == 'gh') {
27
- text = 'gh repo clone ' + text;
27
+ text = 'gh repo clone ' + text
28
28
  } else {
29
- text = 'https://github.com/' + text + '.git';
29
+ text = 'https://github.com/' + text + '.git'
30
30
  }
31
31
  }
32
32
 
33
- const copy_id = 'copy_' + ++copy_index;
33
+ const copy_id = 'copy_' + ++copy_index
34
34
 
35
- var el = '';
36
- el += '<div class="tag-plugin copy"';
35
+ var el = ''
36
+ el += '<div class="tag-plugin copy"'
37
37
  if (args.width) {
38
- el += ' width="' + args.width + '"';
38
+ el += ' width="' + args.width + '"'
39
39
  }
40
- el += '>';
41
- el += '<input class="copy-area" readonly id="' + copy_id + '"';
42
- el += ' value="' + text + '">';
43
- el += '<button class="copy-btn" onclick="util.copy(&quot;' + copy_id + '&quot;,&quot;Copied!&quot;)">';
44
- el += '<svg class="icon copy-btn" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M5.75 1a.75.75 0 00-.75.75v3c0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75v-3a.75.75 0 00-.75-.75h-4.5zm.75 3V2.5h3V4h-3zm-2.874-.467a.75.75 0 00-.752-1.298A1.75 1.75 0 002 3.75v9.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 13.25v-9.5a1.75 1.75 0 00-.874-1.515.75.75 0 10-.752 1.298.25.25 0 01.126.217v9.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-9.5a.25.25 0 01.126-.217z"></path></svg>';
45
- el += '</button>';
40
+ el += '>'
41
+ el += '<input class="copy-area" readonly id="' + copy_id + '"'
42
+ el += ' value="' + text + '">'
43
+ el += '<button class="copy-btn" onclick="util.copy(&quot' + copy_id + '&quot,&quotCopied!&quot)">'
44
+ el += '<svg class="icon copy-btn" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M5.75 1a.75.75 0 00-.75.75v3c0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75v-3a.75.75 0 00-.75-.75h-4.5zm.75 3V2.5h3V4h-3zm-2.874-.467a.75.75 0 00-.752-1.298A1.75 1.75 0 002 3.75v9.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 13.25v-9.5a1.75 1.75 0 00-.874-1.515.75.75 0 10-.752 1.298.25.25 0 01.126.217v9.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-9.5a.25.25 0 01.126-.217z"></path></svg>'
45
+ el += '</button>'
46
46
 
47
- el += '</div>';
48
- return el;
49
- });
47
+ el += '</div>'
48
+ return el
49
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * emoji.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% emoji [source] name [height:1.75em] %}
6
+ *
7
+ */
8
+
9
+ 'use strict'
10
+
11
+ module.exports = ctx => function(args) {
12
+ const config = ctx.theme.config.tag_plugins.emoji
13
+ args = ctx.args.map(args, ['height'], ['source', 'name'])
14
+ var el = ''
15
+ if (args.source == undefined) {
16
+ return el
17
+ }
18
+ el += '<span class="tag-plugin emoji">'
19
+ if (args.name == undefined) {
20
+ // 省略了 source
21
+ for (let id in config) {
22
+ if (config[id]) {
23
+ args.name = args.source
24
+ args.source = id
25
+ break
26
+ }
27
+ }
28
+ }
29
+ if (config[args.source] && args.name) {
30
+ let url = config[args.source].replace('%s', args.name)
31
+ el += '<img no-lazy="" class="inline"'
32
+ el += ' src="' + url + '"'
33
+ if (args.height) {
34
+ el += ' style="height:' + args.height + '"'
35
+ }
36
+ el += '/>'
37
+ }
38
+ el += '</span>'
39
+ return el
40
+ }