hexo-theme-stellar 1.17.1 → 1.18.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 (41) hide show
  1. package/_config.yml +35 -28
  2. package/_data/widgets.yml +11 -15
  3. package/layout/_partial/sidebar/header.ejs +4 -4
  4. package/layout/_partial/sidebar/index.ejs +13 -7
  5. package/layout/_partial/widgets/search.ejs +14 -5
  6. package/layout/index.ejs +1 -1
  7. package/layout/wiki.ejs +2 -2
  8. package/package.json +1 -1
  9. package/scripts/generators/search.js +93 -87
  10. package/scripts/tags/{border.js → ablock.js} +8 -10
  11. package/scripts/tags/{split.js → grid.js} +5 -5
  12. package/scripts/tags/note.js +5 -7
  13. package/scripts/tags/poetry.js +4 -5
  14. package/scripts/tags/quot.js +8 -4
  15. package/scripts/tags/tag.js +35 -0
  16. package/scripts/tags/toc.js +2 -2
  17. package/source/css/_common/highlight.styl +0 -3
  18. package/source/css/_custom.styl +13 -27
  19. package/source/css/_defines/theme.styl +47 -34
  20. package/source/css/_layout/md.styl +6 -4
  21. package/source/css/_layout/partial/paginator.styl +2 -1
  22. package/source/css/_layout/partial/related.styl +1 -1
  23. package/source/css/_layout/sidebar/header.styl +2 -2
  24. package/source/css/_layout/tag-plugins/common.styl +51 -65
  25. package/source/css/_layout/tag-plugins/folding.styl +10 -11
  26. package/source/css/_layout/tag-plugins/{split.styl → grid.styl} +4 -4
  27. package/source/css/_layout/tag-plugins/link.styl +1 -1
  28. package/source/css/_layout/tag-plugins/mark.styl +2 -2
  29. package/source/css/_layout/tag-plugins/navbar.styl +1 -1
  30. package/source/css/_layout/tag-plugins/note.styl +3 -1
  31. package/source/css/_layout/tag-plugins/poetry.styl +26 -25
  32. package/source/css/_layout/tag-plugins/quot.styl +47 -58
  33. package/source/css/_layout/tag-plugins/tag.styl +13 -0
  34. package/source/css/_layout/widgets/ghuser.styl +19 -15
  35. package/source/css/_layout/widgets/search.styl +101 -1
  36. package/source/css/_layout/widgets/toc_common.styl +1 -1
  37. package/source/css/_plugins/comments/twikoo.styl +0 -1
  38. package/source/css/_plugins/index.styl +0 -3
  39. package/source/js/plugins/weibo.js +116 -0
  40. package/source/js/search/local-search.js +6 -21
  41. package/source/css/_plugins/search/local-search.styl +0 -89
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.17.1'
3
+ version: '1.18.0'
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
@@ -25,10 +25,22 @@ sidebar:
25
25
  # about: '[关于](/about/)'
26
26
  # Sidebar widgets
27
27
  widgets:
28
- index: welcome, recent, search, timeline # for home/wiki/categories/tags/archives/404 pages
29
- page: welcome, toc # for pages using 'layout:page'
30
- post: toc, ghrepo, search, ghissues # for pages using 'layout:post'
28
+ #### 自动生成的页面 ####
29
+ # 主页
30
+ home: search, recent, timeline # for home
31
+ # 博客索引页
32
+ blog_index: search_blog, recent, timeline # for categories/tags/archives
33
+ # 文档索引页
34
+ wiki_index: search_docs, recent, timeline # for wiki
35
+ # 其它(404)
36
+ others: search, recent, timeline # for 404 and ...
37
+ #### 手动创建的页面 ####
38
+ # 文章内页
39
+ post: search_blog, toc, ghrepo, ghissues # for pages using 'layout:post'
40
+ # 文档内页
31
41
  wiki: search, ghrepo, toc, ghissues, related # for pages using 'layout:wiki'
42
+ # 其它 layout:page 的页面
43
+ page: toc, search # for custom pages using 'layout:page'
32
44
 
33
45
  ######## Index ########
34
46
  post-index: # 近期发布 分类 标签 归档 and ...
@@ -63,10 +75,11 @@ article:
63
75
 
64
76
  search:
65
77
  service: local_search # local_search, todo...
66
- local_search:
78
+ local_search: # 在 front-matter 中设置 indexing:false 来避免被搜索索引
67
79
  field: all # post, page, all
68
- path: /search.json
69
- content: true
80
+ path: /search.json # 搜索文件存放位置
81
+ content: true # 是否搜索内容
82
+ codeblock: true # 是否搜索代码块(需要content: true)
70
83
 
71
84
 
72
85
  ######## Comments ########
@@ -230,6 +243,9 @@ tag_plugins:
230
243
  # {% mark %}
231
244
  mark:
232
245
  default_color: dark # light, dark, red, orange, yellow, green, cyan, blue, purple, warning, error
246
+ # {% tag %}
247
+ tag:
248
+ default_color: yellow # red, orange, yellow, green, cyan, blue, purple
233
249
 
234
250
 
235
251
  ######## JS Plugins ########
@@ -246,6 +262,7 @@ plugins:
246
262
  timeline: /js/plugins/timeline.js
247
263
  linkcard: /js/plugins/linkcard.js
248
264
  fcircle: /js/plugins/fcircle.js
265
+ weibo: /js/plugins/weibo.js
249
266
 
250
267
  marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
251
268
 
@@ -325,27 +342,17 @@ style:
325
342
  code: 'Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif'
326
343
  text-align: left
327
344
  color:
328
- common:
329
- theme: '#1BCDFC' # 主题色
330
- accent: '#ff5722' # 强调色
331
- link: '#2196f3' # 超链接颜色
332
- button: '#1BCDFC' # 按钮颜色
333
- hover: '#ff5722' # 按钮高亮颜色
334
- light:
335
- background: '#F8F9FA' # 浅色背景颜色
336
- block: '#F0F1F2' # 块背景颜色
337
- card: white # 卡片背景颜色
338
- title: '#000' # 标题文本颜色
339
- text: '#333' # 正文文本颜色
340
- code: '#f33a00' # 行内代码颜色
341
- dark:
342
- background: '#313438' # 深色背景颜色
343
- background-mobile: black # 移动端深色背景(OLED调成纯黑可以省电)
344
- block: '#2B2F33' # 块背景颜色
345
- card: '#464D57' # 卡片背景颜色
346
- title: '#fff' # 标题文本颜色
347
- text: '#eee' # 正文文本颜色
348
- code: '#ff7043' # 行内代码颜色
345
+ # 动态颜色(会根据明暗主题重设明度值,只用关心色相和饱和度即可)
346
+ background: 'hsl(212 16% 98%)' # 浅色背景颜色
347
+ block: 'hsl(212 8% 95%)' # 块背景颜色
348
+ code: 'hsl(14 100% 48%)' # 行内代码颜色
349
+ text: 'hsl(0 0% 20%)' # 文本颜色
350
+ # 主题色配置(不会根据明暗动态调整,请设置为通用的颜色)
351
+ theme: 'hsl(192 98% 55%)' # 主题色
352
+ accent: 'hsl(14 100% 57%)' # 强调色
353
+ link: 'hsl(207 90% 54%)' # 超链接颜色
354
+ button: 'hsl(192 98% 55%)' # 按钮颜色
355
+ hover: 'hsl(14 100% 57%)' # 按钮高亮颜色
349
356
  animated_avatar:
350
357
  animate: auto # auto, always
351
358
  background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp
package/_data/widgets.yml CHANGED
@@ -5,6 +5,17 @@
5
5
  search:
6
6
  layout: search
7
7
  filter: auto # auto or 'path'
8
+
9
+
10
+ search_blog:
11
+ layout: search
12
+ filter: /blog/ # auto or 'path'
13
+ placeholder: 文章搜索
14
+
15
+ search_docs:
16
+ layout: search
17
+ filter: /wiki/ # auto or 'path'
18
+ placeholder: 文档搜索
8
19
 
9
20
  ghrepo:
10
21
  layout: ghrepo
@@ -33,7 +44,6 @@ toc:
33
44
  # github user info
34
45
  ghuser:
35
46
  layout: ghuser
36
- api: https://api.github.com
37
47
  username: github # your github login username
38
48
  avatar: true # show avatar or not
39
49
  menu: true # show menu or not
@@ -52,20 +62,6 @@ tagcloud:
52
62
  end_color: # 结束的颜色。您可使用十六进位值(#b700ff),rgba(rgba(183, 0, 255, 1)),hsla(hsla(283, 100%, 50%, 1))或 颜色关键字。此变量仅在 color 参数开启时才有用。
53
63
  show_count: false # 显示每个标签的文章总数
54
64
 
55
- welcome:
56
- layout: markdown
57
- title: Stellar 入门指南
58
- content: | # support markdown
59
- 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!
60
- <br>
61
- **第一步**
62
- 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。
63
- <br>
64
- **第二步**
65
- 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
66
- <br>
67
- 如果有任何疑问,请先查阅 [文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
68
-
69
65
  timeline:
70
66
  layout: timeline
71
67
  title: 近期动态
@@ -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>';
@@ -14,8 +14,14 @@ if (page.sidebar == undefined) {
14
14
  } else {
15
15
  page.sidebar = theme.sidebar.widgets.wiki;
16
16
  }
17
- } else if (is_home() || ['categories', 'tags', 'archives', 'index', '404', undefined].includes(page.layout)) {
18
- page.sidebar = theme.sidebar.widgets.index;
17
+ } else if (is_home()) {
18
+ page.sidebar = theme.sidebar.widgets.home;
19
+ } else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) {
20
+ page.sidebar = theme.sidebar.widgets.blog_index;
21
+ } else if (['wiki_index'].includes(page.layout)) {
22
+ page.sidebar = theme.sidebar.widgets.wiki_index;
23
+ } else if (['404', undefined].includes(page.layout)) {
24
+ page.sidebar = theme.sidebar.widgets.others;
19
25
  } else if (page.layout == 'page') {
20
26
  page.sidebar = theme.sidebar.widgets.page;
21
27
  } else {
@@ -34,10 +40,10 @@ function layoutTitle(main, url, sub) {
34
40
  if (sub) {
35
41
  let arr = sub.split('|');
36
42
  if (arr.length > 1) {
37
- el += '<div class="sub normal cap">' + arr[0].trim() + '</div>';
38
- el += '<div class="sub hover cap" style="opacity:0">' + arr[1].trim() + '</div>';
39
- } else if (arr.length > 0) {
40
- 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>';
41
47
  }
42
48
  }
43
49
  el += '</a>';
@@ -83,7 +89,7 @@ function layoutWidgets() {
83
89
  if (name in theme.data.widgets) {
84
90
  Object.assign(widget, theme.data.widgets[name])
85
91
  }
86
- if (typeof w == 'object' && w.override) {
92
+ if (typeof w == 'object' && (w.override || w.layout)) {
87
93
  Object.assign(widget, w)
88
94
  }
89
95
  if (widget && widget.layout) {
@@ -5,20 +5,29 @@ function layoutDiv() {
5
5
  el += '<div class="search-wrapper" id="search">'
6
6
  el += '<form class="search-form">'
7
7
  var filter = ''
8
- if (item.filter == 'auto' && page.layout == 'wiki') {
9
- let matches = page.path.match(/(.*?)\/(.*?)\//i)
10
- if (matches?.length > 0) {
11
- filter = matches[0]
8
+ if (item.filter == 'auto') {
9
+ if (page.layout == 'wiki') {
10
+ let matches = page.path.match(/(.*?)\/(.*?)\//i)
11
+ if (matches?.length > 0) {
12
+ filter = matches[0]
13
+ }
14
+ }
15
+ } else {
16
+ if (item.filter?.length > 0) {
17
+ filter = item.filter
12
18
  }
13
19
  }
14
20
  el += '<input type="text" class="search-input" id="search-input"'
15
21
  if (filter.length > 0) {
16
- filter = '/' + filter
22
+ if (!filter.startsWith('/')) {
23
+ filter = '/' + filter
24
+ }
17
25
  el += ' data-filter="' + filter + '"'
18
26
  el += ' placeholder="' + (item.placeholder || __('search.search_in', filter)) + '">'
19
27
  } else {
20
28
  el += ' placeholder="' + (item.placeholder || __('search.search')) + '">'
21
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>'
22
31
  el += '</form>'
23
32
  el += '<div id="search-result"></div>'
24
33
  el += '<div class="search-no-result">' + __('search.no_results') + '</div>'
package/layout/index.ejs CHANGED
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  if (page.menu_id == undefined) {
3
- if (page.layout === 'index' && page.wiki) {
3
+ if (page.layout === 'wiki_index' && page.wiki) {
4
4
  page.menu_id = 'wiki';
5
5
  } else {
6
6
  page.menu_id = 'post';
package/layout/wiki.ejs CHANGED
@@ -3,7 +3,7 @@ if (page.menu_id == undefined) {
3
3
  page.menu_id = 'wiki';
4
4
  }
5
5
  if (page.layout == undefined) {
6
- page.layout = 'index';
6
+ page.layout = 'wiki_index';
7
7
  }
8
8
  if (page.title == undefined) {
9
9
  if (page.tagName) {
@@ -21,7 +21,7 @@ function layoutTitle() {
21
21
  }
22
22
  }
23
23
  %>
24
- <% if (page.layout === 'index') { %>
24
+ <% if (page.layout === 'wiki_index') { %>
25
25
  <%- partial('index') %>
26
26
  <% } else { %>
27
27
  <%
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.17.1",
3
+ "version": "1.18.0",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -3,101 +3,107 @@
3
3
  */
4
4
 
5
5
  hexo.extend.generator.register('search_json_generator', function (locals) {
6
- if (this.theme.config.search.service != 'local_search') {
7
- return {}
8
- }
9
- var config = this.config
10
- const { local_search } = this.theme.config.search
11
-
12
- var searchfield = local_search.field
13
- var content = local_search.content
6
+ if (this.theme.config.search.service != 'local_search') { return {} }
7
+ const { root } = this.config
8
+ const { local_search: cfg } = this.theme.config.search
9
+ cfg.sort = '-date'
10
+ cfg.field = cfg.field?.trim()
14
11
 
15
12
  var posts, pages
13
+ if (cfg.field == 'post') {
14
+ posts = locals.posts?.filter(p => p.content?.length > 0).sort(cfg.sort)
15
+ } else if (cfg.field == 'page') {
16
+ pages = locals.pages?.filter(p => p.content?.length > 0)
17
+ } else {
18
+ posts = locals.posts?.filter(p => p.content?.length > 0).sort(cfg.sort)
19
+ pages = locals.pages?.filter(p => p.content?.length > 0)
20
+ }
21
+
22
+ var res = new Array()
16
23
 
17
- if (searchfield.trim() != '') {
18
- searchfield = searchfield.trim()
19
- if (searchfield == 'post'){
20
- posts = locals.posts.sort('-date')
21
- } else if (searchfield == 'page') {
22
- pages = locals.pages
23
- } else {
24
- posts = locals.posts.sort('-date')
25
- pages = locals.pages
24
+ function generateJson(post) {
25
+ var temp_post = new Object()
26
+ if (post.title) {
27
+ temp_post.title = post.title.trim()
28
+ }
29
+ if (post.path) {
30
+ temp_post.path = root + post.path
31
+ }
32
+ if (cfg.content != false && post._content) {
33
+ var content = post._content.trim()
34
+ // 过滤掉标签和注释
35
+ if (content.includes('{%')) {
36
+ // 需要保留内容的的标签
37
+ content = content.replace(/{%\s*mark\s*(.*?)\s*%}/g, '$1')
38
+ content = content.replace(/{%\s*folding\s*(.*?)\s*%}/g, '$1')
39
+ content = content.replace(/{%\s*copy\s*(.*?)\s*%}/g, '$1')
40
+ content = content.replace(/{%\s*note\s*(.*?)\s*%}/g, '$1')
41
+ content = content.replace(/{%\s*kbd\s*(.*?)\s*%}/g, '$1')
42
+ content = content.replace(/{%\s*emp\s*(.*?)\s*%}/g, '$1')
43
+ content = content.replace(/{%\s*wavy\s*(.*?)\s*%}/g, '$1')
44
+ content = content.replace(/{%\s*sub\s*(.*?)\s*%}/g, '$1')
45
+ content = content.replace(/{%\s*sup\s*(.*?)\s*%}/g, '$1')
46
+ content = content.replace(/<!--\s*folder(.*?)\s*-->/g, '$1')
47
+ content = content.replace(/<!--\s*tab(.*?)\s*-->/g, '$1')
48
+ content = content.replace(/<!--\s*node(.*?)\s*-->/g, '$1')
49
+ // 不保留内容的标签
50
+ content = content.replace(/{%\s*(.*?)\s*%}/g, '')
51
+ // 注释
52
+ content = content.replace(/<!--\s*(.*?)\s*-->/g, '')
53
+ // ## 标题
54
+ content = content.replace(/[#]{2,} /g, '')
55
+ // 部分HTML标签
56
+ content = content.replace(/<iframe[\s|\S]+iframe>/g, '')
57
+ content = content.replace(/<hr>/g, '')
58
+ content = content.replace(/<br>/g, '')
59
+ // 图片
60
+ content = content.replace(/\!\[(.*?)\]\((.*?)\)/g, '')
61
+ // 链接
62
+ content = content.replace(/\[(.*?)\]\((.*?)\)/g, '$1')
63
+ // 过滤代码块
64
+ if (cfg.codeblock == false) {
65
+ content = content.replace(/```([^`]+)```/g, '')
66
+ }
67
+ // 多个连续空格换成单个空格
68
+ content = content.replace(/[\s]{2,} /g, ' ')
69
+ // 特殊字符
70
+ content = content.replace(/[\r|\n]+/g, '')
26
71
  }
27
- } else {
28
- posts = locals.posts.sort('-date')
72
+ temp_post.content = content.trim()
73
+ }
74
+ if (post.tags && post.tags.length > 0) {
75
+ var tags = []
76
+ post.tags.forEach(function (tag) {
77
+ tags.push(tag.name)
78
+ })
79
+ temp_post.tags = tags
80
+ }
81
+ if (post.categories && post.categories.length > 0) {
82
+ var categories = []
83
+ post.categories.forEach(function (cate) {
84
+ categories.push(cate.name)
85
+ })
86
+ temp_post.categories = categories
87
+ }
88
+ return temp_post
29
89
  }
30
90
 
31
- var res = new Array()
32
- var index = 0
33
-
34
- if (posts) {
35
- posts.each(function(post) {
36
- if (post.indexing != undefined && !post.indexing) return
37
- var temp_post = new Object()
38
- if (post.title) {
39
- temp_post.title = post.title
40
- }
41
- if (post.path) {
42
- temp_post.url = config.root + post.path
43
- }
44
- if (content != false && post._content) {
45
- temp_post.content = post._content
46
- }
47
- if (post.tags && post.tags.length > 0) {
48
- var tags = []
49
- post.tags.forEach(function (tag) {
50
- tags.push(tag.name)
51
- })
52
- temp_post.tags = tags
53
- }
54
- if (post.categories && post.categories.length > 0) {
55
- var categories = []
56
- post.categories.forEach(function (cate) {
57
- categories.push(cate.name)
58
- })
59
- temp_post.categories = categories
60
- }
61
- res[index] = temp_post
62
- index += 1
91
+ if (posts) {
92
+ posts.each(function(post) {
93
+ if (post.indexing == false) return
94
+ let temp_post = generateJson(post)
95
+ res.push(temp_post)
63
96
  })
64
97
  }
65
- if (pages) {
66
- pages.each(function(page) {
67
- if (page.indexing != undefined && !page.indexing) return
68
- var temp_page = new Object()
69
- if (page.title) {
70
- temp_page.title = page.title
71
- }
72
- if (page.path) {
73
- temp_page.url = config.root + page.path
74
- }
75
- if (content != false && page._content) {
76
- temp_page.content = page._content
77
- }
78
- if (page.tags && page.tags.length > 0) {
79
- var tags = new Array()
80
- var tag_index = 0
81
- page.tags.each(function (tag) {
82
- tags[tag_index] = tag.name
83
- })
84
- temp_page.tags = tags
85
- }
86
- if (page.categories && page.categories.length > 0) {
87
- temp_page.categories = []
88
- (page.categories.each || page.categories.forEach)(function (item) {
89
- temp_page.categories.push(item)
90
- })
91
- }
92
- res[index] = temp_page
93
- index += 1
94
- })
95
- }
96
-
97
- var json = JSON.stringify(res)
98
-
98
+ if (pages) {
99
+ pages.each(function(page) {
100
+ if (page.indexing == false) return
101
+ let temp_post = generateJson(page)
102
+ res.push(temp_post)
103
+ })
104
+ }
99
105
  return {
100
- path: local_search.path,
101
- data: json
106
+ path: cfg.path,
107
+ data: JSON.stringify(res)
102
108
  }
103
109
  })
@@ -1,23 +1,21 @@
1
1
  /**
2
- * border.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
2
+ * ablock.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
3
3
  * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
4
  *
5
- * {% border [color:color] [child:codeblock/tabs] title %}
5
+ * {% ablock [color:color] [child:codeblock/tabs] title %}
6
6
  * body
7
- * {% endborder %}
7
+ * {% endablock %}
8
8
  */
9
9
 
10
10
  'use strict';
11
11
 
12
- hexo.extend.tag.register('border', function(args, content) {
12
+ hexo.extend.tag.register('ablock', function(args, content) {
13
13
  args = hexo.args.map(args, ['color', 'child'], ['title']);
14
- const color = args.color;
15
- const title = args.title;
16
- var el = '';
17
- const defaultColor = hexo.theme.config.tag_plugins.note.default_color;
18
- if (!color && defaultColor) {
19
- color = defaultColor;
14
+ const { title } = args;
15
+ if (args.color == null) {
16
+ args.color = hexo.theme.config.tag_plugins.note.default_color
20
17
  }
18
+ var el = '';
21
19
  // header
22
20
  el += '<div class="tag-plugin note"';
23
21
  el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
@@ -1,21 +1,21 @@
1
1
  /**
2
- * split.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
2
+ * grid.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
3
3
  * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
4
  *
5
- * {% split [style:block/card] %}
5
+ * {% grid [style:block/card] %}
6
6
  * <!-- cell left -->
7
7
  * left body
8
8
  * <!-- cell right -->
9
9
  * right body
10
- * {% endsplit %}
10
+ * {% endgrid %}
11
11
  */
12
12
 
13
13
  'use strict';
14
14
 
15
- hexo.extend.tag.register('split', function(args, content) {
15
+ hexo.extend.tag.register('grid', function(args, content) {
16
16
  args = hexo.args.map(args, ['bg']);
17
17
  var el = '';
18
- el += '<div class="tag-plugin split"';
18
+ el += '<div class="tag-plugin grid"';
19
19
  el += ' ' + hexo.args.joinTags(args, ['bg']).join(' ');
20
20
  el += '>';
21
21
 
@@ -13,20 +13,18 @@ hexo.extend.tag.register('note', function(args) {
13
13
  args.content = args.title;
14
14
  args.title = '';
15
15
  }
16
- const color = args.color;
17
- const title = args.title;
18
- var el = '';
19
- const defaultColor = hexo.theme.config.tag_plugins.note.default_color;
20
- if (!color && defaultColor) {
21
- color = defaultColor;
16
+ const { title } = args;
17
+ if (args.color == null) {
18
+ args.color = hexo.theme.config.tag_plugins.note.default_color
22
19
  }
20
+ var el = '';
23
21
  // header
24
22
  el += '<div class="tag-plugin note"';
25
23
  el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
26
24
  el += '>';
27
25
  // title
28
26
  if (title && title.length > 0) {
29
- el += '<div class="title"><strong>' + title + '</strong></div>';
27
+ el += '<div class="title">' + title + '</div>';
30
28
  }
31
29
  // content
32
30
  el += '<div class="body">';
@@ -3,7 +3,7 @@
3
3
  * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
4
  *
5
5
  * poetry:
6
- * {% poetry [align:center] [title] [author:作者] [date:日期] [footer:footer] %}
6
+ * {% poetry [title] [author:作者] [date:日期] [footer:footer] %}
7
7
  * body
8
8
  * {% endpoetry %}
9
9
  *
@@ -13,13 +13,11 @@
13
13
 
14
14
  hexo.extend.tag.register('poetry', function(args, content) {
15
15
  var el = '';
16
- args = hexo.args.map(args, ['author', 'date', 'align', 'footer'], ['title']);
16
+ args = hexo.args.map(args, ['author', 'date', 'footer'], ['title']);
17
17
 
18
18
  el += '<div class="tag-plugin poetry"';
19
- if (args.align) {
20
- el += ' align="' + args.align + '"';
21
- }
22
19
  el += '>';
20
+ el += '<div class="content">'
23
21
  if (args.title) {
24
22
  el += '<div class="title">';
25
23
  el += args.title;
@@ -43,6 +41,7 @@ hexo.extend.tag.register('poetry', function(args, content) {
43
41
  el += args.footer;
44
42
  el += '</div>';
45
43
  }
44
+ el += '</div>'
46
45
  el += '</div>';
47
46
  return el;
48
47
  }, {ends: true});
@@ -1,9 +1,9 @@
1
1
  /**
2
- * quot.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
2
+ * quot.js v1.2 | https://github.com/xaoxuu/hexo-theme-stellar/
3
3
  * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
4
  *
5
5
  * quot:
6
- * {% quot [el:h1] [icon:default] text %}
6
+ * {% quot [el:h2] [icon:default] text %}
7
7
  *
8
8
  */
9
9
 
@@ -38,14 +38,18 @@ hexo.extend.tag.register('quot', function(args) {
38
38
  return el;
39
39
  }
40
40
  if (args.el.includes('h')) {
41
- el += '<' + args.el + ' class="tag-plugin quot"' + type + ' id="' + args.text + '">';
41
+ el += '<div' + ' class="tag-plugin quot">'
42
+ el += '<' + args.el + ' class="content" id="' + args.text + '"' + type + '>';
42
43
  el += '<a href="#' + args.text + '" class="headerlink" title="' + args.text + '"></a>';
43
44
  el += content();
44
45
  el += '</' + args.el + '>';
46
+ el += '</div>'
45
47
  } else {
46
- el += '<' + args.el + ' class="tag-plugin quot"' + type + '>';
48
+ el += '<div' + ' class="tag-plugin quot">'
49
+ el += '<' + args.el + ' class="content"' + type + '>';
47
50
  el += content();
48
51
  el += '</' + args.el + '>';
52
+ el += '</div>'
49
53
  }
50
54
  return el;
51
55
  });