hexo-theme-solitude 1.5.8 → 1.5.10
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/.github/workflows/issue_close_question.yml +25 -0
- package/.github/workflows/issue_invalid.yml +18 -0
- package/.github/workflows/issue_question.yml +30 -0
- package/.github/workflows/issue_wontfix.yml +29 -0
- package/_config.yml +4 -6
- package/layout/includes/head/config.pug +6 -5
- package/layout/includes/inject/head.pug +1 -1
- package/layout/includes/page/says.pug +2 -2
- package/package.json +1 -1
- package/plugins.yml +1 -1
- package/scripts/event/cdn.js +1 -2
- package/scripts/event/init.js +1 -6
- package/scripts/filter/default.js +11 -12
- package/scripts/filter/lazyload.js +0 -2
- package/scripts/filter/randomPosts.js +4 -7
- package/scripts/helper/stylus.js +16 -0
- package/scripts/tags/bvideo.js +2 -2
- package/source/css/_global/var.styl +4 -1
- package/source/css/_highlight/highlight/index.styl +45 -0
- package/source/css/{_widgets/_post/_highlight → _highlight}/index.styl +25 -52
- package/source/css/_highlight/prismjs/diff.styl +184 -0
- package/source/css/_highlight/prismjs/index.styl +13 -0
- package/source/css/_highlight/prismjs/line-number.styl +30 -0
- package/source/css/{_widgets/_post/_highlight → _highlight}/theme/default.styl +4 -2
- package/source/css/{_widgets/_post/_highlight → _highlight}/theme/mac.styl +2 -1
- package/source/css/_page/index.styl +4 -1
- package/source/css/_page/share.styl +3 -3
- package/source/css/_widgets/_post/content.styl +1 -1
- package/source/css/_widgets/_post/index.styl +0 -2
- package/source/css/index.styl +4 -1
- package/source/js/main.js +90 -59
- package/source/js/utils.js +5 -6
- /package/source/css/{_widgets/_post/_highlight/theme.styl → _highlight/color.styl} +0 -0
- /package/source/css/{_widgets/_post/_highlight → _highlight/highlight}/diff.styl +0 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Close need info
|
2
|
+
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
- cron: "0 0 */1 * *"
|
6
|
+
workflow_dispatch:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
close-need-info:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- name: close-issues
|
13
|
+
uses: actions-cool/issues-helper@v3
|
14
|
+
with:
|
15
|
+
actions: "close-issues"
|
16
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
17
|
+
labels: "question"
|
18
|
+
inactive-day: 60
|
19
|
+
close-reason: "not_planned"
|
20
|
+
body: |
|
21
|
+
Hi there! This issue has been automatically closed because it has not had any activity for 60 days. We label issues as "questions" in hopes of community or maintainer input, and it seems this issue has gone stale.
|
22
|
+
|
23
|
+
If you still need assistance or believe this closure is a mistake, please feel free to reopen the issue or create a new one with updated details. We're here to help!
|
24
|
+
|
25
|
+
Thank you for your contributions to our project!
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Issue Invalid
|
2
|
+
|
3
|
+
on:
|
4
|
+
issues:
|
5
|
+
types: [labeled]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
lock-issue:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
if: github.event.label.name == 'invalid'
|
11
|
+
steps:
|
12
|
+
- name: Lock issue
|
13
|
+
uses: actions-cool/issues-helper@v2
|
14
|
+
with:
|
15
|
+
actions: "lock-issue"
|
16
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
17
|
+
issue-number: ${{ github.event.issue.number }}
|
18
|
+
lock-reason: "off-topic"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: Issue Question
|
2
|
+
|
3
|
+
on:
|
4
|
+
issues:
|
5
|
+
types: [labeled]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
create-comment:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
if: github.event.label.name == 'question'
|
11
|
+
steps:
|
12
|
+
- name: Create comment
|
13
|
+
uses: actions-cool/issues-helper@v2.0.0
|
14
|
+
with:
|
15
|
+
actions: "create-comment"
|
16
|
+
token: ${{ secrets.ISSUSE_TOKEN }}
|
17
|
+
issue-number: ${{ github.event.issue.number }}
|
18
|
+
body: |
|
19
|
+
Hello! 👋
|
20
|
+
|
21
|
+
Thank you for submitting your question. To ensure we can provide the best answer possible, could you please confirm you've provided the following details:
|
22
|
+
- A clear and concise description of your question.
|
23
|
+
- Any relevant code snippets or links to your project.
|
24
|
+
- What you've tried so far in attempting to solve your issue.
|
25
|
+
|
26
|
+
In the meantime, you might find the answer to your question in our [FAQs](https://solitude-docs.efu.me/faq) or [documentation](https://solitude-docs.efu.me/).
|
27
|
+
|
28
|
+
We aim to respond to questions within 48 hours. If your question is urgent, please consider reaching out through our support channels.
|
29
|
+
|
30
|
+
Thanks again for reaching out, and we look forward to assisting you!
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Issue Wontfix
|
2
|
+
|
3
|
+
on:
|
4
|
+
issues:
|
5
|
+
types: [labeled]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
handle-wontfix:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
if: github.event.label.name == 'wontfix'
|
11
|
+
steps:
|
12
|
+
- name: Create comment for wontfix
|
13
|
+
uses: actions-cool/issues-helper@v3
|
14
|
+
with:
|
15
|
+
actions: "create-comment"
|
16
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
17
|
+
issue-number: ${{ github.event.issue.number }}
|
18
|
+
body: |
|
19
|
+
Hi there! This issue has been marked as 'wontfix'. It means we've reviewed the issue but have chosen not to pursue it for reasons that may vary (e.g., aligning with the project's current priorities, outside of project scope, etc.).
|
20
|
+
|
21
|
+
We understand this might not be the outcome you were hoping for. If you believe this decision should be reconsidered, please provide any additional context or reasoning that was not previously considered.
|
22
|
+
|
23
|
+
Thank you for your understanding and for contributing to the project. Your efforts are greatly appreciated!
|
24
|
+
- name: Close issue after wontfix
|
25
|
+
uses: actions-cool/issues-helper@v3
|
26
|
+
with:
|
27
|
+
actions: "close-issue"
|
28
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
29
|
+
issue-number: ${{ github.event.issue.number }}
|
package/_config.yml
CHANGED
@@ -585,13 +585,11 @@ loading:
|
|
585
585
|
|
586
586
|
#代码高亮增强
|
587
587
|
# code highlight
|
588
|
-
|
589
|
-
enable:
|
590
|
-
#
|
591
|
-
# Code block line height limit
|
592
|
-
hightlimit: 200
|
588
|
+
highlight:
|
589
|
+
enable: true
|
590
|
+
limit: 200 # 代码行高限制 / Code line limit
|
593
591
|
copy: true # 是否开启复制按钮 / Whether to enable the copy button
|
594
|
-
expand:
|
592
|
+
expand: true # 是否默认展开 / Whether to expand by default
|
595
593
|
# 代码块样式
|
596
594
|
# Code block style
|
597
595
|
theme: default # default: 默认 / mac : apple terminal
|
@@ -44,11 +44,12 @@ script.
|
|
44
44
|
enable: !{theme.lazyload.enable},
|
45
45
|
error: '!{theme.lazyload.errorimg}'
|
46
46
|
},
|
47
|
-
|
48
|
-
enable: !{theme.
|
49
|
-
limit: !{theme.
|
50
|
-
expand: !{theme.
|
51
|
-
copy: !{theme.
|
47
|
+
highlight: {
|
48
|
+
enable: !{theme.highlight.enable},
|
49
|
+
limit: !{theme.highlight.limit},
|
50
|
+
expand: !{theme.highlight.expand},
|
51
|
+
copy: !{theme.highlight.copy},
|
52
|
+
syntax: '!{config.syntax_highlighter}'
|
52
53
|
},
|
53
54
|
randomlinks: !{theme.footer.randomlink},
|
54
55
|
lang: {
|
@@ -78,7 +78,7 @@ script.
|
|
78
78
|
)(window)
|
79
79
|
|
80
80
|
console.log(
|
81
|
-
"%c Program: Hexo %c Theme: Solitude %c Version: v1.5.
|
81
|
+
"%c Program: Hexo %c Theme: Solitude %c Version: v1.5.10",
|
82
82
|
"border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
|
83
83
|
"padding: 5px 10px;color:white;background:#3e9f50;",
|
84
84
|
"border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
|
@@ -31,7 +31,7 @@ if theme.says.enable
|
|
31
31
|
if item.video.player
|
32
32
|
video(src=item.video.player controls="controls" style="object-fit: cover;")
|
33
33
|
if item.video.bilibili
|
34
|
-
iframe(src='//player.bilibili.com/player.html?
|
34
|
+
iframe(src='//player.bilibili.com/player.html?autoplay=0&bvid=' + item.video.bilibili scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true")
|
35
35
|
|
36
36
|
if theme.says.style === 1
|
37
37
|
hr
|
@@ -51,4 +51,4 @@ if theme.says.enable
|
|
51
51
|
if theme.says.strip === -1
|
52
52
|
| - 已展开所有短文 -
|
53
53
|
else
|
54
|
-
| - 只展示最近 #{theme.says.strip} 条短文 -
|
54
|
+
| - 只展示最近 #{theme.says.strip} 条短文 -
|
package/package.json
CHANGED
package/plugins.yml
CHANGED
package/scripts/event/cdn.js
CHANGED
@@ -120,8 +120,7 @@ hexo.extend.filter.register('before_generate', () => {
|
|
120
120
|
jsdelivr: `https://cdn.jsdelivr.net/npm/${name}${verType}/${min_file}`,
|
121
121
|
unpkg: `https://unpkg.com/${name}${verType}/${file}`,
|
122
122
|
cdnjs: `https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${min_cdnjs_file}`,
|
123
|
-
custom: (CDN.custom_format || '').replace(/\$\{(.+?)
|
124
|
-
cdncbd: `https://cdn.cbd.int/${name}${verType}/${file}`,
|
123
|
+
custom: (CDN.custom_format || '').replace(/\$\{(.+?)}/g, (match, $1) => value[$1]),
|
125
124
|
}
|
126
125
|
|
127
126
|
data[key] = cdnSource[type]
|
package/scripts/event/init.js
CHANGED
@@ -10,13 +10,8 @@ hexo.extend.filter.register('before_generate', () => {
|
|
10
10
|
process.exit(-1);
|
11
11
|
}
|
12
12
|
|
13
|
-
if (config.prismjs.enable) {
|
14
|
-
logger.error('主题尚未支持 prismjs 请使用 highlightjs !');
|
15
|
-
process.exit(-1);
|
16
|
-
}
|
17
|
-
|
18
13
|
if (Number(majorVer) < 14) {
|
19
14
|
logger.error('请将 Node.js 升级到 v14.0.0 或更高的版本!');
|
20
15
|
process.exit(-1);
|
21
16
|
}
|
22
|
-
});
|
17
|
+
});
|
@@ -1,24 +1,23 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
hexo.extend.filter.register('after_post_render', function (data) {
|
4
|
-
|
5
|
-
|
4
|
+
data.title = data.title || 'Untitled';
|
5
|
+
const { config } = hexo.theme;
|
6
6
|
if (data.layout === 'post') {
|
7
|
-
|
8
|
-
data.
|
9
|
-
data.
|
7
|
+
const { copyright, locate,cover } = hexo.theme.config.post.default
|
8
|
+
data.locate = data.locate || locate
|
9
|
+
data.cc = data.cc || copyright
|
10
|
+
data.cover = data.cover || cover ? cover[getRandomInt(0, cover?.length)] : '/img/default.png'
|
10
11
|
data.excerpt = data.description || data.excerpt
|
11
|
-
|
12
|
-
else data.toc = false
|
12
|
+
data.toc = !!(config.aside.toc.post && data.toc !== false);
|
13
13
|
}
|
14
14
|
if (data.layout === 'page') {
|
15
|
-
|
15
|
+
const { cover } = hexo.theme.config.page.default
|
16
|
+
data.cover = data.cover || cover ? cover[getRandomInt(0, cover?.length)] :'/img/default.png'
|
16
17
|
data.excerpt = data.title
|
17
|
-
|
18
|
-
else data.toc = false
|
18
|
+
data.toc = !!(config.aside.toc.page && data.toc !== false && data.aside);
|
19
19
|
}
|
20
|
-
|
21
|
-
else data.comment = false
|
20
|
+
data.comment = !!(config.comment.enable && data.comment !== false);
|
22
21
|
return data;
|
23
22
|
});
|
24
23
|
|
@@ -1,8 +1,5 @@
|
|
1
1
|
hexo.extend.filter.register('after_render:html', function (data) {
|
2
|
-
const posts =
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
data += `<script>const posts=${JSON.stringify(posts)};function toRandomPost(){ pjax.loadUrl('/'+posts[Math.floor(Math.random()*posts.length)]); };</script>`
|
7
|
-
return data
|
8
|
-
})
|
2
|
+
const posts = hexo.locals.get('posts').filter(post => post.random !== false).map(post => post.path);
|
3
|
+
data += `<script>const posts=${JSON.stringify(posts)};function toRandomPost(){ pjax.loadUrl('/'+posts[Math.floor(Math.random()*posts.length)]); };</script>`;
|
4
|
+
return data;
|
5
|
+
});
|
package/scripts/helper/stylus.js
CHANGED
@@ -23,6 +23,22 @@ hexo.extend.filter.register('stylus:renderer', function (style) {
|
|
23
23
|
style.define('about', data && data.about ? Object.keys(data.about) : []);
|
24
24
|
|
25
25
|
initGroupColor(theme.config.hometop.group,style);
|
26
|
+
|
27
|
+
// hightlight
|
28
|
+
const { syntax_highlighter: syntaxHighlighter, highlight, prismjs } = hexo.config
|
29
|
+
let { enable: highlightEnable, line_number: highlightLineNumber } = highlight
|
30
|
+
let { enable: prismjsEnable, line_number: prismjsLineNumber } = prismjs
|
31
|
+
|
32
|
+
// for hexo > 7.0
|
33
|
+
if (syntaxHighlighter) {
|
34
|
+
highlightEnable = syntaxHighlighter === 'highlight.js'
|
35
|
+
prismjsEnable = syntaxHighlighter === 'prismjs'
|
36
|
+
}
|
37
|
+
|
38
|
+
style.define('$highlight_enable', highlightEnable)
|
39
|
+
style.define('$highlight_line_number', highlightLineNumber)
|
40
|
+
style.define('$prismjs_enable', prismjsEnable)
|
41
|
+
style.define('$prismjs_line_number', prismjsLineNumber)
|
26
42
|
});
|
27
43
|
|
28
44
|
function initGroupColor(gg,style) {
|
package/scripts/tags/bvideo.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
'use strict'
|
2
2
|
|
3
3
|
function bilibili(args) {
|
4
|
-
return `<iframe class="bvideo" width="100%" height="600" src="//player.bilibili.com/player.html?
|
4
|
+
return `<iframe class="bvideo" width="100%" height="600" src="//player.bilibili.com/player.html?autoplay=0&bvid=${args}" border="0" frameBorder="no" framespacing="0" allowFullScreen="true"></iframe>`
|
5
5
|
}
|
6
6
|
|
7
|
-
hexo.extend.tag.register('bvideo', bilibili, {ends: false})
|
7
|
+
hexo.extend.tag.register('bvideo', bilibili, {ends: false})
|
@@ -0,0 +1,45 @@
|
|
1
|
+
@import "diff"
|
2
|
+
figure
|
3
|
+
pre
|
4
|
+
margin 0
|
5
|
+
padding 8px 0
|
6
|
+
border none
|
7
|
+
table
|
8
|
+
display block
|
9
|
+
border none
|
10
|
+
overflow-y hidden
|
11
|
+
overflow-x auto
|
12
|
+
|
13
|
+
td
|
14
|
+
padding 0
|
15
|
+
border none
|
16
|
+
height 100%
|
17
|
+
|
18
|
+
&.gutter
|
19
|
+
opacity .6
|
20
|
+
user-select none
|
21
|
+
|
22
|
+
pre
|
23
|
+
overflow auto
|
24
|
+
line-height 1.6
|
25
|
+
margin 0
|
26
|
+
padding 8px .5rem
|
27
|
+
border none
|
28
|
+
color var(--efu-secondtext)
|
29
|
+
background var(--efu-secondbg)
|
30
|
+
border-right var(--style-border-always)
|
31
|
+
text-align right
|
32
|
+
|
33
|
+
&.code
|
34
|
+
width 100%
|
35
|
+
display flex
|
36
|
+
position relative
|
37
|
+
|
38
|
+
pre
|
39
|
+
padding-right .5rem
|
40
|
+
padding-left .5rem
|
41
|
+
width 100%
|
42
|
+
|
43
|
+
.line
|
44
|
+
&.marked
|
45
|
+
background-color: rgba(97, 97, 97, .314)
|
@@ -1,3 +1,13 @@
|
|
1
|
+
@import "color"
|
2
|
+
|
3
|
+
@import "theme/" + hexo-config('highlight.theme')
|
4
|
+
|
5
|
+
if $highlight_enable
|
6
|
+
@require "highlight/index.styl"
|
7
|
+
|
8
|
+
if $prismjs_enable
|
9
|
+
@require "prismjs/index.styl"
|
10
|
+
|
1
11
|
figure
|
2
12
|
&:hover
|
3
13
|
box-shadow var(--efu-shadow-border-hover)
|
@@ -25,11 +35,6 @@ figure
|
|
25
35
|
padding 0
|
26
36
|
line-height 1.6
|
27
37
|
|
28
|
-
pre
|
29
|
-
margin 0
|
30
|
-
padding 8px 0
|
31
|
-
border none
|
32
|
-
|
33
38
|
.highlight-tools
|
34
39
|
position relative
|
35
40
|
display flex
|
@@ -43,6 +48,13 @@ figure
|
|
43
48
|
border-bottom var(--style-border-always)
|
44
49
|
color var(--efu-fontcolor)
|
45
50
|
|
51
|
+
&.closed
|
52
|
+
.expand
|
53
|
+
transition all .3s ease 0s
|
54
|
+
|
55
|
+
& ~ *
|
56
|
+
display none
|
57
|
+
|
46
58
|
.st-copy-fill
|
47
59
|
position absolute
|
48
60
|
cursor pointer
|
@@ -58,9 +70,6 @@ figure
|
|
58
70
|
cursor pointer
|
59
71
|
transition transform .3s ease 0s
|
60
72
|
|
61
|
-
&.closed
|
62
|
-
transition all .3s ease 0s
|
63
|
-
|
64
73
|
.code-lang
|
65
74
|
text-transform capitalize
|
66
75
|
position absolute
|
@@ -97,47 +106,11 @@ figure
|
|
97
106
|
i
|
98
107
|
color var(--efu-white)
|
99
108
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
border none
|
109
|
-
height 100%
|
110
|
-
|
111
|
-
&.gutter
|
112
|
-
opacity .6
|
113
|
-
user-select none
|
114
|
-
|
115
|
-
pre
|
116
|
-
overflow auto
|
117
|
-
line-height 1.6
|
118
|
-
margin 0
|
119
|
-
padding 8px .5rem
|
120
|
-
border none
|
121
|
-
color var(--efu-secondtext)
|
122
|
-
background var(--efu-secondbg)
|
123
|
-
border-right var(--style-border-always)
|
124
|
-
text-align right
|
125
|
-
|
126
|
-
&.code
|
127
|
-
width 100%
|
128
|
-
display flex
|
129
|
-
position relative
|
130
|
-
|
131
|
-
pre
|
132
|
-
padding-right .5rem
|
133
|
-
padding-left .5rem
|
134
|
-
width 100%
|
135
|
-
|
136
|
-
.line
|
137
|
-
&.marked
|
138
|
-
background-color: rgba(97, 97, 97, .314)
|
139
|
-
|
140
|
-
@import "theme"
|
141
|
-
@import "diff"
|
142
|
-
|
143
|
-
@import "theme/" + hexo-config('hightlight.theme')
|
109
|
+
&.expand-done
|
110
|
+
display none
|
111
|
+
|
112
|
+
&:not(.expand-done)
|
113
|
+
& ~ table,
|
114
|
+
& ~ pre
|
115
|
+
overflow: hidden
|
116
|
+
height: unit(hexo-config('highlight.limit'), px)
|
@@ -0,0 +1,184 @@
|
|
1
|
+
if hexo-config('hightlight.color') == 'default'
|
2
|
+
pre[class*='language-']
|
3
|
+
.token.function
|
4
|
+
color: #ffb62c
|
5
|
+
|
6
|
+
.token.comment,
|
7
|
+
.token.prolog,
|
8
|
+
.token.doctype,
|
9
|
+
.token.cdata
|
10
|
+
color: rgba(149, 165, 166, .8)
|
11
|
+
|
12
|
+
.token.punctuation
|
13
|
+
color: #5e6687
|
14
|
+
|
15
|
+
.token.namespace
|
16
|
+
opacity: .7
|
17
|
+
|
18
|
+
.token.operator,
|
19
|
+
.token.boolean,
|
20
|
+
.token.number
|
21
|
+
color: #c76b29
|
22
|
+
|
23
|
+
.token.property
|
24
|
+
color: #c08b30
|
25
|
+
|
26
|
+
.token.tag
|
27
|
+
color: #3d8fd1
|
28
|
+
|
29
|
+
.token.string
|
30
|
+
color: #22a2c9
|
31
|
+
|
32
|
+
.token.selector
|
33
|
+
color: #6679cc
|
34
|
+
|
35
|
+
.token.attr-name
|
36
|
+
color: #c76b29
|
37
|
+
|
38
|
+
.token.entity,
|
39
|
+
.token.url,
|
40
|
+
.language-css .token.string,
|
41
|
+
.style .token.string
|
42
|
+
color: #22a2c9
|
43
|
+
|
44
|
+
.token.attr-value,
|
45
|
+
.token.keyword,
|
46
|
+
.token.control,
|
47
|
+
.token.directive,
|
48
|
+
.token.unit
|
49
|
+
color: #ac9739
|
50
|
+
|
51
|
+
.token.statement,
|
52
|
+
.token.regex,
|
53
|
+
.token.atrule
|
54
|
+
color: #22a2c9
|
55
|
+
|
56
|
+
.token.placeholder,
|
57
|
+
.token.variable
|
58
|
+
color: #3d8fd1
|
59
|
+
|
60
|
+
.token.deleted
|
61
|
+
text-decoration: line-through
|
62
|
+
|
63
|
+
.token.inserted
|
64
|
+
border-bottom: 1px dotted #202746
|
65
|
+
text-decoration: none
|
66
|
+
|
67
|
+
.token.italic
|
68
|
+
font-style: italic
|
69
|
+
|
70
|
+
.token.important,
|
71
|
+
.token.bold
|
72
|
+
font-weight: bold
|
73
|
+
|
74
|
+
.token.important
|
75
|
+
color: #c94922
|
76
|
+
|
77
|
+
.token.entity
|
78
|
+
cursor: help
|
79
|
+
|
80
|
+
pre > code.highlight
|
81
|
+
outline: .4em solid #c94922
|
82
|
+
outline-offset: .4em
|
83
|
+
|
84
|
+
if hexo-config('hightlight.color') == 'vscode'
|
85
|
+
pre[class*='language-']
|
86
|
+
.token.comment
|
87
|
+
color #6a737d
|
88
|
+
|
89
|
+
.token.prolog
|
90
|
+
color #6a737d
|
91
|
+
|
92
|
+
.token.doctype
|
93
|
+
color #6a737d
|
94
|
+
|
95
|
+
.token.cdata
|
96
|
+
color #6a737d
|
97
|
+
|
98
|
+
.token.punctuation
|
99
|
+
color #d4d4d4
|
100
|
+
|
101
|
+
.token.namespace
|
102
|
+
opacity .7
|
103
|
+
|
104
|
+
.token.operator
|
105
|
+
color #d4d4d4
|
106
|
+
|
107
|
+
.token.boolean
|
108
|
+
color #4ec9b0
|
109
|
+
|
110
|
+
.token.number
|
111
|
+
color #4ec9b0
|
112
|
+
|
113
|
+
.token.property
|
114
|
+
color #c08b30
|
115
|
+
|
116
|
+
.token.tag
|
117
|
+
color #3d8fd1
|
118
|
+
|
119
|
+
.token.string
|
120
|
+
color #4ec9b0
|
121
|
+
|
122
|
+
.token.selector
|
123
|
+
color #6679cc
|
124
|
+
|
125
|
+
.token.attr-name
|
126
|
+
color #c76b29
|
127
|
+
|
128
|
+
.token.entity
|
129
|
+
color #c76b29
|
130
|
+
|
131
|
+
.token.url
|
132
|
+
color #22a2c9
|
133
|
+
|
134
|
+
.token.attr-value
|
135
|
+
color #4ec9b0
|
136
|
+
|
137
|
+
.token.keyword
|
138
|
+
color #c94922
|
139
|
+
|
140
|
+
.token.control
|
141
|
+
color #c94922
|
142
|
+
|
143
|
+
.token.directive
|
144
|
+
color #c94922
|
145
|
+
|
146
|
+
.token.unit
|
147
|
+
color #c94922
|
148
|
+
|
149
|
+
.token.statement
|
150
|
+
color #c94922
|
151
|
+
|
152
|
+
.token.regex
|
153
|
+
color #22a2c9
|
154
|
+
|
155
|
+
.token.atrule
|
156
|
+
color #22a2c9
|
157
|
+
|
158
|
+
.token.placeholder
|
159
|
+
color #3d8fd1
|
160
|
+
|
161
|
+
.token.variable
|
162
|
+
color #3d8fd1
|
163
|
+
|
164
|
+
.token.deleted
|
165
|
+
color #c94922
|
166
|
+
|
167
|
+
.token.inserted
|
168
|
+
color #4ec9b0
|
169
|
+
|
170
|
+
.token.italic
|
171
|
+
font-style italic
|
172
|
+
|
173
|
+
.token.important
|
174
|
+
font-weight bold
|
175
|
+
|
176
|
+
.token.important
|
177
|
+
color #c94922
|
178
|
+
|
179
|
+
.token.entity
|
180
|
+
cursor help
|
181
|
+
|
182
|
+
pre > code.highlight
|
183
|
+
outline .4em solid #c94922
|
184
|
+
outline-offset .4em
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#article-container
|
2
|
+
pre[class*='language-']
|
3
|
+
&.line-numbers
|
4
|
+
position relative
|
5
|
+
margin 0
|
6
|
+
overflow-x auto
|
7
|
+
|
8
|
+
> code
|
9
|
+
display block
|
10
|
+
position relative
|
11
|
+
padding 8px 0 8px 45px
|
12
|
+
|
13
|
+
.line-numbers-rows
|
14
|
+
position absolute
|
15
|
+
top 0
|
16
|
+
left 0
|
17
|
+
color var(--efu-secondtext)
|
18
|
+
background var(--efu-hltools-bg)
|
19
|
+
border-right var(--style-border-always)
|
20
|
+
padding 8px 0
|
21
|
+
|
22
|
+
& > span
|
23
|
+
display block
|
24
|
+
counter-increment linenumber
|
25
|
+
pointer-events none
|
26
|
+
text-align center
|
27
|
+
|
28
|
+
&:before
|
29
|
+
padding 0 0.5em
|
30
|
+
content counter(linenumber)
|
@@ -53,7 +53,7 @@ div#banners
|
|
53
53
|
margin-right 8px
|
54
54
|
font-size 1rem
|
55
55
|
|
56
|
-
|
56
|
+
/.banners-title
|
57
57
|
top 2.6rem
|
58
58
|
left 2rem
|
59
59
|
position absolute
|
@@ -62,7 +62,7 @@ div#banners
|
|
62
62
|
|
63
63
|
&-big
|
64
64
|
font-size 36px
|
65
|
-
line-height 1
|
65
|
+
line-height 1
|
66
66
|
font-weight 700
|
67
67
|
margin-bottom 8px
|
68
68
|
|
@@ -74,7 +74,7 @@ div#banners
|
|
74
74
|
margin-bottom 0.5rem
|
75
75
|
margin-left 2px
|
76
76
|
|
77
|
-
|
77
|
+
/.flink
|
78
78
|
.banners-title
|
79
79
|
top 1.5rem
|
80
80
|
|
package/source/css/index.styl
CHANGED
package/source/js/main.js
CHANGED
@@ -658,72 +658,103 @@ let sco = {
|
|
658
658
|
},
|
659
659
|
}
|
660
660
|
|
661
|
-
|
662
|
-
|
661
|
+
const AddHighLightTool = () => {
|
662
|
+
const highlight = GLOBAL_CONFIG.highlight;
|
663
|
+
if (!highlight) return;
|
664
|
+
|
665
|
+
const {copy, expand, limit, syntax} = highlight;
|
666
|
+
const $isPrismjs = syntax === 'prismjs';
|
667
|
+
const $isShowTool = highlight.enable || copy || expand || limit;
|
668
|
+
const expandClass = !expand === true ? 'closed' : ''
|
669
|
+
const $syntaxHighlight = syntax === 'highlight.js' ? document.querySelectorAll('figure.highlight') : document.querySelectorAll('pre[class*="language-"]')
|
670
|
+
|
671
|
+
if (!(($isShowTool || limit) && $syntaxHighlight.length)) return
|
672
|
+
|
673
|
+
const copyEle = copy ? `<i class="solitude st-copy-fill copy-button"></i>` : '<i></i>';
|
674
|
+
const expandEle = `<i class="solitude st-arrow-down expand"></i>`;
|
675
|
+
const limitEle = limit ? `<i class="solitude st-show-line"></i>` : '<i></i>';
|
676
|
+
|
677
|
+
const alertInfo = (ele, text) => {
|
678
|
+
utils.snackbarShow(text, false, 2000);
|
679
|
+
}
|
680
|
+
|
681
|
+
const copyCode = (e) => {
|
682
|
+
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
|
683
|
+
document.execCommand('copy')
|
684
|
+
alertInfo(e, GLOBAL_CONFIG.lang.copy.success)
|
685
|
+
} else {
|
686
|
+
alertInfo(e, GLOBAL_CONFIG.lang.copy.error)
|
687
|
+
}
|
688
|
+
}
|
689
|
+
|
690
|
+
const copyFn = (e) => {
|
691
|
+
const $buttonParent = e.parentNode
|
692
|
+
$buttonParent.classList.add('copy-true')
|
693
|
+
const selection = window.getSelection()
|
694
|
+
const range = document.createRange()
|
695
|
+
const preCodeSelector = $isPrismjs ? 'pre code' : 'table .code pre'
|
696
|
+
range.selectNodeContents($buttonParent.querySelectorAll(`${preCodeSelector}`)[0])
|
697
|
+
selection.removeAllRanges()
|
698
|
+
selection.addRange(range)
|
699
|
+
copyCode(e.lastChild)
|
700
|
+
selection.removeAllRanges()
|
701
|
+
$buttonParent.classList.remove('copy-true')
|
702
|
+
}
|
703
|
+
|
704
|
+
const expandClose = (e) => {
|
705
|
+
e.classList.toggle('closed')
|
706
|
+
}
|
707
|
+
|
708
|
+
const shrinkEle = function () {
|
709
|
+
this.classList.toggle('expand-done')
|
710
|
+
}
|
711
|
+
|
712
|
+
const ToolsFn = function (e) {
|
713
|
+
const $target = e.target.classList
|
714
|
+
if ($target.contains('expand')) expandClose(this)
|
715
|
+
else if ($target.contains('copy-button')) copyFn(this)
|
716
|
+
}
|
717
|
+
|
718
|
+
const createEle = (lang, item, service) => {
|
663
719
|
const fragment = document.createDocumentFragment()
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
$expand[0].setAttribute('style', 'display:none')
|
677
|
-
}
|
678
|
-
} else {
|
679
|
-
hlTools.children[0].classList.remove('closed')
|
680
|
-
$table.setAttribute('style', 'display:block')
|
681
|
-
if ($expand.length !== 0) {
|
682
|
-
$expand[0].setAttribute('style', 'display:block')
|
683
|
-
}
|
684
|
-
if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit) {
|
685
|
-
$table.setAttribute('style', `height: ${GLOBAL_CONFIG.hightlight.limit}px`)
|
686
|
-
} else {
|
687
|
-
$table.setAttribute('style', `height: auto`)
|
688
|
-
}
|
689
|
-
}
|
690
|
-
expand = !expand
|
691
|
-
})
|
692
|
-
hlTools.children[2].addEventListener('click', (e) => {
|
693
|
-
utils.copy($table.querySelector('.code').innerText)
|
694
|
-
})
|
695
|
-
const ele = document.createElement('div')
|
696
|
-
fragment.appendChild(hlTools)
|
697
|
-
const itemHeight = item.clientHeight, $table = item.querySelector('table'),
|
698
|
-
$expand = item.getElementsByClassName('code-expand-btn')
|
699
|
-
if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit) {
|
700
|
-
$table.setAttribute('style', `height: ${GLOBAL_CONFIG.hightlight.limit}px`)
|
720
|
+
|
721
|
+
if ($isShowTool) {
|
722
|
+
const hlTools = document.createElement('div')
|
723
|
+
hlTools.className = `highlight-tools ${expandClass}`
|
724
|
+
hlTools.innerHTML = expandEle + lang + copyEle
|
725
|
+
utils.addEventListenerPjax(hlTools, 'click', ToolsFn)
|
726
|
+
fragment.appendChild(hlTools)
|
727
|
+
}
|
728
|
+
|
729
|
+
if (limit && item.offsetHeight > limit + 30) {
|
730
|
+
|
731
|
+
const ele = document.createElement('div')
|
701
732
|
ele.className = 'code-expand-btn'
|
702
|
-
ele.innerHTML =
|
703
|
-
|
704
|
-
$table.setAttribute('style', `height: ${itemHeight}px`)
|
705
|
-
e.target.classList.add('expand-done')
|
706
|
-
e.target.setAttribute('style', 'display:none')
|
707
|
-
})
|
733
|
+
ele.innerHTML = limitEle
|
734
|
+
utils.addEventListenerPjax(ele, 'click', shrinkEle)
|
708
735
|
fragment.appendChild(ele)
|
709
736
|
}
|
710
|
-
|
711
|
-
if (
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
$expand[0].setAttribute('style', 'display:none')
|
716
|
-
}
|
737
|
+
|
738
|
+
if (service === 'hl') {
|
739
|
+
item.insertBefore(fragment, item.firstChild)
|
740
|
+
} else {
|
741
|
+
item.parentNode.insertBefore(fragment, item)
|
717
742
|
}
|
718
743
|
}
|
719
744
|
|
720
|
-
|
721
|
-
|
722
|
-
|
745
|
+
if ($isPrismjs) {
|
746
|
+
$syntaxHighlight.forEach(item => {
|
747
|
+
const langName = item.getAttribute('data-language') || 'Code'
|
748
|
+
const highlightLangEle = `<div class="code-lang">${langName}</div>`
|
749
|
+
utils.wrap(item, 'figure', {class: 'highlight'})
|
750
|
+
createEle(highlightLangEle, item)
|
751
|
+
})
|
752
|
+
} else {
|
753
|
+
$syntaxHighlight.forEach(item => {
|
723
754
|
let langName = item.getAttribute('class').split(' ')[1]
|
724
|
-
if (langName === '
|
725
|
-
const highlightLangEle = `<div class="code-lang">${langName
|
726
|
-
|
755
|
+
if (langName === 'plain' || langName === undefined) langName = 'Code'
|
756
|
+
const highlightLangEle = `<div class="code-lang">${langName}</div>`
|
757
|
+
createEle(highlightLangEle, item, 'hl')
|
727
758
|
})
|
728
759
|
}
|
729
760
|
}
|
@@ -785,7 +816,7 @@ window.refreshFn = () => {
|
|
785
816
|
GLOBAL_CONFIG.randomlinks && randomLinksList()
|
786
817
|
PAGE_CONFIG.comment && initComment()
|
787
818
|
PAGE_CONFIG.toc && toc.init();
|
788
|
-
(PAGE_CONFIG.is_post || PAGE_CONFIG.is_page) && ((
|
819
|
+
(PAGE_CONFIG.is_post || PAGE_CONFIG.is_page) && ((AddHighLightTool()) || tabs.init())
|
789
820
|
PAGE_CONFIG.is_home && showTodayCard()
|
790
821
|
GLOBAL_CONFIG.covercolor.enable && coverColor()
|
791
822
|
sco.initConsoleState()
|
package/source/js/utils.js
CHANGED
@@ -136,12 +136,11 @@ const utils = {
|
|
136
136
|
},
|
137
137
|
isMobile: () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
|
138
138
|
isHidden: e => 0 === e.offsetHeight && 0 === e.offsetWidth,
|
139
|
-
addEventListenerPjax:
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
});
|
139
|
+
addEventListenerPjax: (ele, event, fn, option = false) => {
|
140
|
+
ele.addEventListener(event, fn, option)
|
141
|
+
utils.addGlobalFn('pjax', () => {
|
142
|
+
ele.removeEventListener(event, fn, option)
|
143
|
+
})
|
145
144
|
},
|
146
145
|
addGlobalFn: (key, fn, name = false, parent = window) => {
|
147
146
|
const globalFn = parent.globalFn || {}
|
File without changes
|
File without changes
|