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
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.17.2'
3
+ version: '1.18.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
@@ -27,20 +27,20 @@ sidebar:
27
27
  widgets:
28
28
  #### 自动生成的页面 ####
29
29
  # 主页
30
- home: search, welcome, recent, timeline # for home
30
+ home: search, recent, timeline # for home
31
31
  # 博客索引页
32
32
  blog_index: search_blog, recent, timeline # for categories/tags/archives
33
33
  # 文档索引页
34
34
  wiki_index: search_docs, recent, timeline # for wiki
35
35
  # 其它(404)
36
- others: search, welcome, recent, timeline # for 404 and ...
36
+ others: search, recent, timeline # for 404 and ...
37
37
  #### 手动创建的页面 ####
38
38
  # 文章内页
39
- post: toc, ghrepo, search, ghissues # for pages using 'layout:post'
39
+ post: search_blog, toc, ghrepo, ghissues # for pages using 'layout:post'
40
40
  # 文档内页
41
41
  wiki: search, ghrepo, toc, ghissues, related # for pages using 'layout:wiki'
42
42
  # 其它 layout:page 的页面
43
- page: welcome, toc, search # for custom pages using 'layout:page'
43
+ page: toc, search # for custom pages using 'layout:page'
44
44
 
45
45
  ######## Index ########
46
46
  post-index: # 近期发布 分类 标签 归档 and ...
@@ -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:
@@ -243,6 +227,9 @@ tag_plugins:
243
227
  # {% mark %}
244
228
  mark:
245
229
  default_color: dark # light, dark, red, orange, yellow, green, cyan, blue, purple, warning, error
230
+ # {% tag %}
231
+ tag:
232
+ default_color: yellow # red, orange, yellow, green, cyan, blue, purple
246
233
 
247
234
 
248
235
  ######## JS Plugins ########
@@ -259,6 +246,7 @@ plugins:
259
246
  timeline: /js/plugins/timeline.js
260
247
  linkcard: /js/plugins/linkcard.js
261
248
  fcircle: /js/plugins/fcircle.js
249
+ weibo: /js/plugins/weibo.js
262
250
 
263
251
  marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
264
252
 
@@ -300,8 +288,8 @@ plugins:
300
288
  # swiper
301
289
  swiper:
302
290
  enable: true
303
- css: https://unpkg.com/swiper@6/swiper-bundle.min.css
304
- js: https://unpkg.com/swiper@6/swiper-bundle.min.js
291
+ css: https://unpkg.com/swiper@8/swiper-bundle.min.css
292
+ js: https://unpkg.com/swiper@8/swiper-bundle.min.js
305
293
 
306
294
 
307
295
  # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强
@@ -338,27 +326,17 @@ style:
338
326
  code: 'Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif'
339
327
  text-align: left
340
328
  color:
341
- common:
342
- theme: '#1BCDFC' # 主题色
343
- accent: '#ff5722' # 强调色
344
- link: '#2196f3' # 超链接颜色
345
- button: '#1BCDFC' # 按钮颜色
346
- hover: '#ff5722' # 按钮高亮颜色
347
- light:
348
- background: '#F8F9FA' # 浅色背景颜色
349
- block: '#F0F1F2' # 块背景颜色
350
- card: white # 卡片背景颜色
351
- title: '#000' # 标题文本颜色
352
- text: '#333' # 正文文本颜色
353
- code: '#f33a00' # 行内代码颜色
354
- dark:
355
- background: '#313438' # 深色背景颜色
356
- background-mobile: black # 移动端深色背景(OLED调成纯黑可以省电)
357
- block: '#2B2F33' # 块背景颜色
358
- card: '#464D57' # 卡片背景颜色
359
- title: '#fff' # 标题文本颜色
360
- text: '#eee' # 正文文本颜色
361
- code: '#ff7043' # 行内代码颜色
329
+ # 动态颜色(会根据明暗主题重设明度值,只用关心色相和饱和度即可)
330
+ background: 'hsl(212 16% 98%)' # 浅色背景颜色
331
+ block: 'hsl(212 8% 95%)' # 块背景颜色
332
+ code: 'hsl(14 100% 48%)' # 行内代码颜色
333
+ text: 'hsl(0 0% 20%)' # 文本颜色
334
+ # 主题色配置(不会根据明暗动态调整,请设置为通用的颜色)
335
+ theme: 'hsl(192 98% 55%)' # 主题色
336
+ accent: 'hsl(14 100% 57%)' # 强调色
337
+ link: 'hsl(207 90% 54%)' # 超链接颜色
338
+ button: 'hsl(192 98% 55%)' # 按钮颜色
339
+ hover: 'hsl(14 100% 57%)' # 按钮高亮颜色
362
340
  animated_avatar:
363
341
  animate: auto # auto, always
364
342
  background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp
package/_data/widgets.yml CHANGED
@@ -44,7 +44,6 @@ toc:
44
44
  # github user info
45
45
  ghuser:
46
46
  layout: ghuser
47
- api: https://api.github.com
48
47
  username: github # your github login username
49
48
  avatar: true # show avatar or not
50
49
  menu: true # show menu or not
@@ -63,20 +62,6 @@ tagcloud:
63
62
  end_color: # 结束的颜色。您可使用十六进位值(#b700ff),rgba(rgba(183, 0, 255, 1)),hsla(hsla(283, 100%, 50%, 1))或 颜色关键字。此变量仅在 color 参数开启时才有用。
64
63
  show_count: false # 显示每个标签的文章总数
65
64
 
66
- welcome:
67
- layout: markdown
68
- title: Stellar 入门指南
69
- content: | # support markdown
70
- 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!
71
- <br>
72
- **第一步**
73
- 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。
74
- <br>
75
- **第二步**
76
- 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
77
- <br>
78
- 如果有任何疑问,请先查阅 [文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
79
-
80
65
  timeline:
81
66
  layout: timeline
82
67
  title: 近期动态
@@ -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;
@@ -10,10 +10,10 @@ function layoutTitle(main, url, sub) {
10
10
  if (sub) {
11
11
  let arr = sub.split('|');
12
12
  if (arr.length > 1) {
13
- el += '<div class="sub normal cap">' + arr[0].trim() + '</div>';
14
- el += '<div class="sub hover cap" style="opacity:0">' + arr[1].trim() + '</div>';
15
- } else if (arr.length > 0) {
16
- el += '<div class="sub cap">' + arr[0] + '</div>';
13
+ el += '<div class="sub normal cap">' + arr.shift().trim() + '</div>';
14
+ el += '<div class="sub hover cap" style="opacity:0">' + arr.join('|') + '</div>';
15
+ } else {
16
+ el += '<div class="sub cap">' + sub + '</div>';
17
17
  }
18
18
  }
19
19
  el += '</a>';
@@ -40,10 +40,10 @@ function layoutTitle(main, url, sub) {
40
40
  if (sub) {
41
41
  let arr = sub.split('|');
42
42
  if (arr.length > 1) {
43
- el += '<div class="sub normal cap">' + arr[0].trim() + '</div>';
44
- el += '<div class="sub hover cap" style="opacity:0">' + arr[1].trim() + '</div>';
45
- } else if (arr.length > 0) {
46
- el += '<div class="sub cap">' + arr[0] + '</div>';
43
+ el += '<div class="sub normal cap">' + arr.shift().trim() + '</div>';
44
+ el += '<div class="sub hover cap" style="opacity:0">' + arr.join('|') + '</div>';
45
+ } else {
46
+ el += '<div class="sub cap">' + sub + '</div>';
47
47
  }
48
48
  }
49
49
  el += '</a>';
@@ -27,6 +27,7 @@ function layoutDiv() {
27
27
  } else {
28
28
  el += ' placeholder="' + (item.placeholder || __('search.search')) + '">'
29
29
  }
30
+ el += '<svg t="1670596976048" class="icon search-icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2676" width="200" height="200"><path d="M938.2 832.6L723.8 618.1c-2.5-2.5-5.3-4.4-7.9-6.4 36.2-55.6 57.3-121.8 57.3-193.1C773.3 222.8 614.6 64 418.7 64S64 222.8 64 418.6c0 195.9 158.8 354.6 354.6 354.6 71.3 0 137.5-21.2 193.2-57.4 2 2.7 3.9 5.4 6.3 7.8L832.5 938c14.6 14.6 33.7 21.9 52.8 21.9 19.1 0 38.2-7.3 52.8-21.8 29.2-29.1 29.2-76.4 0.1-105.5M418.7 661.3C284.9 661.3 176 552.4 176 418.6 176 284.9 284.9 176 418.7 176c133.8 0 242.6 108.9 242.6 242.7 0 133.7-108.9 242.6-242.6 242.6" p-id="2677"></path></svg>'
30
31
  el += '</form>'
31
32
  el += '<div id="search-result"></div>'
32
33
  el += '<div class="search-no-result">' + __('search.no_results') + '</div>'
@@ -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.17.2",
3
+ "version": "1.18.1",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -54,6 +54,8 @@ hexo.extend.generator.register('search_json_generator', function (locals) {
54
54
  content = content.replace(/[#]{2,} /g, '')
55
55
  // 部分HTML标签
56
56
  content = content.replace(/<iframe[\s|\S]+iframe>/g, '')
57
+ content = content.replace(/<hr>/g, '')
58
+ content = content.replace(/<br>/g, '')
57
59
  // 图片
58
60
  content = content.replace(/\!\[(.*?)\]\((.*?)\)/g, '')
59
61
  // 链接
@@ -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
+ }