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.
- package/README.md +2 -2
- package/_config.yml +32 -34
- package/layout/404.ejs +1 -1
- package/layout/_partial/cover/wiki_cover.ejs +1 -1
- package/layout/_partial/plugins/comments/artalk/layout.ejs +19 -0
- package/layout/_partial/plugins/comments/artalk/script.ejs +25 -0
- package/layout/_partial/plugins/comments/layout.ejs +4 -4
- package/layout/_partial/scripts/index.ejs +1 -1
- package/layout/_partial/widgets/toc.ejs +1 -1
- package/package.json +1 -1
- package/scripts/tags/index.js +32 -6
- package/scripts/tags/inline-labels.js +27 -27
- package/scripts/tags/lib/ablock.js +33 -0
- package/scripts/tags/lib/about.js +48 -0
- package/scripts/tags/lib/checkbox.js +30 -0
- package/scripts/tags/{copy.js → lib/copy.js} +23 -23
- package/scripts/tags/lib/emoji.js +40 -0
- package/scripts/tags/{folders.js → lib/folders.js} +22 -22
- package/scripts/tags/lib/folding.js +30 -0
- package/scripts/tags/lib/frame.js +66 -0
- package/scripts/tags/lib/friends.js +53 -0
- package/scripts/tags/{ghcard.js → lib/ghcard.js} +18 -18
- package/scripts/tags/{grid.js → lib/grid.js} +20 -20
- package/scripts/tags/{image.js → lib/image.js} +38 -38
- package/scripts/tags/lib/link.js +78 -0
- package/scripts/tags/lib/mark.js +23 -0
- package/scripts/tags/lib/navbar.js +57 -0
- package/scripts/tags/lib/note.js +35 -0
- package/scripts/tags/lib/poetry.js +47 -0
- package/scripts/tags/{quot.js → lib/quot.js} +24 -24
- package/scripts/tags/lib/sites.js +57 -0
- package/scripts/tags/lib/swiper.js +36 -0
- package/scripts/tags/lib/tabs.js +33 -33
- package/scripts/tags/{tag.js → lib/tag.js} +13 -13
- package/scripts/tags/lib/timeline.js +78 -0
- package/scripts/tags/lib/toc.js +73 -0
- package/source/css/_common/base.styl +2 -2
- package/source/css/_common/blockquote.styl +2 -2
- package/source/css/_common/button.styl +38 -2
- package/source/css/_common/highlight.styl +11 -10
- package/source/css/_custom.styl +17 -8
- package/source/css/_defines/func.styl +1 -1
- package/source/css/_defines/theme.styl +5 -7
- package/source/css/_layout/list.styl +0 -1
- package/source/css/_layout/md.styl +15 -13
- package/source/css/_layout/pages/archives.styl +1 -1
- package/source/css/_layout/pages/error.styl +0 -1
- package/source/css/_layout/partial/related.styl +8 -6
- package/source/css/_layout/sidebar/header.styl +1 -1
- package/source/css/_layout/sidebar/sidebar.styl +2 -1
- package/source/css/_layout/tag-plugins/checkbox.styl +3 -4
- package/source/css/_layout/tag-plugins/common.styl +6 -6
- package/source/css/_layout/tag-plugins/copy.styl +1 -1
- package/source/css/_layout/tag-plugins/folders.styl +9 -9
- package/source/css/_layout/tag-plugins/folding.styl +5 -4
- package/source/css/_layout/tag-plugins/grid.styl +4 -1
- package/source/css/_layout/tag-plugins/link.styl +1 -1
- package/source/css/_layout/tag-plugins/note.styl +9 -10
- package/source/css/_layout/tag-plugins/quot.styl +6 -6
- package/source/css/_layout/tag-plugins/tabs.styl +2 -2
- package/source/css/_layout/tag-plugins/timeline.styl +1 -5
- package/source/css/_layout/tag-plugins/toc.styl +1 -1
- package/source/css/_layout/widgets/search.styl +28 -18
- package/source/css/_layout/widgets/toc_wiki.styl +1 -1
- package/source/css/_plugins/aplayer.styl +3 -0
- package/source/css/_plugins/comments/artalk.styl +4 -0
- package/source/css/_plugins/comments/utterances.styl +1 -1
- package/source/css/_plugins/index.styl +4 -0
- package/source/css/_plugins/swiper.styl +17 -7
- package/source/js/main.js +30 -6
- package/scripts/tags/ablock.js +0 -33
- package/scripts/tags/about.js +0 -48
- package/scripts/tags/checkbox.js +0 -38
- package/scripts/tags/emoji.js +0 -40
- package/scripts/tags/folding.js +0 -30
- package/scripts/tags/frame.js +0 -66
- package/scripts/tags/friends.js +0 -53
- package/scripts/tags/lib/users.js +0 -22
- package/scripts/tags/link.js +0 -79
- package/scripts/tags/mark.js +0 -23
- package/scripts/tags/navbar.js +0 -57
- package/scripts/tags/note.js +0 -35
- package/scripts/tags/poetry.js +0 -47
- package/scripts/tags/sites.js +0 -57
- package/scripts/tags/swiper.js +0 -38
- package/scripts/tags/timeline.js +0 -81
- package/scripts/tags/toc.js +0 -72
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* poetry.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
+
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
+
*
|
|
5
|
+
* poetry:
|
|
6
|
+
* {% poetry [title] [author:作者] [date:日期] [footer:footer] %}
|
|
7
|
+
* body
|
|
8
|
+
* {% endpoetry %}
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict'
|
|
13
|
+
|
|
14
|
+
module.exports = ctx => function(args, content) {
|
|
15
|
+
var el = ''
|
|
16
|
+
args = ctx.args.map(args, ['author', 'date', 'footer'], ['title'])
|
|
17
|
+
|
|
18
|
+
el += '<div class="tag-plugin poetry"'
|
|
19
|
+
el += '>'
|
|
20
|
+
el += '<div class="content">'
|
|
21
|
+
if (args.title) {
|
|
22
|
+
el += '<div class="title">'
|
|
23
|
+
el += args.title
|
|
24
|
+
el += '</div>'
|
|
25
|
+
}
|
|
26
|
+
if (args.author || args.date) {
|
|
27
|
+
el += '<div class="meta">'
|
|
28
|
+
if (args.author) {
|
|
29
|
+
el += '<span>' + args.author + '</span>'
|
|
30
|
+
}
|
|
31
|
+
if (args.date) {
|
|
32
|
+
el += '<span>' + args.date + '</span>'
|
|
33
|
+
}
|
|
34
|
+
el += '</div>'
|
|
35
|
+
}
|
|
36
|
+
el += '<div class="body">'
|
|
37
|
+
el += ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')
|
|
38
|
+
el += '</div>'
|
|
39
|
+
if (args.footer) {
|
|
40
|
+
el += '<div class="footer">'
|
|
41
|
+
el += args.footer
|
|
42
|
+
el += '</div>'
|
|
43
|
+
}
|
|
44
|
+
el += '</div>'
|
|
45
|
+
el += '</div>'
|
|
46
|
+
return el
|
|
47
|
+
}
|
|
@@ -7,49 +7,49 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict'
|
|
10
|
+
'use strict'
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
var el = ''
|
|
14
|
-
args =
|
|
12
|
+
module.exports = ctx => function(args) {
|
|
13
|
+
var el = ''
|
|
14
|
+
args = ctx.args.map(args, ['el', 'icon'], ['text'])
|
|
15
15
|
if (!args.el) {
|
|
16
|
-
args.el = 'p'
|
|
16
|
+
args.el = 'p'
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
var type = ''
|
|
19
|
+
var type = ''
|
|
20
20
|
if (args.icon && args.icon != 'square' && args.icon != 'quotes') {
|
|
21
|
-
type = ' type="icon"'
|
|
21
|
+
type = ' type="icon"'
|
|
22
22
|
} else {
|
|
23
|
-
type = ' type="text"'
|
|
23
|
+
type = ' type="text"'
|
|
24
24
|
}
|
|
25
25
|
function content() {
|
|
26
26
|
if (!args.icon) {
|
|
27
|
-
return args.text
|
|
27
|
+
return args.text
|
|
28
28
|
}
|
|
29
|
-
var el = ''
|
|
30
|
-
const cfg =
|
|
29
|
+
var el = ''
|
|
30
|
+
const cfg = ctx.theme.config.tag_plugins.quot[args.icon]
|
|
31
31
|
if (cfg && cfg.prefix) {
|
|
32
|
-
el += '<img class="icon prefix" src="' + cfg.prefix + '" />'
|
|
32
|
+
el += '<img class="icon prefix" src="' + cfg.prefix + '" />'
|
|
33
33
|
}
|
|
34
|
-
el += args.text
|
|
34
|
+
el += args.text
|
|
35
35
|
if (cfg && cfg.suffix) {
|
|
36
|
-
el += '<img class="icon suffix" src="' + cfg.suffix + '" />'
|
|
36
|
+
el += '<img class="icon suffix" src="' + cfg.suffix + '" />'
|
|
37
37
|
}
|
|
38
|
-
return el
|
|
38
|
+
return el
|
|
39
39
|
}
|
|
40
40
|
if (args.el.includes('h')) {
|
|
41
41
|
el += '<div' + ' class="tag-plugin quot">'
|
|
42
|
-
el += '<' + args.el + ' class="content" id="' + args.text + '"' + type + '>'
|
|
43
|
-
el += '<a href="#' + args.text + '" class="headerlink" title="' + args.text + '"></a>'
|
|
44
|
-
el += content()
|
|
45
|
-
el += '</' + args.el + '>'
|
|
42
|
+
el += '<' + args.el + ' class="content" id="' + args.text + '"' + type + '>'
|
|
43
|
+
el += '<a href="#' + args.text + '" class="headerlink" title="' + args.text + '"></a>'
|
|
44
|
+
el += content()
|
|
45
|
+
el += '</' + args.el + '>'
|
|
46
46
|
el += '</div>'
|
|
47
47
|
} else {
|
|
48
48
|
el += '<div' + ' class="tag-plugin quot">'
|
|
49
|
-
el += '<' + args.el + ' class="content"' + type + '>'
|
|
50
|
-
el += content()
|
|
51
|
-
el += '</' + args.el + '>'
|
|
49
|
+
el += '<' + args.el + ' class="content"' + type + '>'
|
|
50
|
+
el += content()
|
|
51
|
+
el += '</' + args.el + '>'
|
|
52
52
|
el += '</div>'
|
|
53
53
|
}
|
|
54
|
-
return el
|
|
55
|
-
}
|
|
54
|
+
return el
|
|
55
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sites.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
+
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
+
*
|
|
5
|
+
* {% sites [group] [repo:owner/repo] [api:http] %}
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
module.exports = ctx => function(args) {
|
|
11
|
+
args = ctx.args.map(args, ['repo', 'api'], ['group'])
|
|
12
|
+
var links = ctx.locals.get('data').links
|
|
13
|
+
if (links == undefined) {
|
|
14
|
+
links = {}
|
|
15
|
+
}
|
|
16
|
+
var api
|
|
17
|
+
if (args.api) {
|
|
18
|
+
api = args.api
|
|
19
|
+
} else if (args.repo) {
|
|
20
|
+
api = 'https://api.vlts.cc/output_data/v2/' + args.repo
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var el = '<div class="tag-plugin sites-wrap">'
|
|
24
|
+
if (api) {
|
|
25
|
+
el += '<div class="stellar-sites-api"'
|
|
26
|
+
el += ' api="' + api + '"'
|
|
27
|
+
el += '>'
|
|
28
|
+
el += '<div class="group-body"></div>'
|
|
29
|
+
el += '</div>'
|
|
30
|
+
} else if (args.group) {
|
|
31
|
+
function cell(item) {
|
|
32
|
+
if (item.url && item.title) {
|
|
33
|
+
var cell = '<div class="site-card">'
|
|
34
|
+
cell += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="' + item.url + '">'
|
|
35
|
+
cell += '<img src="' + (item.screenshot || ('https://screenshot-api.xaoxuu.com/api?url=' + item.url + '&width=1280&height=720')) + '" onerror="javascript:this.removeAttribute("data-src");this.src="' + ctx.theme.config.default.cover + '";"/>'
|
|
36
|
+
cell += '<div class="info">'
|
|
37
|
+
cell += '<img src="' + (item.avatar || ctx.theme.config.default.link) + '" onerror="javascript:this.removeAttribute("data-src");this.src="' + ctx.theme.config.default.link + '";"/>'
|
|
38
|
+
cell += '<span class="title">' + item.title + '</span>'
|
|
39
|
+
cell += '<span class="desc">' + (item.description || item.url) + '</span>'
|
|
40
|
+
cell += '</div>'
|
|
41
|
+
cell += '</a></div>'
|
|
42
|
+
return cell
|
|
43
|
+
} else {
|
|
44
|
+
return ''
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
el += '<div class="group-body">'
|
|
48
|
+
const items = links[args.group] || []
|
|
49
|
+
items.forEach((item, i) => {
|
|
50
|
+
el += cell(item)
|
|
51
|
+
})
|
|
52
|
+
el += '</div>'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
el += '</div>'
|
|
56
|
+
return el
|
|
57
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* swiper.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
+
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
+
*
|
|
5
|
+
* {% swiper [width:max] [effect:cards] %}
|
|
6
|
+
* 
|
|
7
|
+
* {% endswiper %}
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict'
|
|
11
|
+
|
|
12
|
+
module.exports = ctx => function(args, content) {
|
|
13
|
+
args = ctx.args.map(args, ['width', 'effect'])
|
|
14
|
+
var el = ''
|
|
15
|
+
function slide() {
|
|
16
|
+
let imgs = ctx.render.renderSync({text: content, engine: 'markdown'})
|
|
17
|
+
imgs = imgs.match(/<img(.*?)src="(.*?)"(.*?)>/gi)
|
|
18
|
+
if (imgs && imgs.length > 0) {
|
|
19
|
+
imgs.forEach((img, i) => {
|
|
20
|
+
img = img.replace('<img src', '<img no-lazy src')
|
|
21
|
+
el += '<div class="swiper-slide">' + img + '</div>'
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
el += '<div class="tag-plugin gallery swiper" id="swiper-api"'
|
|
26
|
+
el += ' ' + ctx.args.joinTags(args, ['width', 'effect']).join(' ')
|
|
27
|
+
el += '>'
|
|
28
|
+
el += '<div class="swiper-wrapper">'
|
|
29
|
+
slide()
|
|
30
|
+
el += '</div>'
|
|
31
|
+
el += '<div class="swiper-pagination"></div>'
|
|
32
|
+
el += '<div class="swiper-button-prev blur"></div>'
|
|
33
|
+
el += '<div class="swiper-button-next blur"></div>'
|
|
34
|
+
el += '</div>'
|
|
35
|
+
return el
|
|
36
|
+
}
|
package/scripts/tags/lib/tabs.js
CHANGED
|
@@ -2,58 +2,58 @@
|
|
|
2
2
|
* tabs.js v2 | 基于NexT修改: https://theme-next.js.org/docs/tag-plugins/tabs
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
'use strict'
|
|
5
|
+
'use strict'
|
|
6
6
|
|
|
7
|
-
var tab_index = 0
|
|
7
|
+
var tab_index = 0
|
|
8
8
|
|
|
9
9
|
module.exports = ctx => function(args, content = '') {
|
|
10
|
-
var el = '';
|
|
11
10
|
var arr = content.split(/<!--\s*tab (.*?)\s*-->/g).filter(item => item.trim().length > 0)
|
|
12
11
|
if (arr.length < 1) {
|
|
13
|
-
return
|
|
12
|
+
return ''
|
|
14
13
|
}
|
|
15
|
-
var tabs = []
|
|
14
|
+
var tabs = []
|
|
16
15
|
arr.forEach((item, i) => {
|
|
17
16
|
if (i % 2 == 0) {
|
|
18
17
|
tabs.push({
|
|
19
18
|
header: item
|
|
20
|
-
})
|
|
19
|
+
})
|
|
21
20
|
} else if (tabs.length > 0) {
|
|
22
|
-
var tab = tabs[tabs.length-1]
|
|
21
|
+
var tab = tabs[tabs.length-1]
|
|
23
22
|
if (tab.body == undefined) {
|
|
24
|
-
tab.body = item
|
|
23
|
+
tab.body = item
|
|
25
24
|
} else {
|
|
26
|
-
tab.body += '\n' + item
|
|
25
|
+
tab.body += '\n' + item
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
})
|
|
28
|
+
})
|
|
30
29
|
|
|
31
|
-
args = ctx.args.map(args, ['active', 'align'])
|
|
32
|
-
const tabName = 'tab_' + ++tab_index
|
|
33
|
-
const tabActive = Number(args.active) || 0
|
|
30
|
+
args = ctx.args.map(args, ['active', 'align'])
|
|
31
|
+
const tabName = 'tab_' + ++tab_index
|
|
32
|
+
const tabActive = Number(args.active) || 0
|
|
34
33
|
|
|
35
|
-
let tabId = 0
|
|
36
|
-
let tabNav = ''
|
|
37
|
-
let tabContent = ''
|
|
34
|
+
let tabId = 0
|
|
35
|
+
let tabNav = ''
|
|
36
|
+
let tabContent = ''
|
|
38
37
|
tabs.forEach((tab, i) => {
|
|
39
|
-
let content = ctx.render.renderSync({ text: (tab.body || ''), engine: 'markdown' }).trim()
|
|
40
|
-
const abbr = tabName + ' ' + ++tabId
|
|
41
|
-
const href = abbr.toLowerCase().split(' ').join('-')
|
|
42
|
-
const isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : ''
|
|
43
|
-
tabNav += `<
|
|
44
|
-
tabContent += `<div class="tab-pane${isActive}" id="${href}">${content}</div
|
|
45
|
-
})
|
|
38
|
+
let content = ctx.render.renderSync({ text: (tab.body || ''), engine: 'markdown' }).trim()
|
|
39
|
+
const abbr = tabName + ' ' + ++tabId
|
|
40
|
+
const href = abbr.toLowerCase().split(' ').join('-')
|
|
41
|
+
const isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : ''
|
|
42
|
+
tabNav += `<div class="tab${isActive}"><a href="#${href}">${tab.header || abbr}</a></div>`
|
|
43
|
+
tabContent += `<div class="tab-pane${isActive}" id="${href}">${content}</div>`
|
|
44
|
+
})
|
|
46
45
|
|
|
47
|
-
tabNav = `<
|
|
48
|
-
tabContent = `<div class="tab-content">${tabContent}</div
|
|
46
|
+
tabNav = `<div class="nav-tabs">${tabNav}</div>`
|
|
47
|
+
tabContent = `<div class="tab-content">${tabContent}</div>`
|
|
49
48
|
|
|
50
|
-
el
|
|
49
|
+
var el = ''
|
|
50
|
+
el += '<div class="tag-plugin tabs"'
|
|
51
51
|
if (args.align != undefined) {
|
|
52
|
-
el += ' align="' + args.align + '"'
|
|
52
|
+
el += ' align="' + args.align + '"'
|
|
53
53
|
}
|
|
54
|
-
el += 'id="' + tabName.toLowerCase().split(' ').join('-') + '"'
|
|
55
|
-
el += '
|
|
56
|
-
el += tabNav + tabContent
|
|
57
|
-
el += '</div>'
|
|
58
|
-
return el
|
|
59
|
-
}
|
|
54
|
+
el += 'id="' + tabName.toLowerCase().split(' ').join('-') + '"'
|
|
55
|
+
el += '>'
|
|
56
|
+
el += tabNav + tabContent
|
|
57
|
+
el += '</div>'
|
|
58
|
+
return el
|
|
59
|
+
}
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
'use strict'
|
|
9
|
+
'use strict'
|
|
10
10
|
|
|
11
11
|
const tag_colors = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple']
|
|
12
|
-
var tag_index = 0
|
|
12
|
+
var tag_index = 0
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
args =
|
|
14
|
+
module.exports = ctx => function(args) {
|
|
15
|
+
args = ctx.args.map(args, ['color'], ['text', 'href'])
|
|
16
16
|
if (args.color == null) {
|
|
17
|
-
const default_color =
|
|
17
|
+
const default_color = ctx.theme.config.tag_plugins.tag?.default_color
|
|
18
18
|
if (default_color) {
|
|
19
19
|
args.color = default_color
|
|
20
20
|
} else {
|
|
@@ -25,11 +25,11 @@ hexo.extend.tag.register('tag', function(args) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
var el = ''
|
|
29
|
-
el += '<a class="tag-plugin tag"'
|
|
30
|
-
el += ' ' +
|
|
31
|
-
el += '>'
|
|
32
|
-
el += args.text
|
|
33
|
-
el += '</a>'
|
|
34
|
-
return el
|
|
35
|
-
}
|
|
28
|
+
var el = ''
|
|
29
|
+
el += '<a class="tag-plugin tag"'
|
|
30
|
+
el += ' ' + ctx.args.joinTags(args, ['color', 'href']).join(' ')
|
|
31
|
+
el += '>'
|
|
32
|
+
el += args.text
|
|
33
|
+
el += '</a>'
|
|
34
|
+
return el
|
|
35
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* timeline.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
+
*
|
|
4
|
+
* {% timeline %}
|
|
5
|
+
*
|
|
6
|
+
* <!-- node header1 -->
|
|
7
|
+
* what happened 1
|
|
8
|
+
*
|
|
9
|
+
* <!-- node header2 -->
|
|
10
|
+
* what happened 2
|
|
11
|
+
*
|
|
12
|
+
* {% endtimeline %}
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
'use strict'
|
|
16
|
+
|
|
17
|
+
function layoutNodeTitle(ctx, content) {
|
|
18
|
+
var el = ''
|
|
19
|
+
el += '<div class="header">'
|
|
20
|
+
if (content && content.length > 0) {
|
|
21
|
+
el += ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')
|
|
22
|
+
}
|
|
23
|
+
el += '</div>'
|
|
24
|
+
return el
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function layoutNodeContent(ctx, content) {
|
|
28
|
+
var el = ''
|
|
29
|
+
el += '<div class="body fs14">'
|
|
30
|
+
if (content && content.length > 0) {
|
|
31
|
+
el += ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')
|
|
32
|
+
}
|
|
33
|
+
el += '</div>'
|
|
34
|
+
return el
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = ctx => function(args, content = '') {
|
|
38
|
+
args = ctx.args.map(args, ['api', 'user', 'type', 'limit', 'hide'])
|
|
39
|
+
var el = ''
|
|
40
|
+
if (!args.type) {
|
|
41
|
+
args.type = 'timeline'
|
|
42
|
+
}
|
|
43
|
+
if (args.api && args.api.length > 0) {
|
|
44
|
+
el += '<div class="tag-plugin timeline stellar-' + args.type + '-api"'
|
|
45
|
+
el += ' ' + ctx.args.joinTags(args, ['api', 'user', 'limit', 'hide']).join(' ')
|
|
46
|
+
el += '>'
|
|
47
|
+
} else {
|
|
48
|
+
el += '<div class="tag-plugin timeline">'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var arr = content.split(/<!--\s*node (.*?)\s*-->/g).filter(item => item.trim().length > 0)
|
|
52
|
+
if (arr.length > 0) {
|
|
53
|
+
var nodes = []
|
|
54
|
+
arr.forEach((item, i) => {
|
|
55
|
+
if (i % 2 == 0) {
|
|
56
|
+
nodes.push({
|
|
57
|
+
header: item
|
|
58
|
+
})
|
|
59
|
+
} else if (nodes.length > 0) {
|
|
60
|
+
var node = nodes[nodes.length-1]
|
|
61
|
+
if (node.body == undefined) {
|
|
62
|
+
node.body = item
|
|
63
|
+
} else {
|
|
64
|
+
node.body += '\n' + item
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
nodes.forEach((node, i) => {
|
|
69
|
+
el += '<div class="timenode" index="' + (i) + '">'
|
|
70
|
+
el += layoutNodeTitle(ctx, node.header)
|
|
71
|
+
el += layoutNodeContent(ctx, node.body)
|
|
72
|
+
el += '</div>'
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
el += '</div>'
|
|
77
|
+
return el
|
|
78
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toc.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
+
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
+
*
|
|
5
|
+
* {% toc wiki:xxx [title] [open:true] [display:mobile] %}
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
function layoutDocTree(ctx, pages) {
|
|
11
|
+
const url_for = require('hexo-util').url_for.bind(ctx)
|
|
12
|
+
var el = ''
|
|
13
|
+
el += '<ul class="toc">'
|
|
14
|
+
pages.forEach((p, i) => {
|
|
15
|
+
el += '<li>'
|
|
16
|
+
el += '<a class="list-link" href="' + url_for(p.path) + '">'
|
|
17
|
+
el += '<span>' + (p.title || p.seo_title) + '</span>'
|
|
18
|
+
el += '</a>'
|
|
19
|
+
el += '</li>'
|
|
20
|
+
})
|
|
21
|
+
el += '</ul>'
|
|
22
|
+
return el
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = ctx => function(args) {
|
|
26
|
+
args = ctx.args.map(args, ['wiki', 'open', 'display'], ['title'])
|
|
27
|
+
|
|
28
|
+
var el = ''
|
|
29
|
+
el += '<div class="tag-plugin toc"'
|
|
30
|
+
el += ' ' + ctx.args.joinTags(args, ['display']).join(' ')
|
|
31
|
+
if (args.display === 'mobile') {
|
|
32
|
+
el += ' style="display:none"'
|
|
33
|
+
}
|
|
34
|
+
el += '>'
|
|
35
|
+
|
|
36
|
+
el += '<details class="toc"'
|
|
37
|
+
if (args.open != 'false') {
|
|
38
|
+
el += ' open'
|
|
39
|
+
}
|
|
40
|
+
el += '>'
|
|
41
|
+
el += '<summary>'
|
|
42
|
+
el += args.title || 'TOC'
|
|
43
|
+
el += '</summary>'
|
|
44
|
+
|
|
45
|
+
if (args.wiki) {
|
|
46
|
+
const proj = ctx.theme.config.wiki.projects[args.wiki]
|
|
47
|
+
if (proj == undefined) {
|
|
48
|
+
return ''
|
|
49
|
+
}
|
|
50
|
+
if (proj.sections && proj.sections.length > 1) {
|
|
51
|
+
el += '<div class="body fs14 multi">'
|
|
52
|
+
proj.sections.forEach((sec, i) => {
|
|
53
|
+
el += '<section>'
|
|
54
|
+
el += '<div class="header">'
|
|
55
|
+
el += sec.title
|
|
56
|
+
el += '</div>'
|
|
57
|
+
el += layoutDocTree(ctx, sec.pages)
|
|
58
|
+
el += '</section>'
|
|
59
|
+
})
|
|
60
|
+
el += '</div>'
|
|
61
|
+
} else {
|
|
62
|
+
el += '<div class="body fs14">'
|
|
63
|
+
el += '<div class="body">'
|
|
64
|
+
el += layoutDocTree(ctx, proj.pages)
|
|
65
|
+
el += '</div>'
|
|
66
|
+
el += '</div>'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
el += '</details>'
|
|
70
|
+
// end
|
|
71
|
+
el += '</div>'
|
|
72
|
+
return el
|
|
73
|
+
}
|
|
@@ -2,9 +2,9 @@ blockquote
|
|
|
2
2
|
display: block
|
|
3
3
|
margin-left: 0
|
|
4
4
|
margin-right: 0
|
|
5
|
-
padding: 0.
|
|
5
|
+
padding: 0.25rem 0.75rem
|
|
6
6
|
background: var(--block)
|
|
7
7
|
$bd-left = 4px
|
|
8
8
|
border-left: $bd-left solid var(--text-meta)
|
|
9
|
-
border-radius: $bd-left $border-
|
|
9
|
+
border-radius: $bd-left $border-bar $border-bar $bd-left
|
|
10
10
|
color: var(--text-p2)
|
|
@@ -9,14 +9,50 @@ a.button
|
|
|
9
9
|
font-weight: 500
|
|
10
10
|
line-height: 1
|
|
11
11
|
padding: 0.75rem 2rem
|
|
12
|
-
border-radius:
|
|
13
|
-
trans1: background
|
|
12
|
+
border-radius: $border-button
|
|
14
13
|
font-size: $fs-15
|
|
14
|
+
user-select: none
|
|
15
15
|
&.theme
|
|
16
16
|
background: $color-theme
|
|
17
17
|
color: var(--card)
|
|
18
18
|
&:hover
|
|
19
19
|
background: $color-hover
|
|
20
|
+
&.start
|
|
21
|
+
border-radius: 100px
|
|
22
|
+
background: var(--text-p1)
|
|
23
|
+
color: var(--card)
|
|
20
24
|
|
|
21
25
|
a[onclick]:hover
|
|
22
26
|
cursor: pointer
|
|
27
|
+
|
|
28
|
+
a.button.start.gradient
|
|
29
|
+
transition: 0.38s ease-out
|
|
30
|
+
position relative
|
|
31
|
+
z-index: 0
|
|
32
|
+
background: convert(hexo-config('style.gradient.start'))
|
|
33
|
+
background-size: 1000%
|
|
34
|
+
color: white
|
|
35
|
+
animation: glow 60s linear infinite
|
|
36
|
+
@keyframes glow {
|
|
37
|
+
from {
|
|
38
|
+
background-position: 0%
|
|
39
|
+
}
|
|
40
|
+
to {
|
|
41
|
+
background-position: 1000%
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
&:after
|
|
45
|
+
content: ''
|
|
46
|
+
position absolute
|
|
47
|
+
left: 0
|
|
48
|
+
right: 0
|
|
49
|
+
top: 0
|
|
50
|
+
bottom: 0
|
|
51
|
+
border-radius: 100px
|
|
52
|
+
background: inherit
|
|
53
|
+
z-index -1
|
|
54
|
+
filter: blur(36px)
|
|
55
|
+
transition: 0.38s ease-out
|
|
56
|
+
opacity 0
|
|
57
|
+
&:hover:after
|
|
58
|
+
opacity 1
|
|
@@ -4,7 +4,7 @@ code
|
|
|
4
4
|
font-family: $ff-code
|
|
5
5
|
|
|
6
6
|
p>code:not([class]),li>code:not([class])
|
|
7
|
-
font-size:
|
|
7
|
+
font-size: $fs-code
|
|
8
8
|
background: var(--block)
|
|
9
9
|
padding: .2em
|
|
10
10
|
border-radius: 4px
|
|
@@ -16,7 +16,7 @@ p>code:not([class]),li>code:not([class])
|
|
|
16
16
|
overflow: hidden
|
|
17
17
|
background: var(--block)
|
|
18
18
|
line-height: 1.5
|
|
19
|
-
font-family: $ff-
|
|
19
|
+
font-family: $ff-codeblock
|
|
20
20
|
box-sizing: border-box
|
|
21
21
|
@media screen and (min-width: $device-mobile)
|
|
22
22
|
min-width: 180px
|
|
@@ -27,15 +27,16 @@ p>code:not([class]),li>code:not([class])
|
|
|
27
27
|
display: block
|
|
28
28
|
figcaption
|
|
29
29
|
color: var(--text-p2)
|
|
30
|
-
font-size: $fs-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
background: var(--block-hover)
|
|
35
|
-
border-top-left-radius: "calc(%s - 1px)" % $border-block
|
|
36
|
-
border-top-right-radius: "calc(%s - 1px)" % $border-block
|
|
30
|
+
font-size: $fs-codeblock
|
|
31
|
+
font-weight: 500
|
|
32
|
+
margin-left: 0.5rem
|
|
33
|
+
display: inline-block
|
|
37
34
|
span
|
|
38
|
-
|
|
35
|
+
padding: 4px 0.5rem
|
|
36
|
+
display: block
|
|
37
|
+
border-bottom-left-radius: $border-bar
|
|
38
|
+
border-bottom-right-radius: $border-bar
|
|
39
|
+
background: var(--block-hover)
|
|
39
40
|
>table
|
|
40
41
|
overflow: auto
|
|
41
42
|
display: block
|