hexo-design-cards 0.1.3 → 0.1.5
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/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/tags/banner.js +12 -1
- package/tags/compare.js +1 -1
- package/test/tags.test.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.5] - 2026-03-02
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Banner: added `id` attribute to `<h2>` for TOC anchor navigation (NExT theme TOC click-to-scroll now works)
|
|
7
|
+
|
|
8
|
+
## [0.1.4] - 2026-03-02
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Compare: recommended option background color was identical to first normal option (both used c3). Reordered normal option color sequence from [c3,c2,c1,c4] to [c4,c2,c1,c3] so they are visually distinct.
|
|
12
|
+
|
|
3
13
|
## [0.1.3] - 2026-03-02
|
|
4
14
|
|
|
5
15
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-design-cards",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Beautiful design card tags for Hexo — flow diagrams, header cards, accent cards, comparison cards, quotes, alerts, mini cards, and section banners with customizable colorways.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
package/tags/banner.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const { getColorway } = require('../lib/colorways');
|
|
3
3
|
|
|
4
|
+
function slugify(text) {
|
|
5
|
+
return text
|
|
6
|
+
.trim()
|
|
7
|
+
.toLowerCase()
|
|
8
|
+
.replace(/[^\w\u3130-\u318F\uAC00-\uD7AF\u4E00-\u9FFF\s-]/g, '')
|
|
9
|
+
.replace(/[\s]+/g, '-')
|
|
10
|
+
.replace(/-+/g, '-')
|
|
11
|
+
.replace(/^-|-$/g, '');
|
|
12
|
+
}
|
|
13
|
+
|
|
4
14
|
// {% banner "Section N: Title" %}
|
|
5
15
|
module.exports = function(hexo) {
|
|
6
16
|
hexo.extend.tag.register('banner', function(args) {
|
|
7
17
|
const cw = getColorway(hexo, this);
|
|
8
18
|
const text = args.join(' ').replace(/^"|"$/g, '');
|
|
9
|
-
|
|
19
|
+
const id = slugify(text);
|
|
20
|
+
return '<div class="dc-banner" style="background:' + cw.c1 + '"><h2 id="' + id + '">' + text + '</h2></div>';
|
|
10
21
|
});
|
|
11
22
|
};
|
package/tags/compare.js
CHANGED
|
@@ -21,7 +21,7 @@ module.exports = function(hexo) {
|
|
|
21
21
|
const title = args[0] || '';
|
|
22
22
|
const emoji = args[1] || '';
|
|
23
23
|
const recommended = args.indexOf('recommended') > -1;
|
|
24
|
-
const colors = [cw.
|
|
24
|
+
const colors = [cw.c4, cw.c2, cw.c1, cw.c3];
|
|
25
25
|
const color = recommended ? cw.c3 : colors[optionIndex % colors.length];
|
|
26
26
|
const bg = tint(color, 0.08);
|
|
27
27
|
optionIndex++;
|
package/test/tags.test.js
CHANGED
|
@@ -11,7 +11,7 @@ describe('hexo-design-cards tags', function() {
|
|
|
11
11
|
const html = mock.callTag('banner', ['Getting Started']);
|
|
12
12
|
assert(html.includes('dc-banner'));
|
|
13
13
|
assert(html.includes('Getting Started'));
|
|
14
|
-
assert(html.includes('<h2>'));
|
|
14
|
+
assert(html.includes('<h2 id="getting-started">'));
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
|