hexo-theme-stellar 1.19.0 → 1.20.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.
- package/_config.yml +32 -8
- package/layout/_partial/cover/wiki_cover.ejs +1 -1
- package/layout/_partial/head.ejs +2 -2
- package/layout/_partial/main/article/ai_abstract.ejs +3 -2
- package/layout/_partial/main/article/article_footer.ejs +87 -50
- package/layout/_partial/main/article/read_next.ejs +17 -12
- package/layout/_partial/main/navbar/breadcrumb.ejs +53 -15
- package/layout/_partial/main/navbar/list_post.ejs +6 -4
- package/layout/_partial/main/navbar/list_wiki.ejs +4 -3
- package/layout/_partial/plugins/comments/beaudar/script.ejs +1 -1
- package/layout/_partial/plugins/comments/giscus/script.ejs +1 -1
- package/layout/_partial/plugins/comments/layout.ejs +2 -2
- package/layout/_partial/plugins/comments/utterances/script.ejs +1 -1
- package/layout/_partial/sidebar/header.ejs +1 -1
- package/layout/_partial/sidebar/index.ejs +3 -3
- package/layout/_partial/widgets/ghissues.ejs +1 -1
- package/layout/_partial/widgets/ghrepo.ejs +1 -1
- package/layout/_partial/widgets/recent.ejs +3 -3
- package/layout/_partial/widgets/related.ejs +9 -8
- package/layout/_partial/widgets/toc.ejs +15 -10
- package/layout/index.ejs +7 -4
- package/layout/mermaid.ejs +8 -4
- package/layout/page.ejs +3 -0
- package/layout/wiki.ejs +3 -0
- package/package.json +1 -1
- package/scripts/events/lib/doc_tree.js +123 -92
- package/scripts/filters/index.js +4 -1
- package/scripts/tags/index.js +2 -2
- package/scripts/tags/inline-labels.js +2 -2
- package/scripts/tags/lib/ablock.js +1 -1
- package/scripts/tags/lib/checkbox.js +1 -1
- package/scripts/tags/lib/folders.js +1 -1
- package/scripts/tags/lib/folding.js +1 -1
- package/scripts/tags/lib/hashtag.js +36 -0
- package/scripts/tags/lib/image.js +5 -1
- package/scripts/tags/lib/mark.js +1 -1
- package/scripts/tags/lib/note.js +1 -1
- package/scripts/tags/lib/okr.js +140 -0
- package/scripts/tags/lib/toc.js +1 -1
- package/source/css/_common/highlight.styl +2 -0
- package/source/css/_custom.styl +2 -2
- package/source/css/_defines/theme.styl +0 -1
- package/source/css/_layout/md.styl +10 -7
- package/source/css/_layout/partial/bread-nav.styl +32 -0
- package/source/css/_layout/partial/paginator.styl +7 -3
- package/source/css/_layout/tag-plugins/common.styl +30 -39
- package/source/css/_layout/tag-plugins/folding.styl +1 -1
- package/source/css/_layout/tag-plugins/hashtag.styl +17 -0
- package/source/css/_layout/tag-plugins/mark.styl +2 -5
- package/source/css/_layout/tag-plugins/note.styl +1 -1
- package/source/css/_layout/tag-plugins/okr.styl +106 -0
- package/source/css/_plugins/mermaid.styl +125 -10
- package/source/js/main.js +1 -1
- package/source/js/plugins/copycode.js +1 -3
- package/source/js/plugins/linkcard.js +1 -1
- package/scripts/tags/lib/tag.js +0 -35
- package/source/css/_layout/tag-plugins/tag.styl +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%
|
|
2
|
-
let proj = theme.wiki.
|
|
2
|
+
let proj = theme.wiki.tree[page.wiki];
|
|
3
3
|
|
|
4
4
|
function layoutToc() {
|
|
5
5
|
if (toc(page.content).length > 0) {
|
|
@@ -22,7 +22,10 @@ function layoutTocHeader(title) {
|
|
|
22
22
|
|
|
23
23
|
function layoutDocTree(pages) {
|
|
24
24
|
var el = '';
|
|
25
|
-
|
|
25
|
+
for (let p of pages) {
|
|
26
|
+
if (p.title == null || p.title.length == 0) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
26
29
|
let isActive = '';
|
|
27
30
|
if (p.path === page.path) {
|
|
28
31
|
isActive += ' active';
|
|
@@ -34,14 +37,14 @@ function layoutDocTree(pages) {
|
|
|
34
37
|
href += '#start'
|
|
35
38
|
}
|
|
36
39
|
el += '<a class="doc-tree-link' + isActive + '" href="' + href + '">';
|
|
37
|
-
el += '<span class="toc-text">' +
|
|
40
|
+
el += '<span class="toc-text">' + p.title + '</span>';
|
|
38
41
|
el += '</a>';
|
|
39
42
|
}
|
|
40
43
|
if (p.path === page.path) {
|
|
41
44
|
el += layoutToc();
|
|
42
45
|
}
|
|
43
46
|
el += '</div>';
|
|
44
|
-
}
|
|
47
|
+
}
|
|
45
48
|
return el;
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -74,17 +77,19 @@ function layoutDiv(fallback) {
|
|
|
74
77
|
el += '</div>';
|
|
75
78
|
} else if (proj) {
|
|
76
79
|
// wiki 布局
|
|
77
|
-
if (proj.sections && proj.sections.length > 0) {
|
|
80
|
+
if (proj.sections && proj.sections.length > 0 && proj.pages.length > 1) { // 多 pages
|
|
78
81
|
proj.sections.forEach((sec, i) => {
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
if (sec.title?.length > 0) {
|
|
83
|
+
el += layoutTocHeader(sec.title);
|
|
84
|
+
}
|
|
81
85
|
el += '<div class="widget-body fs14">';
|
|
82
86
|
el += layoutDocTree(sec.pages);
|
|
83
87
|
el += '</div>';
|
|
84
88
|
});
|
|
85
|
-
} else {
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
} else { // 单 page
|
|
90
|
+
if (proj.pages.length == 1) {
|
|
91
|
+
el += layoutTocHeader(page.toc_title);
|
|
92
|
+
}
|
|
88
93
|
el += '<div class="widget-body fs14">';
|
|
89
94
|
el += layoutDocTree(proj.pages);
|
|
90
95
|
el += '</div>';
|
package/layout/index.ejs
CHANGED
|
@@ -51,10 +51,13 @@ function layout_posts(partial) {
|
|
|
51
51
|
function layout_wikis(partial) {
|
|
52
52
|
var el = '';
|
|
53
53
|
var wikis = [];
|
|
54
|
-
const
|
|
55
|
-
for (let
|
|
56
|
-
let proj =
|
|
57
|
-
if (proj
|
|
54
|
+
const { shelf, tree } = theme.wiki;
|
|
55
|
+
for (let pid of shelf) {
|
|
56
|
+
let proj = tree[pid];
|
|
57
|
+
if (proj == null) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (proj.pages == undefined || proj.pages.length === 0) {
|
|
58
61
|
continue;
|
|
59
62
|
}
|
|
60
63
|
if (page.filter === false) {
|
package/layout/mermaid.ejs
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
<script>
|
|
5
5
|
var mermaid_config = {
|
|
6
6
|
startOnLoad: true,
|
|
7
|
-
theme:
|
|
7
|
+
theme:
|
|
8
|
+
"<%- theme.style.darkmode %>" == "auto" &&
|
|
9
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
10
|
+
? "dark"
|
|
11
|
+
: "<%- theme.plugins.mermaid.theme %>",
|
|
8
12
|
logLevel: 3,
|
|
9
13
|
themeVariables: {
|
|
10
14
|
darkMode: true
|
|
@@ -12,17 +16,17 @@
|
|
|
12
16
|
flowchart: {
|
|
13
17
|
useMaxWidth: false,
|
|
14
18
|
htmlLabels: true,
|
|
15
|
-
curve:
|
|
19
|
+
curve: "linear"
|
|
16
20
|
},
|
|
17
21
|
gantt: {
|
|
18
|
-
axisFormat:
|
|
22
|
+
axisFormat: "%Y/%m/%d"
|
|
19
23
|
},
|
|
20
24
|
sequence: {
|
|
21
25
|
actorMargin: 50
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
28
|
if (window.mermaid) {
|
|
25
|
-
|
|
29
|
+
mermaid.initialize(mermaid_config);
|
|
26
30
|
}
|
|
27
31
|
</script>
|
|
28
32
|
<% } %>
|
package/layout/page.ejs
CHANGED
|
@@ -12,6 +12,9 @@ function layoutDiv() {
|
|
|
12
12
|
if (page.post_list) {
|
|
13
13
|
el += partial('_partial/main/navbar/list_post');
|
|
14
14
|
}
|
|
15
|
+
if (page.mermaid == true) {
|
|
16
|
+
el += partial('mermaid');
|
|
17
|
+
}
|
|
15
18
|
if (page.h1 || page.title || (page.content && page.content.length > 0)) {
|
|
16
19
|
el += partial('_partial/main/navbar/breadcrumb');
|
|
17
20
|
}
|
package/layout/wiki.ejs
CHANGED
|
@@ -29,6 +29,9 @@ function layoutTitle() {
|
|
|
29
29
|
page.header = 'auto';
|
|
30
30
|
}
|
|
31
31
|
%>
|
|
32
|
+
<% if (page.mermaid == true){ %>
|
|
33
|
+
<%- partial('mermaid') %>
|
|
34
|
+
<% } %>
|
|
32
35
|
<%- partial('_partial/main/navbar/breadcrumb') %>
|
|
33
36
|
<article class='md-text content <%- page.layout %><%- page.indent ? ' indent' : '' %><%- scrollreveal() %>'>
|
|
34
37
|
<%- layoutTitle() %>
|
package/package.json
CHANGED
|
@@ -7,157 +7,188 @@
|
|
|
7
7
|
class WikiPage {
|
|
8
8
|
constructor(page) {
|
|
9
9
|
this.id = page._id
|
|
10
|
+
this.wiki = page.wiki
|
|
10
11
|
this.title = page.title
|
|
12
|
+
this.seo_title = page.seo_title
|
|
11
13
|
this.path = page.path
|
|
14
|
+
this.path_key = page.path.replace('.html', '')
|
|
12
15
|
this.layout = page.layout
|
|
13
|
-
this.seo_title = page.seo_title
|
|
14
|
-
this.wiki = page.wiki
|
|
15
|
-
this.order = page.order || 0
|
|
16
16
|
this.updated = page.updated
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
function getWikiObject(ctx) {
|
|
21
|
+
var wiki = { tree:{} }
|
|
22
|
+
const data = ctx.locals.get('data')
|
|
23
|
+
var list = []
|
|
24
|
+
for (let key of Object.keys(data)) {
|
|
25
|
+
if (key.includes('wiki/') && key.length > 5) {
|
|
26
|
+
let newKey = key.replace('wiki/', '')
|
|
27
|
+
let obj = data[key]
|
|
28
|
+
if ((typeof obj.tags == 'string') && obj.tags.constructor == String) {
|
|
29
|
+
obj.tags = [obj.tags]
|
|
30
|
+
}
|
|
31
|
+
if ((typeof obj.toc == 'object') && obj.toc.constructor == Array) {
|
|
32
|
+
obj.toc = { '': obj.toc }
|
|
33
|
+
}
|
|
34
|
+
obj.id = newKey
|
|
35
|
+
if (obj.sort == null) {
|
|
36
|
+
obj.sort = 0
|
|
37
|
+
}
|
|
38
|
+
if (obj.path?.startsWith('/')) {
|
|
39
|
+
obj.path = obj.path.substring(1)
|
|
40
|
+
}
|
|
41
|
+
if (obj.path?.endsWith('/') == false) {
|
|
42
|
+
obj.path = obj.path + '/'
|
|
43
|
+
}
|
|
44
|
+
list.push(obj)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
list = list.sort((p1, p2) => p2.sort - p1.sort)
|
|
48
|
+
for (let item of list) {
|
|
49
|
+
wiki.tree[item.id] = item
|
|
25
50
|
}
|
|
26
51
|
return wiki
|
|
27
52
|
}
|
|
28
53
|
|
|
29
54
|
module.exports = ctx => {
|
|
30
55
|
// wiki 配置
|
|
31
|
-
var wiki =
|
|
56
|
+
var wiki = getWikiObject(ctx)
|
|
32
57
|
const pages = ctx.locals.get('pages')
|
|
33
58
|
// wiki 所有页面
|
|
34
|
-
const wiki_pages = pages.filter(p => (p.layout === 'wiki')
|
|
59
|
+
const wiki_pages = pages.filter(p => (p.layout === 'wiki')).map(p => new WikiPage(p))
|
|
60
|
+
const wiki_list = Object.keys(wiki.tree)
|
|
35
61
|
|
|
36
62
|
// 数据整合:项目标签
|
|
37
63
|
var all_tag_name = []
|
|
38
|
-
for (let id of
|
|
39
|
-
let
|
|
40
|
-
let tags =
|
|
64
|
+
for (let id of wiki_list) {
|
|
65
|
+
let item = wiki.tree[id]
|
|
66
|
+
let tags = item.tags
|
|
41
67
|
if (tags) {
|
|
42
|
-
|
|
43
|
-
if (all_tag_name.includes(
|
|
44
|
-
all_tag_name.push(
|
|
68
|
+
tags.forEach((tag, i) => {
|
|
69
|
+
if (all_tag_name.includes(tag) === false) {
|
|
70
|
+
all_tag_name.push(tag)
|
|
45
71
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} else if ((typeof tags == 'object') && tags.constructor == Array) {
|
|
49
|
-
tags.forEach((tag, i) => {
|
|
50
|
-
if (all_tag_name.includes(tag) === false) {
|
|
51
|
-
all_tag_name.push(tag)
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
wiki.projects[id].tags = tags
|
|
72
|
+
})
|
|
73
|
+
wiki.tree[id].tags = tags
|
|
56
74
|
}
|
|
57
75
|
}
|
|
58
|
-
|
|
59
|
-
const projs = Object.keys(wiki.projects)
|
|
60
|
-
wiki_pages.forEach((p, i) => {
|
|
61
|
-
if (projs.includes(p.wiki) == false) {
|
|
62
|
-
if (wiki.projects[p.wiki] == undefined) {
|
|
63
|
-
wiki.projects[p.wiki] = {}
|
|
64
|
-
wiki.projects[p.wiki].pages = []
|
|
65
|
-
}
|
|
66
|
-
var proj = wiki.projects[p.wiki]
|
|
67
|
-
if (proj.description == undefined) {
|
|
68
|
-
proj.description = p.description
|
|
69
|
-
}
|
|
70
|
-
wiki.projects[p.wiki].pages.push(p)
|
|
71
|
-
}
|
|
72
|
-
})
|
|
76
|
+
|
|
73
77
|
// 补充项目名称和首页
|
|
74
|
-
for (let id of
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
|
|
78
|
+
for (let id of wiki_list) {
|
|
79
|
+
let item = wiki.tree[id]
|
|
80
|
+
item.id = id
|
|
81
|
+
if (item.title == undefined || item.title.length === 0) {
|
|
82
|
+
item.title = id
|
|
79
83
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
84
|
+
if (item.name == undefined || item.name.length == 0) {
|
|
85
|
+
item.name = id
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
|
-
|
|
85
|
-
wiki_pages.forEach((p, i) => {
|
|
86
|
-
if (p.order == undefined) {
|
|
87
|
-
p.order = 0
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
88
|
+
|
|
91
89
|
// 数据整合:每个项目的子页面
|
|
92
|
-
for (let
|
|
93
|
-
let
|
|
94
|
-
let
|
|
95
|
-
|
|
90
|
+
for (let i = 0; i < wiki_list.length; i++) {
|
|
91
|
+
let id = wiki_list[i];
|
|
92
|
+
let item = wiki.tree[id]
|
|
93
|
+
let sub_pages = wiki_pages.filter(p => p.wiki === id)
|
|
94
|
+
if (!sub_pages || sub_pages.length == 0) {
|
|
95
|
+
wiki_list.splice(i, 1)
|
|
96
|
+
delete wiki.tree[id]
|
|
96
97
|
continue
|
|
97
98
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
99
|
+
|
|
100
|
+
// 首页
|
|
101
|
+
// 未特别指定首页时,获取TOC第一页作为首页
|
|
102
|
+
if (item.homepage == null && item.toc != null) {
|
|
103
|
+
for (let id of Object.keys(item.toc)) {
|
|
104
|
+
const sec = item.toc[id]
|
|
105
|
+
for (let key of sec) {
|
|
106
|
+
let hs = sub_pages.filter(p => p.path_key == item.path + key)
|
|
107
|
+
if (hs.length > 0) {
|
|
108
|
+
item.homepage = hs[0]
|
|
109
|
+
break
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (item.homepage != null) {
|
|
113
|
+
break
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
}
|
|
117
|
+
if (item.homepage == null) {
|
|
118
|
+
item.homepage = sub_pages[0]
|
|
119
|
+
}
|
|
120
|
+
item.homepage.is_homepage = true
|
|
121
|
+
// 内页分组
|
|
114
122
|
var sections = []
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
var others = sub_pages
|
|
124
|
+
if (item.toc) {
|
|
125
|
+
// 根据配置设置顺序
|
|
126
|
+
for (let title of Object.keys(item.toc)) {
|
|
127
|
+
var sec = { title: title, pages: []}
|
|
128
|
+
for (let key of item.toc[title]) {
|
|
129
|
+
sec.pages = sec.pages.concat(sub_pages.filter(p => p.path_key == item.path + key))
|
|
130
|
+
others = others.filter(p => p.path_key != item.path + key)
|
|
131
|
+
}
|
|
132
|
+
sections.push(sec)
|
|
133
|
+
}
|
|
134
|
+
if (others.length > 0 && others.filter(p => p.title?.length > 0).length > 0) {
|
|
118
135
|
sections.push({
|
|
119
|
-
title:
|
|
120
|
-
pages:
|
|
136
|
+
title: '...',
|
|
137
|
+
pages: others.sort((p1, p2) => p1.path - p2.path)
|
|
121
138
|
})
|
|
122
139
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
140
|
+
} else {
|
|
141
|
+
// 自动设置顺序
|
|
142
|
+
sections.push({
|
|
143
|
+
pages: sub_pages.sort((p1, p2) => p1.path - p2.path)
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// page number
|
|
148
|
+
var page_number = 0
|
|
149
|
+
for (let sec of sections) {
|
|
150
|
+
for (let page of sec.pages) {
|
|
151
|
+
page.page_number = page_number++
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
item.sections = sections
|
|
155
|
+
item.pages = sub_pages
|
|
126
156
|
}
|
|
127
|
-
|
|
157
|
+
|
|
128
158
|
// 全站所有的项目标签
|
|
129
159
|
var all_tags = {}
|
|
130
160
|
all_tag_name.forEach((tag_name, i) => {
|
|
131
|
-
var
|
|
132
|
-
for (let id of
|
|
133
|
-
let
|
|
134
|
-
if (
|
|
135
|
-
|
|
161
|
+
var subs = []
|
|
162
|
+
for (let id of wiki_list) {
|
|
163
|
+
let item = wiki.tree[id]
|
|
164
|
+
if (item.tags && item.tags.includes(tag_name) === true && subs.includes(tag_name) === false) {
|
|
165
|
+
subs.push(item.id)
|
|
136
166
|
}
|
|
137
167
|
}
|
|
138
168
|
all_tags[tag_name] = {
|
|
139
169
|
name: tag_name,
|
|
140
170
|
path: (ctx.config.wiki_dir || 'wiki') + '/tags/' + tag_name + '/index.html',
|
|
141
|
-
items:
|
|
171
|
+
items: subs
|
|
142
172
|
}
|
|
143
173
|
})
|
|
144
174
|
|
|
145
175
|
// 关联相似项目
|
|
146
|
-
for (let id of
|
|
147
|
-
let
|
|
148
|
-
if (
|
|
176
|
+
for (let id of wiki_list) {
|
|
177
|
+
let item = wiki.tree[id]
|
|
178
|
+
if (item.tags) {
|
|
149
179
|
var related = []
|
|
150
|
-
|
|
180
|
+
item.tags.forEach((tag_name, i) => {
|
|
151
181
|
let tagObj = all_tags[tag_name]
|
|
152
182
|
related = related.concat(tagObj.items)
|
|
153
183
|
related = [...new Set(related)]
|
|
154
184
|
})
|
|
155
|
-
|
|
185
|
+
item.related = related
|
|
156
186
|
}
|
|
157
187
|
}
|
|
158
188
|
|
|
159
189
|
wiki.all_tags = all_tags
|
|
160
190
|
wiki.all_pages = wiki_pages
|
|
191
|
+
wiki.shelf = ctx.locals.get('data').wiki
|
|
161
192
|
ctx.theme.config.wiki = wiki
|
|
162
193
|
|
|
163
194
|
}
|
package/scripts/filters/index.js
CHANGED
|
@@ -5,7 +5,10 @@ hexo.extend.filter.register('after_render:html', require('./lib/img_onerror').pr
|
|
|
5
5
|
|
|
6
6
|
function change_image(data) {
|
|
7
7
|
if (this.theme.config.tag_plugins.image.parse_markdown) {
|
|
8
|
-
data.content = data.content.replace(
|
|
8
|
+
data.content = data.content.replace(
|
|
9
|
+
/!\[(.*?)\]\((.*?)\s*(?:"(.*?)")?\)/g,
|
|
10
|
+
'{% image $2 $3 %}'
|
|
11
|
+
);
|
|
9
12
|
}
|
|
10
13
|
return data;
|
|
11
14
|
}
|
package/scripts/tags/index.js
CHANGED
|
@@ -32,6 +32,6 @@ hexo.extend.tag.register('navbar', require('./lib/navbar')(hexo))
|
|
|
32
32
|
hexo.extend.tag.register('note', require('./lib/note')(hexo))
|
|
33
33
|
hexo.extend.tag.register('poetry', require('./lib/poetry')(hexo), true)
|
|
34
34
|
hexo.extend.tag.register('quot', require('./lib/quot')(hexo))
|
|
35
|
-
hexo.extend.tag.register('
|
|
36
|
-
|
|
35
|
+
hexo.extend.tag.register('hashtag', require('./lib/hashtag')(hexo))
|
|
36
|
+
hexo.extend.tag.register('okr', require('./lib/okr')(hexo), {ends: true})
|
|
37
37
|
// others
|
|
@@ -29,7 +29,7 @@ hexo.extend.tag.register('psw', function(args) {
|
|
|
29
29
|
hexo.extend.tag.register('sup', function(args) {
|
|
30
30
|
args = hexo.args.map(args, ['color'], ['text'])
|
|
31
31
|
var el = ''
|
|
32
|
-
el += '<sup class="tag-plugin sup"' + ' ' + hexo.args.joinTags(args, ['color']).join(' ') + '>'
|
|
32
|
+
el += '<sup class="tag-plugin colorful sup"' + ' ' + hexo.args.joinTags(args, ['color']).join(' ') + '>'
|
|
33
33
|
el += args.text
|
|
34
34
|
el += '</sup>'
|
|
35
35
|
return el
|
|
@@ -37,7 +37,7 @@ hexo.extend.tag.register('sup', function(args) {
|
|
|
37
37
|
hexo.extend.tag.register('sub', function(args) {
|
|
38
38
|
args = hexo.args.map(args, ['color'], ['text'])
|
|
39
39
|
var el = ''
|
|
40
|
-
el += '<sub class="tag-plugin sub"' + ' ' + hexo.args.joinTags(args, ['color']).join(' ') + '>'
|
|
40
|
+
el += '<sub class="tag-plugin colorful sub"' + ' ' + hexo.args.joinTags(args, ['color']).join(' ') + '>'
|
|
41
41
|
el += args.text
|
|
42
42
|
el += '</sub>'
|
|
43
43
|
return el
|
|
@@ -17,7 +17,7 @@ module.exports = ctx => function(args, content) {
|
|
|
17
17
|
}
|
|
18
18
|
var el = ''
|
|
19
19
|
// header
|
|
20
|
-
el += '<div class="tag-plugin note"'
|
|
20
|
+
el += '<div class="tag-plugin colorful note"'
|
|
21
21
|
el += ' ' + ctx.args.joinTags(args, ['color', 'child']).join(' ')
|
|
22
22
|
el += '>'
|
|
23
23
|
// title
|
|
@@ -13,7 +13,7 @@ module.exports = (ctx, type) => function(args) {
|
|
|
13
13
|
args = ctx.args.map(args, ['color', 'checked', 'symbol'], ['text'])
|
|
14
14
|
var el = ''
|
|
15
15
|
// div
|
|
16
|
-
el += '<div class="tag-plugin checkbox"'
|
|
16
|
+
el += '<div class="tag-plugin colorful checkbox"'
|
|
17
17
|
el += ' ' + ctx.args.joinTags(args, ['color', 'symbol']).join(' ')
|
|
18
18
|
el += '>'
|
|
19
19
|
// input
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
module.exports = ctx => function(args, content) {
|
|
16
16
|
args = ctx.args.map(args, ['color'])
|
|
17
17
|
var el = ''
|
|
18
|
-
el += '<div class="tag-plugin folders"'
|
|
18
|
+
el += '<div class="tag-plugin colorful folders"'
|
|
19
19
|
el += ' ' + ctx.args.joinTags(args, ['color']).join(' ')
|
|
20
20
|
el += '>'
|
|
21
21
|
|
|
@@ -13,7 +13,7 @@ module.exports = ctx => function(args, content) {
|
|
|
13
13
|
args = ctx.args.map(args, ['color', 'child', 'open'], ['title'])
|
|
14
14
|
var el = ''
|
|
15
15
|
// header
|
|
16
|
-
el += '<details class="tag-plugin folding"'
|
|
16
|
+
el += '<details class="tag-plugin colorful folding"'
|
|
17
17
|
el += ' ' + ctx.args.joinTags(args, ['color', 'child']).join(' ')
|
|
18
18
|
if (args.open && args.open == 'true') {
|
|
19
19
|
el += ' open'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hashtag.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
+
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
+
*
|
|
5
|
+
* {% hashtag text href [color:color] %}
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict'
|
|
10
|
+
|
|
11
|
+
const tag_colors = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple']
|
|
12
|
+
var tag_index = 0
|
|
13
|
+
|
|
14
|
+
module.exports = ctx => function(args) {
|
|
15
|
+
args = ctx.args.map(args, ['color'], ['text', 'href'])
|
|
16
|
+
if (args.color == null) {
|
|
17
|
+
const default_color = ctx.theme.config.tag_plugins.hashtag?.default_color
|
|
18
|
+
if (default_color) {
|
|
19
|
+
args.color = default_color
|
|
20
|
+
} else {
|
|
21
|
+
args.color = tag_colors[tag_index]
|
|
22
|
+
tag_index += 1
|
|
23
|
+
if (tag_index >= tag_colors.length) {
|
|
24
|
+
tag_index = 0
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
var el = ''
|
|
29
|
+
el += '<a class="tag-plugin colorful hashtag"'
|
|
30
|
+
el += ' ' + ctx.args.joinTags(args, ['color', 'href']).join(' ')
|
|
31
|
+
el += '>'
|
|
32
|
+
el += '<svg t="1701408144765" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4228" width="200" height="200"><path d="M426.6 64.8c34.8 5.8 58.4 38.8 52.6 73.6l-19.6 117.6h190.2l23-138.6c5.8-34.8 38.8-58.4 73.6-52.6s58.4 38.8 52.6 73.6l-19.4 117.6H896c35.4 0 64 28.6 64 64s-28.6 64-64 64h-137.8l-42.6 256H832c35.4 0 64 28.6 64 64s-28.6 64-64 64h-137.8l-23 138.6c-5.8 34.8-38.8 58.4-73.6 52.6s-58.4-38.8-52.6-73.6l19.6-117.4h-190.4l-23 138.6c-5.8 34.8-38.8 58.4-73.6 52.6s-58.4-38.8-52.6-73.6l19.4-117.8H128c-35.4 0-64-28.6-64-64s28.6-64 64-64h137.8l42.6-256H192c-35.4 0-64-28.6-64-64s28.6-64 64-64h137.8l23-138.6c5.8-34.8 38.8-58.4 73.6-52.6z m11.6 319.2l-42.6 256h190.2l42.6-256h-190.2z" p-id="4229"></path></svg>'
|
|
33
|
+
el += '<span>' + args.text + '</span>'
|
|
34
|
+
el += '</a>'
|
|
35
|
+
return el
|
|
36
|
+
}
|
|
@@ -71,7 +71,11 @@ module.exports = ctx => function(args) {
|
|
|
71
71
|
if (args.download == 'true') {
|
|
72
72
|
href = args.src
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
let download = ''
|
|
75
|
+
if (args.alt) {
|
|
76
|
+
download = ' download="' + args.alt + '"'
|
|
77
|
+
}
|
|
78
|
+
el += '<a class="image-download blur" style="opacity:0" target="_blank"' + download + ' href="' + href + '"><svg class="icon" style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3734"><path d="M561.00682908 685.55838913a111.03077546 111.03077546 0 0 1-106.8895062 0L256.23182837 487.72885783a55.96309219 55.96309219 0 0 1 79.13181253-79.18777574L450.70357448 523.88101491V181.55477937a55.96309219 55.96309219 0 0 1 111.92618438 0v344.06109173l117.07478902-117.07478901a55.96309219 55.96309219 0 0 1 79.13181252 79.18777574zM282.81429711 797.1487951h447.70473912a55.96309219 55.96309219 0 0 1 0 111.92618438H282.81429711a55.96309219 55.96309219 0 0 1 0-111.92618438z" p-id="3735"></path></svg></a>'
|
|
75
79
|
}
|
|
76
80
|
el += '</div>'
|
|
77
81
|
|
package/scripts/tags/lib/mark.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = ctx => function(args) {
|
|
|
14
14
|
args.color = ctx.theme.config.tag_plugins.mark.default_color
|
|
15
15
|
}
|
|
16
16
|
var el = ''
|
|
17
|
-
el += '<mark class="tag-plugin mark"'
|
|
17
|
+
el += '<mark class="tag-plugin colorful mark"'
|
|
18
18
|
el += ' ' + ctx.args.joinTags(args, ['color']).join(' ')
|
|
19
19
|
el += '>'
|
|
20
20
|
el += args.text
|
package/scripts/tags/lib/note.js
CHANGED