hexo-component-inferno 4.2.2 → 5.1.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/README.md +5 -18
- package/asset/css/github-calendar.css +41 -0
- package/asset/js/algolia.js +18 -69
- package/asset/js/github-calendar.js +185 -0
- package/asset/js/google_cse.js +19 -68
- package/asset/js/insight.js +45 -208
- package/lib/core/commented_yaml.js +35 -0
- package/lib/core/default_value.js +150 -0
- package/lib/core/schema.js +8 -196
- package/lib/core/schema_util.js +14 -0
- package/lib/hexo/helper/cdn.js +10 -97
- package/lib/hexo/tag/tabs.js +4 -84
- package/lib/schema/comment/artalk.json +7 -1
- package/lib/schema/comment/cusdis.json +1 -1
- package/lib/schema/comment/facebook.json +1 -1
- package/lib/schema/comment/gitalk.json +23 -6
- package/lib/schema/comment/gitment.json +1 -1
- package/lib/schema/comment/livere.json +9 -3
- package/lib/schema/comment/twikoo.json +3 -3
- package/lib/schema/comment/waline.json +28 -3
- package/lib/schema/misc/open_graph.json +2 -1
- package/lib/schema/plugin/cookie_consent.json +2 -2
- package/lib/schema/plugin/mathjax.json +1 -1
- package/lib/schema/plugin/outdated_browser.json +1 -1
- package/lib/schema/share/bdshare.json +1 -1
- package/lib/schema/share/sharejs.json +1 -1
- package/lib/schema/share/web_share.json +13 -0
- package/lib/schema/widget/github_calendar.json +30 -0
- package/lib/schema/widget/profile.json +67 -0
- package/lib/util/archives.js +86 -0
- package/lib/util/categories.js +102 -0
- package/lib/util/cdn-rules.js +109 -0
- package/lib/util/cdn.js +116 -0
- package/lib/util/consent.js +122 -0
- package/lib/util/deprecate.js +1 -1
- package/lib/util/gallery.js +227 -0
- package/lib/util/insight-search.js +98 -0
- package/lib/util/searchbox.js +88 -0
- package/lib/util/tab-options.js +109 -0
- package/lib/view/comment/artalk.js +24 -6
- package/lib/view/comment/cusdis.js +4 -0
- package/lib/view/comment/disqus.js +1 -1
- package/lib/view/comment/disqusjs.js +7 -6
- package/lib/view/comment/facebook.js +3 -16
- package/lib/view/comment/gitalk.js +18 -15
- package/lib/view/comment/gitment.js +2 -2
- package/lib/view/comment/livere.js +25 -4
- package/lib/view/comment/twikoo.js +5 -3
- package/lib/view/comment/valine.js +4 -3
- package/lib/view/comment/waline.js +8 -6
- package/lib/view/misc/open_graph.js +3 -5
- package/lib/view/plugin/cookie_consent.js +8 -7
- package/lib/view/plugin/gallery.js +42 -19
- package/lib/view/plugin/katex.js +4 -4
- package/lib/view/plugin/mathjax.js +10 -7
- package/lib/view/plugin/outdated_browser.js +59 -45
- package/lib/view/plugin/progressbar.js +6 -1
- package/lib/view/plugin/waline_pageview.js +2 -2
- package/lib/view/search/algolia.js +8 -3
- package/lib/view/search/google_cse.js +13 -10
- package/lib/view/search/insight.js +9 -2
- package/lib/view/share/addthis.js +4 -9
- package/lib/view/share/addtoany.js +23 -5
- package/lib/view/share/bdshare.js +9 -30
- package/lib/view/share/sharejs.js +7 -34
- package/lib/view/share/sharethis.js +21 -6
- package/lib/view/share/web_share.js +153 -0
- package/lib/view/widget/archives.js +19 -71
- package/lib/view/widget/categories.js +20 -67
- package/lib/view/widget/github_calendar.js +94 -0
- package/lib/view/widget/profile.js +194 -0
- package/lib/view/widget/subscribe_email.js +4 -26
- package/package.json +6 -4
package/lib/core/schema.js
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const Ajv = require('ajv');
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const {
|
|
8
|
+
MAGIC
|
|
9
|
+
} = require('./commented_yaml');
|
|
10
|
+
const DefaultValue = require('./default_value');
|
|
11
|
+
const {
|
|
12
|
+
typeOf,
|
|
13
|
+
hasOwnProperty
|
|
14
|
+
} = require('./schema_util');
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Deep copy a value of a JSON schema definition, so that changing a default value does not change the
|
|
@@ -33,15 +35,6 @@ const PRIMITIVE_DEFAULTS = {
|
|
|
33
35
|
array: [],
|
|
34
36
|
object: {}
|
|
35
37
|
};
|
|
36
|
-
const typeOf = value => {
|
|
37
|
-
if (value === undefined) {
|
|
38
|
-
return 'undefined';
|
|
39
|
-
}
|
|
40
|
-
return Object.prototype.toString.call(value).replace(/^\[object\s+([a-z]+)\]$/i, '$1').toLowerCase();
|
|
41
|
-
};
|
|
42
|
-
const hasOwnProperty = (obj, prop) => {
|
|
43
|
-
return obj === null || typeOf(obj) === 'undefined' ? false : Object.prototype.hasOwnProperty.call(obj, prop);
|
|
44
|
-
};
|
|
45
38
|
function traverseObj(obj, targetKey, handler) {
|
|
46
39
|
if (typeOf(obj) === 'array') {
|
|
47
40
|
for (const child of obj) {
|
|
@@ -58,187 +51,6 @@ function traverseObj(obj, targetKey, handler) {
|
|
|
58
51
|
}
|
|
59
52
|
}
|
|
60
53
|
|
|
61
|
-
/**
|
|
62
|
-
* The default value wrapper class.
|
|
63
|
-
*/
|
|
64
|
-
class DefaultValue {
|
|
65
|
-
/**
|
|
66
|
-
* @param {any} value The wrapped default value.
|
|
67
|
-
* @param {string} description A description of the contained value. Used to produce
|
|
68
|
-
* the comment string.
|
|
69
|
-
*/
|
|
70
|
-
constructor(value, description) {
|
|
71
|
-
this.value = value;
|
|
72
|
-
this.description = description;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Duplicate the current default value.
|
|
77
|
-
* <p>
|
|
78
|
-
* Wrapped value will be shallow copied.
|
|
79
|
-
*
|
|
80
|
-
* @returns {module:core/schema~DefaultValue} A new instance of the current default value.
|
|
81
|
-
*/
|
|
82
|
-
clone() {
|
|
83
|
-
const result = new DefaultValue(this.value, this.description);
|
|
84
|
-
if (result.value instanceof DefaultValue) {
|
|
85
|
-
result.value = result.value.clone();
|
|
86
|
-
} else if (typeOf(result.value) === 'array') {
|
|
87
|
-
result.value = [].concat(result.value);
|
|
88
|
-
} else if (typeOf(result.value) === 'object') {
|
|
89
|
-
result.value = Object.assign({}, result.value);
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Unwrap current {module:core/schema~DefaultValue} if its wrapped value is also a
|
|
96
|
-
* {module:core/schema~DefaultValue}.
|
|
97
|
-
* <p>
|
|
98
|
-
* The description will also be replaced with wrapped value description, if exists.
|
|
99
|
-
*/
|
|
100
|
-
flatten() {
|
|
101
|
-
if (this.value instanceof DefaultValue) {
|
|
102
|
-
this.value.flatten();
|
|
103
|
-
if (hasOwnProperty(this.value, 'description') && this.value.description) {
|
|
104
|
-
this.description = this.value.description;
|
|
105
|
-
}
|
|
106
|
-
this.value = this.value.value;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Merge current default value with another default value.
|
|
112
|
-
*
|
|
113
|
-
* @param {module:core/schema~DefaultValue} source The input object to be merged with. Should have the
|
|
114
|
-
* same wrapped value type as current wrapped default value.
|
|
115
|
-
*/
|
|
116
|
-
merge(source) {
|
|
117
|
-
if (hasOwnProperty(source, 'value') && source.value !== null) {
|
|
118
|
-
this.flatten();
|
|
119
|
-
if (source.value instanceof DefaultValue) {
|
|
120
|
-
source = source.clone();
|
|
121
|
-
source.flatten();
|
|
122
|
-
}
|
|
123
|
-
if (typeOf(source.value) === typeOf(this.value)) {
|
|
124
|
-
if (typeOf(this.value) === 'array') {
|
|
125
|
-
this.value = this.value.concat(source.value);
|
|
126
|
-
} else if (typeOf(this.value) === 'object') {
|
|
127
|
-
Object.keys(source.value).forEach(key => {
|
|
128
|
-
this.value[key] = source.value[key];
|
|
129
|
-
});
|
|
130
|
-
} else {
|
|
131
|
-
this.value = source.value;
|
|
132
|
-
}
|
|
133
|
-
} else if (typeOf(this.value) === 'undefined' || typeOf(this.value) === 'null') {
|
|
134
|
-
this.value = source.value;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (hasOwnProperty(source, 'description') && source.description) {
|
|
138
|
-
this.description = source.description;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Create a new array with comments inserted as new elements right before each child element.
|
|
144
|
-
* <p>
|
|
145
|
-
* If current wrapped value is an array and some of its elements are instances of
|
|
146
|
-
* {@link module:core/schema~DefaultValue}, the element's description will be inserted as a new child
|
|
147
|
-
* right before the element.
|
|
148
|
-
* The element itself will also be converted into its commented version using the <code>toCommented</code>
|
|
149
|
-
* method.
|
|
150
|
-
*
|
|
151
|
-
* @returns {Array} A new array with comments and the original elements in the commented form.
|
|
152
|
-
*/
|
|
153
|
-
toCommentedArray() {
|
|
154
|
-
return [].concat(...this.value.map(item => {
|
|
155
|
-
if (item instanceof DefaultValue) {
|
|
156
|
-
if (typeOf(item.description) !== 'string' || !item.description.trim()) {
|
|
157
|
-
return [item.toCommented()];
|
|
158
|
-
}
|
|
159
|
-
return item.description.split('\n').map((line, i) => {
|
|
160
|
-
return MAGIC + i + ': ' + line;
|
|
161
|
-
}).concat(item.toCommented());
|
|
162
|
-
} else if (typeOf(item) === 'array' || typeOf(item) === 'object') {
|
|
163
|
-
return new DefaultValue(item).toCommented();
|
|
164
|
-
}
|
|
165
|
-
return [item];
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Create a new object with comments inserted as new properties right before every original properties.
|
|
171
|
-
* <p>
|
|
172
|
-
* Works similar to {@link module:core/schema~DefaultValue#toCommentedArray}.
|
|
173
|
-
*
|
|
174
|
-
* @returns {Object} A new object with comments and the original property values in the commented form.
|
|
175
|
-
*/
|
|
176
|
-
toCommentedObject() {
|
|
177
|
-
if (this.value instanceof DefaultValue) {
|
|
178
|
-
return this.value.toCommented();
|
|
179
|
-
}
|
|
180
|
-
const result = {};
|
|
181
|
-
for (const key in this.value) {
|
|
182
|
-
const item = this.value[key];
|
|
183
|
-
if (item instanceof DefaultValue) {
|
|
184
|
-
if (typeOf(item.description) === 'string' && item.description.trim()) {
|
|
185
|
-
item.description.split('\n').forEach((line, i) => {
|
|
186
|
-
result[MAGIC + key + i] = line;
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
result[key] = item.toCommented();
|
|
190
|
-
} else if (typeOf(item) === 'array' || typeOf(item) === 'object') {
|
|
191
|
-
result[key] = new DefaultValue(item).toCommented();
|
|
192
|
-
} else {
|
|
193
|
-
result[key] = item;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return result;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Call {@link module:core/schema~DefaultValue#toCommentedArray} or
|
|
201
|
-
* {@link module:core/schema~DefaultValue#toCommentedObject} based on the type of the wrapped value.
|
|
202
|
-
* <p>
|
|
203
|
-
* If neither applies, directly return the wrapped value.
|
|
204
|
-
*
|
|
205
|
-
* @returns {any} The commented object/array, or the original wrapped value.
|
|
206
|
-
*/
|
|
207
|
-
toCommented() {
|
|
208
|
-
if (typeOf(this.value) === 'array') {
|
|
209
|
-
return this.toCommentedArray();
|
|
210
|
-
} else if (typeOf(this.value) === 'object') {
|
|
211
|
-
return this.toCommentedObject();
|
|
212
|
-
}
|
|
213
|
-
return this.value;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Create the YAML string with all the comments from current default value.
|
|
218
|
-
*
|
|
219
|
-
* @returns {string} The formatted YAML string.
|
|
220
|
-
*/
|
|
221
|
-
toYaml() {
|
|
222
|
-
// Comments are written as properties or array elements, whose values the YAML writer may quote.
|
|
223
|
-
// Read them back with the YAML parser, rather than removing the quotes by hand.
|
|
224
|
-
const property = new RegExp(`^(\\s*)(['"]?)${MAGIC}.*?\\2: (.*)$`);
|
|
225
|
-
const element = new RegExp(`^(\\s*)- (.*${MAGIC}.*)$`);
|
|
226
|
-
const comment = (indent, text) => `${indent}# ${text === null || text === undefined ? '' : text}`;
|
|
227
|
-
return yaml.stringify(this.toCommented()).split('\n').map(line => {
|
|
228
|
-
let match = property.exec(line);
|
|
229
|
-
if (match) {
|
|
230
|
-
return comment(match[1], yaml.parse(match[3]));
|
|
231
|
-
}
|
|
232
|
-
match = element.exec(line);
|
|
233
|
-
if (match) {
|
|
234
|
-
const text = String(yaml.parse(match[2]));
|
|
235
|
-
return comment(match[1], text.slice(text.indexOf(': ') + 2));
|
|
236
|
-
}
|
|
237
|
-
return line;
|
|
238
|
-
}).join('\n');
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
54
|
/* eslint-disable no-use-before-define */
|
|
243
55
|
/**
|
|
244
56
|
* A class that can resolving referenced JSON schemas and create {@link module:core/schema~DefaultValue}s.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @private Helpers shared by schema inference and default value wrappers. */
|
|
2
|
+
const typeOf = value => {
|
|
3
|
+
if (value === undefined) {
|
|
4
|
+
return 'undefined';
|
|
5
|
+
}
|
|
6
|
+
return Object.prototype.toString.call(value).replace(/^\[object\s+([a-z]+)\]$/i, '$1').toLowerCase();
|
|
7
|
+
};
|
|
8
|
+
const hasOwnProperty = (obj, prop) => {
|
|
9
|
+
return obj === null || typeOf(obj) === 'undefined' ? false : Object.prototype.hasOwnProperty.call(obj, prop);
|
|
10
|
+
};
|
|
11
|
+
module.exports = {
|
|
12
|
+
typeOf,
|
|
13
|
+
hasOwnProperty
|
|
14
|
+
};
|
package/lib/hexo/helper/cdn.js
CHANGED
|
@@ -4,50 +4,11 @@
|
|
|
4
4
|
* @module hexo/helper/cdn
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
cdnjs: '[cdnjs]https://cdnjs.cloudflare.com/ajax/libs/${ package }/${ version }/${ filename }',
|
|
13
|
-
loli: '[cdnjs]https://cdnjs.loli.net/ajax/libs/${ package }/${ version }/${ filename }',
|
|
14
|
-
jsdelivr: 'https://cdn.jsdelivr.net/npm/${ package }@${ version }/${ filename }',
|
|
15
|
-
unpkg: 'https://unpkg.com/${ package }@${ version }/${ filename }'
|
|
16
|
-
},
|
|
17
|
-
FONT: {
|
|
18
|
-
google: 'https://fonts.googleapis.com/${ type }?family=${ fontname }',
|
|
19
|
-
loli: 'https://fonts.loli.net/${ type }?family=${ fontname }',
|
|
20
|
-
fontim: 'https://fonts.font.im/${ type }?family=${ fontname }',
|
|
21
|
-
ustc: 'https://fonts.lug.ustc.edu.cn/${ type }?family=${ fontname }'
|
|
22
|
-
},
|
|
23
|
-
ICON: {
|
|
24
|
-
loli: 'https://cdnjs.loli.net/ajax/libs/font-awesome/6.0.0/css/all.min.css',
|
|
25
|
-
fontawesome: 'https://use.fontawesome.com/releases/v6.0.0/css/all.css'
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Convert npm library path to CDN.js path
|
|
31
|
-
* @private
|
|
32
|
-
*/
|
|
33
|
-
const CDNJS_FIXTURES = {
|
|
34
|
-
moment: (ver, fname) => ['moment.js', ver, fname.startsWith('min/') ? fname.substr(4) : fname],
|
|
35
|
-
outdatedbrowser: (ver, fname) => ['outdated-browser', ver, fname.startsWith('outdatedbrowser/') ? fname.substr(16) : fname],
|
|
36
|
-
'highlight.js': (ver, fname) => ['highlight.js', ver, fname.endsWith('.css') && fname.indexOf('.min.') === -1 ? fname.substr(0, fname.length - 4) + '.min.css' : fname],
|
|
37
|
-
mathjax: (ver, fname) => ['mathjax', ver, (() => {
|
|
38
|
-
fname = fname.startsWith('unpacked/') ? fname.substr(9) : fname;
|
|
39
|
-
return fname.indexOf('.min.') > -1 ? fname.replace(/\.min\./gi, '.') : fname;
|
|
40
|
-
})()],
|
|
41
|
-
katex: (ver, fname) => ['KaTeX', ver, fname],
|
|
42
|
-
'pace-js': (ver, fname) => ['pace', ver, fname],
|
|
43
|
-
clipboard: (ver, fname) => ['clipboard.js', ver, fname],
|
|
44
|
-
cookieconsent: (ver, fname) => ['cookieconsent', ver, fname.startsWith('build/') ? fname.substr(6) : fname],
|
|
45
|
-
'@waline/client': (ver, fname) => ['waline', ver, fname]
|
|
46
|
-
};
|
|
47
|
-
const UNPKG_FIXTURES = {
|
|
48
|
-
mathjax: (ver, fname) => ['mathjax', ver, fname.indexOf('.min.') > -1 ? fname.replace(/\.min\./gi, '.') : fname],
|
|
49
|
-
disqusjs: (ver, fname) => ['disqusjs', ver, fname.indexOf('.min.') > -1 ? fname.replace(/\.min\./gi, '.') : fname]
|
|
50
|
-
};
|
|
7
|
+
const {
|
|
8
|
+
resolveCdn,
|
|
9
|
+
resolveFontCdn,
|
|
10
|
+
resolveIconCdn
|
|
11
|
+
} = require('../../util/cdn');
|
|
51
12
|
|
|
52
13
|
/**
|
|
53
14
|
* Register the Hexo helper functions for resolving the URL of static files of JavaScript libraries,
|
|
@@ -73,64 +34,16 @@ const UNPKG_FIXTURES = {
|
|
|
73
34
|
* // -> https://use.fontawesome.com/releases/v6.0.0/css/all.css
|
|
74
35
|
*/
|
|
75
36
|
module.exports = function (hexo) {
|
|
76
|
-
function applyFixture(fixture, _package, version, filename) {
|
|
77
|
-
if (Object.prototype.hasOwnProperty.call(fixture, _package)) {
|
|
78
|
-
const result = fixture[_package](version, filename);
|
|
79
|
-
// package is not hosted on the given CDN
|
|
80
|
-
if (!result.length) {
|
|
81
|
-
throw new Error();
|
|
82
|
-
}
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
return [_package, version, filename];
|
|
86
|
-
}
|
|
87
37
|
hexo.extend.helper.register('cdn', function (_package, version, filename) {
|
|
88
38
|
const providers = typeof this.config.providers === 'object' ? this.config.providers : {};
|
|
89
|
-
|
|
90
|
-
cdn_overrides: overrides
|
|
91
|
-
} = providers;
|
|
92
|
-
// A package can use a different provider or URL than the rest in providers.cdn_overrides
|
|
93
|
-
const cdn = typeof overrides === 'object' && overrides !== null && overrides[_package] ? overrides[_package] : providers.cdn || 'jsdelivr';
|
|
94
|
-
let _cdn = cdn;
|
|
95
|
-
if (_cdn in PROVIDERS.LIBRARY) {
|
|
96
|
-
_cdn = PROVIDERS.LIBRARY[_cdn];
|
|
97
|
-
}
|
|
98
|
-
// cdn.js does not follow a GitHub npm style like jsdeliver and unpkg do. Patch it!
|
|
99
|
-
if (_cdn.startsWith('[cdnjs]')) {
|
|
100
|
-
_cdn = _cdn.substr(7);
|
|
101
|
-
try {
|
|
102
|
-
[_package, version, filename] = applyFixture(CDNJS_FIXTURES, _package, version, filename);
|
|
103
|
-
if (filename.startsWith('dist/')) {
|
|
104
|
-
filename = filename.substr(5);
|
|
105
|
-
}
|
|
106
|
-
} catch (e) {
|
|
107
|
-
_cdn = PROVIDERS.LIBRARY.jsdelivr;
|
|
108
|
-
}
|
|
109
|
-
} else if (cdn === 'unpkg') {
|
|
110
|
-
try {
|
|
111
|
-
[_package, version, filename] = applyFixture(UNPKG_FIXTURES, _package, version, filename);
|
|
112
|
-
} catch (e) {
|
|
113
|
-
_cdn = PROVIDERS.LIBRARY.jsdelivr;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return _cdn.replace(/\${\s*package\s*}/gi, _package).replace(/\${\s*version\s*}/gi, version).replace(/\${\s*filename\s*}/gi, filename);
|
|
39
|
+
return resolveCdn(providers, _package, version, filename);
|
|
117
40
|
});
|
|
118
41
|
hexo.extend.helper.register('fontcdn', function (fontName, type = 'css') {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
} = typeof this.config.providers === 'object' ? this.config.providers : {};
|
|
122
|
-
if (fontcdn in PROVIDERS.FONT) {
|
|
123
|
-
fontcdn = PROVIDERS.FONT[fontcdn];
|
|
124
|
-
}
|
|
125
|
-
return fontcdn.replace(/\${\s*fontname\s*}/gi, fontName).replace(/\${\s*type\s*}/gi, type);
|
|
42
|
+
const providers = typeof this.config.providers === 'object' ? this.config.providers : {};
|
|
43
|
+
return resolveFontCdn(providers, fontName, type);
|
|
126
44
|
});
|
|
127
45
|
hexo.extend.helper.register('iconcdn', function () {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
} = typeof this.config.providers === 'object' ? this.config.providers : {};
|
|
131
|
-
if (iconcdn in PROVIDERS.ICON) {
|
|
132
|
-
iconcdn = PROVIDERS.ICON[iconcdn];
|
|
133
|
-
}
|
|
134
|
-
return iconcdn;
|
|
46
|
+
const providers = typeof this.config.providers === 'object' ? this.config.providers : {};
|
|
47
|
+
return resolveIconCdn(providers);
|
|
135
48
|
});
|
|
136
49
|
};
|
package/lib/hexo/tag/tabs.js
CHANGED
|
@@ -3,15 +3,10 @@
|
|
|
3
3
|
* @module hexo/tag/tabs
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
function splitOption(option) {
|
|
12
|
-
const index = option.indexOf(':');
|
|
13
|
-
return index === -1 ? [option] : [option.slice(0, index), option.slice(index + 1)];
|
|
14
|
-
}
|
|
6
|
+
const {
|
|
7
|
+
splitOption,
|
|
8
|
+
splitTabOptions
|
|
9
|
+
} = require('../../util/tab-options');
|
|
15
10
|
|
|
16
11
|
/**
|
|
17
12
|
* Register custom Hexo tag {% tabs %}.
|
|
@@ -86,81 +81,6 @@ function splitOption(option) {
|
|
|
86
81
|
* {% endtabs %}
|
|
87
82
|
*/
|
|
88
83
|
module.exports = function (hexo) {
|
|
89
|
-
function splitTabOptions(s) {
|
|
90
|
-
const options = [];
|
|
91
|
-
const EOL = -1;
|
|
92
|
-
let i = 0;
|
|
93
|
-
let state = 1;
|
|
94
|
-
let begin = 0;
|
|
95
|
-
while (i <= s.length) {
|
|
96
|
-
const c = i < s.length ? s.charAt(i) : '';
|
|
97
|
-
switch (state) {
|
|
98
|
-
case 1:
|
|
99
|
-
if (c === ' ') {
|
|
100
|
-
state = 1;
|
|
101
|
-
begin = i + 1;
|
|
102
|
-
} else if (c === '"') {
|
|
103
|
-
state = 2;
|
|
104
|
-
begin = i + 1;
|
|
105
|
-
} else if (c === "'") {
|
|
106
|
-
state = 4;
|
|
107
|
-
begin = i + 1;
|
|
108
|
-
} else if (c === '') {
|
|
109
|
-
state = EOL;
|
|
110
|
-
} else {
|
|
111
|
-
state = 7;
|
|
112
|
-
}
|
|
113
|
-
break;
|
|
114
|
-
case 2:
|
|
115
|
-
if (c === '\\') {
|
|
116
|
-
state = 3;
|
|
117
|
-
} else if (c === '"') {
|
|
118
|
-
state = 6;
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
case 3:
|
|
122
|
-
state = 2;
|
|
123
|
-
break;
|
|
124
|
-
case 4:
|
|
125
|
-
if (c === '\\') {
|
|
126
|
-
state = 5;
|
|
127
|
-
} else if (c === "'") {
|
|
128
|
-
state = 6;
|
|
129
|
-
}
|
|
130
|
-
break;
|
|
131
|
-
case 5:
|
|
132
|
-
state = 4;
|
|
133
|
-
break;
|
|
134
|
-
case 6:
|
|
135
|
-
options.push(s.substring(begin, i - 1));
|
|
136
|
-
begin = i + 1;
|
|
137
|
-
if (c === ' ') {
|
|
138
|
-
state = 1;
|
|
139
|
-
} else if (c === '') {
|
|
140
|
-
state = EOL;
|
|
141
|
-
} else {
|
|
142
|
-
throw new Error(`malformatted tab options: ${s}`);
|
|
143
|
-
}
|
|
144
|
-
break;
|
|
145
|
-
case 7:
|
|
146
|
-
if (c === ' ') {
|
|
147
|
-
options.push(s.substring(begin, i));
|
|
148
|
-
begin = i + 1;
|
|
149
|
-
state = 1;
|
|
150
|
-
} else if (c === '') {
|
|
151
|
-
options.push(s.substring(begin, i));
|
|
152
|
-
begin = i + 1;
|
|
153
|
-
state = EOL;
|
|
154
|
-
}
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
i++;
|
|
158
|
-
}
|
|
159
|
-
if (state !== EOL) {
|
|
160
|
-
throw new Error(`malformatted tab options: ${s}`);
|
|
161
|
-
}
|
|
162
|
-
return options;
|
|
163
|
-
}
|
|
164
84
|
let tabCount = 0;
|
|
165
85
|
function processTag(options, content) {
|
|
166
86
|
let classes = '';
|
|
@@ -27,9 +27,15 @@
|
|
|
27
27
|
"description": "Language of Artalk, e.g., en, zh-CN, or auto",
|
|
28
28
|
"nullable": true
|
|
29
29
|
},
|
|
30
|
+
"prefer_remote_conf": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"default": false,
|
|
33
|
+
"description": "Prefer server settings over local options",
|
|
34
|
+
"nullable": true
|
|
35
|
+
},
|
|
30
36
|
"dark_mode": {
|
|
31
37
|
"type": ["boolean", "string"],
|
|
32
|
-
"description": "Dark mode: true, false, or
|
|
38
|
+
"description": "Dark mode: true, false, or auto; follows page appearance when unset",
|
|
33
39
|
"nullable": true
|
|
34
40
|
}
|
|
35
41
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "/comment/cusdis.json",
|
|
4
|
-
"description": "Cusdis comment plugin configurations\nhttps://cusdis.com/doc",
|
|
4
|
+
"description": "Cusdis comment plugin configurations\nDEPRECATED: Cusdis was archived on July 17, 2026. Use another comment system instead.\nhttps://cusdis.com/doc",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"type": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "/comment/gitalk.json",
|
|
4
|
-
"description": "Gitalk comment plugin configurations",
|
|
4
|
+
"description": "Gitalk 2 comment plugin configurations",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"type": {
|
|
@@ -14,12 +14,29 @@
|
|
|
14
14
|
},
|
|
15
15
|
"client_secret": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "Legacy option, ignored; configure the secret on your proxy"
|
|
18
18
|
},
|
|
19
19
|
"repo": {
|
|
20
20
|
"type": "string",
|
|
21
21
|
"description": "GitHub repository"
|
|
22
22
|
},
|
|
23
|
+
"backend": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"enum": ["issues", "discussions"],
|
|
26
|
+
"default": "issues",
|
|
27
|
+
"description": "Comment storage backend"
|
|
28
|
+
},
|
|
29
|
+
"number": {
|
|
30
|
+
"type": "integer",
|
|
31
|
+
"minimum": 1,
|
|
32
|
+
"description": "Issue or Discussion number; overrides page ID lookup",
|
|
33
|
+
"nullable": true
|
|
34
|
+
},
|
|
35
|
+
"category": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "Discussion category name or slug",
|
|
38
|
+
"nullable": true
|
|
39
|
+
},
|
|
23
40
|
"owner": {
|
|
24
41
|
"type": "string",
|
|
25
42
|
"description": "GitHub repository owner. Can be personal user or organization"
|
|
@@ -52,17 +69,17 @@
|
|
|
52
69
|
"create_issue_manually": {
|
|
53
70
|
"type": "boolean",
|
|
54
71
|
"description": "Create GitHub issues manually for each page",
|
|
55
|
-
"default":
|
|
72
|
+
"default": true,
|
|
56
73
|
"nullable": true
|
|
57
74
|
},
|
|
58
75
|
"proxy": {
|
|
59
76
|
"type": "string",
|
|
60
|
-
"description": "
|
|
77
|
+
"description": "Your Gitalk 2 proxy origin",
|
|
61
78
|
"nullable": true
|
|
62
79
|
},
|
|
63
80
|
"flip_move_options": {
|
|
64
81
|
"type": "object",
|
|
65
|
-
"description": "
|
|
82
|
+
"description": "Legacy animation option, ignored",
|
|
66
83
|
"nullable": true
|
|
67
84
|
},
|
|
68
85
|
"enable_hotkey": {
|
|
@@ -77,5 +94,5 @@
|
|
|
77
94
|
"nullable": true
|
|
78
95
|
}
|
|
79
96
|
},
|
|
80
|
-
"required": ["type", "client_id", "
|
|
97
|
+
"required": ["type", "client_id", "proxy", "repo", "owner", "admin"]
|
|
81
98
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "/comment/gitment.json",
|
|
4
|
-
"description": "Gitment comment plugin configurations
|
|
4
|
+
"description": "Gitment comment plugin configurations (deprecated)",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"type": {
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "/comment/livere.json",
|
|
4
|
-
"description": "Livere comment plugin configurations",
|
|
4
|
+
"description": "Livere comment plugin configurations\nhttps://admin.livere.org/",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"type": {
|
|
8
8
|
"type": "string",
|
|
9
9
|
"const": "livere"
|
|
10
10
|
},
|
|
11
|
+
"client_id": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Client ID in the installation code of LiveRe (the client-id attribute of <livere-comment>)"
|
|
14
|
+
},
|
|
11
15
|
"uid": {
|
|
12
16
|
"type": "string",
|
|
13
|
-
"description": "LiveRe
|
|
17
|
+
"description": "UID of the legacy LiveRe City installation code (the data-uid attribute). Ignored if client_id is set",
|
|
18
|
+
"nullable": true
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
|
-
"required": ["type",
|
|
21
|
+
"required": ["type"],
|
|
22
|
+
"anyOf": [{ "required": ["client_id"] }, { "required": ["uid"] }]
|
|
17
23
|
}
|
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
},
|
|
11
11
|
"env_id": {
|
|
12
12
|
"type": "string",
|
|
13
|
-
"description": "
|
|
13
|
+
"description": "CloudBase environment ID or backend URL"
|
|
14
14
|
},
|
|
15
15
|
"region": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "CloudBase region",
|
|
18
18
|
"nullable": true
|
|
19
19
|
},
|
|
20
20
|
"lang": {
|
|
21
21
|
"type": "string",
|
|
22
|
-
"description": "
|
|
22
|
+
"description": "Comment UI language; defaults to the page or site language",
|
|
23
23
|
"default": "zh-CN",
|
|
24
24
|
"nullable": true
|
|
25
25
|
}
|
|
@@ -19,7 +19,32 @@
|
|
|
19
19
|
"lang": {
|
|
20
20
|
"type": "string",
|
|
21
21
|
"description": "Display language.",
|
|
22
|
-
"enum": [
|
|
22
|
+
"enum": [
|
|
23
|
+
"zh",
|
|
24
|
+
"zh-CN",
|
|
25
|
+
"zh-TW",
|
|
26
|
+
"en",
|
|
27
|
+
"en-US",
|
|
28
|
+
"jp",
|
|
29
|
+
"jp-JP",
|
|
30
|
+
"pt-BR",
|
|
31
|
+
"ru",
|
|
32
|
+
"ru-RU",
|
|
33
|
+
"fr",
|
|
34
|
+
"fr-FR",
|
|
35
|
+
"es",
|
|
36
|
+
"es-MX",
|
|
37
|
+
"de",
|
|
38
|
+
"id",
|
|
39
|
+
"id-ID",
|
|
40
|
+
"it",
|
|
41
|
+
"it-IT",
|
|
42
|
+
"ko",
|
|
43
|
+
"ko-KR",
|
|
44
|
+
"vi",
|
|
45
|
+
"vi-VN",
|
|
46
|
+
null
|
|
47
|
+
],
|
|
23
48
|
"default": "zh-CN",
|
|
24
49
|
"nullable": true
|
|
25
50
|
},
|
|
@@ -29,7 +54,7 @@
|
|
|
29
54
|
"nullable": true
|
|
30
55
|
},
|
|
31
56
|
"emoji": {
|
|
32
|
-
"type": "array",
|
|
57
|
+
"type": ["array", "boolean"],
|
|
33
58
|
"items": {
|
|
34
59
|
"oneOf": [
|
|
35
60
|
{
|
|
@@ -167,7 +192,7 @@
|
|
|
167
192
|
},
|
|
168
193
|
"copyright": {
|
|
169
194
|
"type": "boolean",
|
|
170
|
-
"description": "
|
|
195
|
+
"description": "Show copyright and version in the footer",
|
|
171
196
|
"default": true,
|
|
172
197
|
"nullable": true
|
|
173
198
|
}
|