hexo-theme-stellar 1.18.2 → 1.18.3
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.
- package/_config.yml +1 -2
- package/layout/wiki.ejs +1 -1
- package/package.json +1 -1
- package/scripts/generators/search.js +12 -40
- package/source/css/_layout/tag-plugins/common.styl +1 -1
- package/source/css/_layout/tag-plugins/folders.styl +11 -24
- package/source/css/_layout/tag-plugins/folding.styl +25 -20
- package/source/css/_layout/tag-plugins/note.styl +1 -0
- package/source/css/_layout/tag-plugins/override.styl +13 -0
- package/source/css/_layout/tag-plugins/quot.styl +1 -1
- package/source/css/_layout/tag-plugins/timeline.styl +0 -3
- package/source/js/main.js +1 -1
- package/source/js/search/local-search.js +2 -5
package/_config.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
######## Stellar info ########
|
|
2
2
|
stellar:
|
|
3
|
-
version: '1.18.
|
|
3
|
+
version: '1.18.3'
|
|
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
|
|
@@ -79,7 +79,6 @@ search:
|
|
|
79
79
|
field: all # post, page, all
|
|
80
80
|
path: /search.json # 搜索文件存放位置
|
|
81
81
|
content: true # 是否搜索内容
|
|
82
|
-
codeblock: true # 是否搜索代码块(需要content: true)
|
|
83
82
|
|
|
84
83
|
|
|
85
84
|
######## Comments ########
|
package/layout/wiki.ejs
CHANGED
|
@@ -30,7 +30,7 @@ function layoutTitle() {
|
|
|
30
30
|
}
|
|
31
31
|
%>
|
|
32
32
|
<%- partial('_partial/main/navbar/breadcrumb') %>
|
|
33
|
-
<article class='md-text content <%- page.layout %><%- scrollreveal() %>'>
|
|
33
|
+
<article class='md-text content <%- page.layout %><%- page.indent ? ' indent' : '' %><%- scrollreveal() %>'>
|
|
34
34
|
<%- layoutTitle() %>
|
|
35
35
|
<%- page.content %>
|
|
36
36
|
<%- partial('_partial/main/article/article_footer') %>
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* https://github.com/wzpan/hexo-generator-search
|
|
3
3
|
*/
|
|
4
|
+
const { stripHTML } = require('hexo-util')
|
|
4
5
|
|
|
5
6
|
hexo.extend.generator.register('search_json_generator', function (locals) {
|
|
6
7
|
if (this.theme.config.search.service != 'local_search') { return {} }
|
|
@@ -29,46 +30,17 @@ hexo.extend.generator.register('search_json_generator', function (locals) {
|
|
|
29
30
|
if (post.path) {
|
|
30
31
|
temp_post.path = root + post.path
|
|
31
32
|
}
|
|
32
|
-
if (cfg.content != false && post.
|
|
33
|
-
var content = post.
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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, '')
|
|
71
|
-
}
|
|
33
|
+
if (cfg.content != false && post.content) {
|
|
34
|
+
var content = stripHTML(post.content).trim()
|
|
35
|
+
// 部分HTML标签
|
|
36
|
+
content = content.replace(/<iframe[\s|\S]+iframe>/g, '')
|
|
37
|
+
content = content.replace(/<hr>/g, '')
|
|
38
|
+
content = content.replace(/<br>/g, '')
|
|
39
|
+
// 换行符换成空格
|
|
40
|
+
content = content.replace(/\\n/g, ' ')
|
|
41
|
+
content = content.replace(/\n/g, ' ')
|
|
42
|
+
// 多个连续空格换成单个空格
|
|
43
|
+
content = content.replace(/[\s]{2,}/g, ' ')
|
|
72
44
|
temp_post.content = content.trim()
|
|
73
45
|
}
|
|
74
46
|
if (post.tags && post.tags.length > 0) {
|
|
@@ -70,7 +70,7 @@ set_darkmode_tags()
|
|
|
70
70
|
set_dynamic_color($theme)
|
|
71
71
|
--theme: $theme
|
|
72
72
|
--theme-bg1: hsl(hue($theme), 50, 16)
|
|
73
|
-
--theme-bg2: hsl(hue($theme),
|
|
73
|
+
--theme-bg2: hsl(hue($theme), 16, 16)
|
|
74
74
|
--theme-border: hsl(hue($theme), 50, 24)
|
|
75
75
|
--text-p0: hsl(hue($theme), 100, 85)
|
|
76
76
|
--text-p1: hsl(hue($theme), 50, 75)
|
|
@@ -1,35 +1,30 @@
|
|
|
1
1
|
.tag-plugin.folders
|
|
2
|
-
|
|
3
|
-
margin: 1rem 0
|
|
4
|
-
border-radius: $border-bar
|
|
2
|
+
margin: var(--gap-p) 0
|
|
5
3
|
font-size: $fs-14
|
|
6
|
-
border: 1px solid var(--
|
|
4
|
+
border-top: 1px solid var(--block-border)
|
|
7
5
|
overflow: hidden
|
|
8
6
|
.folder
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
background: var(--block)
|
|
12
|
-
&:last-child summary
|
|
13
|
-
border-bottom: none
|
|
7
|
+
border-bottom: 1px solid var(--block-border)
|
|
8
|
+
padding: 1rem
|
|
14
9
|
summary
|
|
15
|
-
display: block
|
|
16
10
|
cursor: pointer
|
|
17
11
|
color: var(--text-p2)
|
|
18
12
|
font-weight: 500
|
|
19
13
|
position: relative
|
|
20
14
|
line-height: 1.2
|
|
21
15
|
outline: none
|
|
22
|
-
padding:
|
|
23
|
-
|
|
16
|
+
padding: 1rem
|
|
17
|
+
margin: -1rem
|
|
24
18
|
&:last-child
|
|
25
19
|
border-bottom: none
|
|
26
20
|
>
|
|
21
|
+
span
|
|
22
|
+
margin-left: 0.25em
|
|
27
23
|
p,h1,h2,h3,h4,h5,h6
|
|
28
24
|
display: inline
|
|
29
25
|
border-bottom: none !important
|
|
30
26
|
&:hover
|
|
31
27
|
color: var(--text-p0)
|
|
32
|
-
background: var(--block-hover)
|
|
33
28
|
&:after
|
|
34
29
|
position: absolute
|
|
35
30
|
content: '+'
|
|
@@ -40,23 +35,15 @@
|
|
|
40
35
|
|
|
41
36
|
|
|
42
37
|
.tag-plugin.folders details[open]
|
|
43
|
-
background: none
|
|
44
|
-
&:last-child
|
|
45
|
-
summary
|
|
46
|
-
border-bottom: 1px solid var(--theme-border)
|
|
47
|
-
.body
|
|
48
|
-
border-bottom: none
|
|
49
38
|
>summary
|
|
50
39
|
color: var(--text-p1)
|
|
51
|
-
|
|
40
|
+
font-weight: 700
|
|
52
41
|
&:after
|
|
53
42
|
content: '-'
|
|
54
43
|
|
|
55
44
|
>div.body
|
|
56
|
-
padding: 1rem
|
|
57
|
-
border-bottom: 1px solid var(--theme-border)
|
|
58
45
|
font-size: $fs-15
|
|
59
46
|
>:first-child
|
|
60
|
-
margin-top:
|
|
47
|
+
margin-top: 1rem
|
|
61
48
|
>:last-child
|
|
62
|
-
margin-bottom: 0
|
|
49
|
+
margin-bottom: 0
|
|
@@ -2,21 +2,22 @@ details.folding
|
|
|
2
2
|
display: block
|
|
3
3
|
padding: 1rem
|
|
4
4
|
margin: 1rem 0
|
|
5
|
-
border-radius: $border-
|
|
6
|
-
font-size: $fs-14
|
|
5
|
+
border-radius: $border-block
|
|
7
6
|
background: var(--theme-bg2)
|
|
8
7
|
border: 1px solid var(--theme-border)
|
|
9
8
|
summary
|
|
10
9
|
cursor: pointer
|
|
11
|
-
padding:
|
|
12
|
-
margin:
|
|
13
|
-
border-radius: $border-bar
|
|
10
|
+
padding: 1rem
|
|
11
|
+
margin: -1rem
|
|
14
12
|
color: var(--text-p2)
|
|
15
13
|
font-weight: 500
|
|
14
|
+
font-size: $fs-14
|
|
16
15
|
position: relative
|
|
17
|
-
line-height:
|
|
16
|
+
line-height: 1.2
|
|
18
17
|
outline: none
|
|
19
18
|
>
|
|
19
|
+
span
|
|
20
|
+
margin-left: 0.25em
|
|
20
21
|
p,h1,h2,h3,h4,h5,h6
|
|
21
22
|
display: inline
|
|
22
23
|
border-bottom: none !important
|
|
@@ -34,25 +35,17 @@ details.folding
|
|
|
34
35
|
|
|
35
36
|
details.folding[open]
|
|
36
37
|
>summary
|
|
37
|
-
border-bottom: 1px solid var(--theme-border)
|
|
38
|
-
border-bottom-left-radius: 0
|
|
39
|
-
border-bottom-right-radius: 0
|
|
40
38
|
color: var(--text-p1)
|
|
41
|
-
|
|
39
|
+
font-weight: 700
|
|
40
|
+
z-index 1
|
|
42
41
|
&:after
|
|
43
42
|
content: '-'
|
|
44
43
|
>div.body
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
margin: 0 - 1rem
|
|
49
|
-
margin-top: 0
|
|
50
|
-
background: var(--card)
|
|
51
|
-
border-bottom-left-radius: 'calc(%s - 1px)' % $border-bar
|
|
52
|
-
border-bottom-right-radius: 'calc(%s - 1px)' % $border-bar
|
|
53
|
-
font-size: $fs-15
|
|
44
|
+
padding: 0 1rem 1rem
|
|
45
|
+
margin: 0 -1rem -1rem
|
|
46
|
+
color: var(--text-p1)
|
|
54
47
|
>:first-child
|
|
55
|
-
margin-top:
|
|
48
|
+
margin-top: 1rem
|
|
56
49
|
>:last-child
|
|
57
50
|
margin-bottom: 0
|
|
58
51
|
|
|
@@ -65,5 +58,17 @@ details.folding[child=codeblock]>div.body
|
|
|
65
58
|
border-radius: 0
|
|
66
59
|
background: transparent
|
|
67
60
|
margin: 0
|
|
61
|
+
figcaption
|
|
62
|
+
display: none
|
|
68
63
|
.code:before
|
|
69
64
|
content: none
|
|
65
|
+
|
|
66
|
+
details.folding[child=iframe]
|
|
67
|
+
overflow: hidden
|
|
68
|
+
background: none
|
|
69
|
+
>summary
|
|
70
|
+
background: none
|
|
71
|
+
>div.body
|
|
72
|
+
padding: 0
|
|
73
|
+
background: none
|
|
74
|
+
overflow: hidden
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.tag-plugin.note, .tag-plugin.folding
|
|
2
|
+
blockquote
|
|
3
|
+
border-top-left-radius: 0
|
|
4
|
+
border-bottom-left-radius: 0
|
|
5
|
+
background: none
|
|
6
|
+
padding-top: 0
|
|
7
|
+
padding-bottom: 0
|
|
8
|
+
table:not([class])
|
|
9
|
+
th
|
|
10
|
+
background: var(--block-hover)
|
|
11
|
+
td,th
|
|
12
|
+
border-color: var(--block-border)
|
|
13
|
+
|
package/source/js/main.js
CHANGED
|
@@ -127,7 +127,7 @@ const init = {
|
|
|
127
127
|
const e0 = document.querySelector('.widgets')
|
|
128
128
|
const e1 = document.querySelector('#data-toc a.toc-link[href="' + encodeURI(link) + '"]')
|
|
129
129
|
const offsetBottom = e1.getBoundingClientRect().bottom - e0.getBoundingClientRect().bottom + 100
|
|
130
|
-
const offsetTop = e1.getBoundingClientRect().top - e0.getBoundingClientRect().top -
|
|
130
|
+
const offsetTop = e1.getBoundingClientRect().top - e0.getBoundingClientRect().top - 64
|
|
131
131
|
if (offsetTop < 0) {
|
|
132
132
|
e0.scrollBy(0, offsetTop)
|
|
133
133
|
} else if (offsetBottom > 0) {
|
|
@@ -54,13 +54,10 @@ var searchFunc = function(path, filter, searchId, contentId) {
|
|
|
54
54
|
}
|
|
55
55
|
// perform local searching
|
|
56
56
|
datas.forEach(function(data) {
|
|
57
|
-
if (!data.title?.trim().length) { return }
|
|
58
57
|
if (!data.content?.trim().length) { return }
|
|
59
58
|
var matches = 0;
|
|
60
|
-
if (filter && !data.path.includes(filter)) {
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
var dataTitle = data.title.trim();
|
|
59
|
+
if (filter && !data.path.includes(filter)) { return }
|
|
60
|
+
var dataTitle = data.title?.trim() || 'Untitled';
|
|
64
61
|
var dataTitleLowerCase = dataTitle.toLowerCase();
|
|
65
62
|
var dataContent = data.content;
|
|
66
63
|
var dataContentLowerCase = dataContent.toLowerCase();
|