jekyll-theme-chirpy 4.3.4 → 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.
- checksums.yaml +4 -4
- data/README.md +20 -162
- data/_config.yml +44 -18
- data/_data/assets/cross_origin.yml +62 -0
- data/_data/assets/self_host.yml +51 -0
- data/_data/locales/en.yml +3 -15
- data/_data/locales/id-ID.yml +2 -14
- data/_data/locales/ko-KR.yml +78 -0
- data/_data/locales/my-MM.yml +78 -0
- data/_data/locales/ru-RU.yml +78 -0
- data/_data/locales/uk-UA.yml +78 -0
- data/_data/locales/zh-CN.yml +2 -14
- data/_data/share.yml +1 -1
- data/_includes/assets-origin.html +12 -0
- data/_includes/{disqus.html → comments/disqus.html} +4 -4
- data/_includes/comments/giscus.html +56 -0
- data/_includes/comments/utterances.html +51 -0
- data/_includes/comments.html +5 -0
- data/_includes/footer.html +1 -1
- data/_includes/head.html +35 -20
- data/_includes/js-selector.html +43 -11
- data/_includes/jsdelivr-combine.html +32 -0
- data/_includes/mermaid.html +31 -3
- data/_includes/mode-toggle.html +49 -65
- data/_includes/post-sharing.html +2 -2
- data/_includes/read-time.html +3 -3
- data/_includes/refactor-content.html +160 -36
- data/_includes/related-posts.html +1 -1
- data/_includes/search-loader.html +1 -1
- data/_includes/search-results.html +0 -8
- data/_includes/sidebar.html +16 -17
- data/_includes/timeago.html +11 -23
- data/_includes/toc.html +16 -0
- data/_includes/topbar.html +2 -3
- data/_includes/trending-tags.html +14 -0
- data/_includes/update-list.html +16 -0
- data/_layouts/archives.html +5 -7
- data/_layouts/category.html +3 -5
- data/_layouts/default.html +10 -4
- data/_layouts/home.html +14 -11
- data/_layouts/page.html +47 -22
- data/_layouts/post.html +128 -127
- data/_layouts/tag.html +3 -5
- data/_sass/addon/commons.scss +276 -290
- data/_sass/addon/module.scss +67 -31
- data/_sass/addon/syntax.scss +90 -66
- data/_sass/addon/variables.scss +7 -7
- data/_sass/colors/dark-syntax.scss +4 -4
- data/_sass/colors/dark-typography.scss +21 -9
- data/_sass/colors/light-syntax.scss +9 -4
- data/_sass/colors/light-typography.scss +18 -6
- data/_sass/jekyll-theme-chirpy.scss +1 -1
- data/_sass/layout/home.scss +6 -2
- data/_sass/layout/post.scss +52 -46
- data/_tabs/about.md +2 -2
- data/assets/404.html +0 -2
- data/assets/js/data/search.json +1 -0
- data/assets/js/data/swcache.js +11 -20
- data/assets/js/dist/categories.min.js +2 -2
- data/assets/js/dist/commons.min.js +2 -2
- data/assets/js/dist/home.min.js +2 -2
- data/assets/js/dist/misc.min.js +6 -0
- data/assets/js/dist/page.min.js +2 -2
- data/assets/js/dist/post.min.js +2 -2
- data/assets/js/dist/pvreport.min.js +2 -2
- metadata +16 -6
- data/_includes/css-selector.html +0 -15
- data/_includes/no-zero-date.html +0 -13
- data/_includes/panel.html +0 -59
data/_includes/mermaid.html
CHANGED
@@ -2,13 +2,39 @@
|
|
2
2
|
mermaid-js loader
|
3
3
|
-->
|
4
4
|
|
5
|
-
<script src="
|
5
|
+
<script src="{{ site.data.assets[origin].mermaid.js }}"></script>
|
6
|
+
|
6
7
|
<script>
|
7
8
|
$(function() {
|
9
|
+
function updateMermaid(event) {
|
10
|
+
if (event.source === window && event.data &&
|
11
|
+
event.data.direction === ModeToggle.ID) {
|
12
|
+
|
13
|
+
const mode = event.data.message;
|
14
|
+
|
15
|
+
if (typeof mermaid === "undefined") {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
|
19
|
+
let expectedTheme = (mode === ModeToggle.DARK_MODE? "dark" : "default");
|
20
|
+
let config = { theme: expectedTheme };
|
21
|
+
|
22
|
+
/* Re-render the SVG › <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344> */
|
23
|
+
$(".mermaid").each(function() {
|
24
|
+
let svgCode = $(this).prev().children().html();
|
25
|
+
$(this).removeAttr("data-processed");
|
26
|
+
$(this).html(svgCode);
|
27
|
+
});
|
28
|
+
|
29
|
+
mermaid.initialize(config);
|
30
|
+
mermaid.init(undefined, ".mermaid");
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
8
34
|
let initTheme = "default";
|
9
35
|
|
10
|
-
if ($("html[mode=dark]").length > 0
|
11
|
-
|| ($("html[mode]").length == 0
|
36
|
+
if ($("html[data-mode=dark]").length > 0
|
37
|
+
|| ($("html[data-mode]").length == 0
|
12
38
|
&& window.matchMedia("(prefers-color-scheme: dark)").matches ) ) {
|
13
39
|
initTheme = "dark";
|
14
40
|
}
|
@@ -25,5 +51,7 @@
|
|
25
51
|
});
|
26
52
|
|
27
53
|
mermaid.initialize(mermaidConf);
|
54
|
+
|
55
|
+
window.addEventListener("message", updateMermaid);
|
28
56
|
});
|
29
57
|
</script>
|
data/_includes/mode-toggle.html
CHANGED
@@ -2,14 +2,13 @@
|
|
2
2
|
Switch the mode between dark and light.
|
3
3
|
-->
|
4
4
|
|
5
|
-
<i class="mode-toggle fas fa-adjust"></i>
|
6
|
-
|
7
5
|
<script type="text/javascript">
|
8
|
-
|
9
6
|
class ModeToggle {
|
10
7
|
static get MODE_KEY() { return "mode"; }
|
8
|
+
static get MODE_ATTR() { return "data-mode"; }
|
11
9
|
static get DARK_MODE() { return "dark"; }
|
12
10
|
static get LIGHT_MODE() { return "light"; }
|
11
|
+
static get ID() { return "mode-toggle"; }
|
13
12
|
|
14
13
|
constructor() {
|
15
14
|
if (this.hasMode) {
|
@@ -24,10 +23,10 @@
|
|
24
23
|
}
|
25
24
|
}
|
26
25
|
|
27
|
-
|
26
|
+
let self = this;
|
28
27
|
|
29
28
|
/* always follow the system prefers */
|
30
|
-
this.sysDarkPrefers.
|
29
|
+
this.sysDarkPrefers.addEventListener("change", () => {
|
31
30
|
if (self.hasMode) {
|
32
31
|
if (self.isDarkMode) {
|
33
32
|
if (!self.isSysDarkPrefer) {
|
@@ -43,34 +42,19 @@
|
|
43
42
|
self.clearMode();
|
44
43
|
}
|
45
44
|
|
46
|
-
self.
|
45
|
+
self.notify();
|
46
|
+
|
47
47
|
});
|
48
48
|
|
49
49
|
} /* constructor() */
|
50
50
|
|
51
|
-
|
52
|
-
setDark() {
|
53
|
-
$('html').attr(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
|
54
|
-
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
|
55
|
-
}
|
56
|
-
|
57
|
-
setLight() {
|
58
|
-
$('html').attr(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
|
59
|
-
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
|
60
|
-
}
|
61
|
-
|
62
|
-
clearMode() {
|
63
|
-
$('html').removeAttr(ModeToggle.MODE_KEY);
|
64
|
-
sessionStorage.removeItem(ModeToggle.MODE_KEY);
|
65
|
-
}
|
66
|
-
|
67
51
|
get sysDarkPrefers() { return window.matchMedia("(prefers-color-scheme: dark)"); }
|
68
52
|
|
69
53
|
get isSysDarkPrefer() { return this.sysDarkPrefers.matches; }
|
70
54
|
|
71
|
-
get isDarkMode() { return this.mode
|
55
|
+
get isDarkMode() { return this.mode === ModeToggle.DARK_MODE; }
|
72
56
|
|
73
|
-
get isLightMode() { return this.mode
|
57
|
+
get isLightMode() { return this.mode === ModeToggle.LIGHT_MODE; }
|
74
58
|
|
75
59
|
get hasMode() { return this.mode != null; }
|
76
60
|
|
@@ -79,67 +63,67 @@
|
|
79
63
|
/* get the current mode on screen */
|
80
64
|
get modeStatus() {
|
81
65
|
if (this.isDarkMode
|
82
|
-
|| (!this.hasMode && this.isSysDarkPrefer)
|
66
|
+
|| (!this.hasMode && this.isSysDarkPrefer)) {
|
83
67
|
return ModeToggle.DARK_MODE;
|
84
68
|
} else {
|
85
69
|
return ModeToggle.LIGHT_MODE;
|
86
70
|
}
|
87
71
|
}
|
88
72
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
73
|
+
setDark() {
|
74
|
+
$('html').attr(ModeToggle.MODE_ATTR, ModeToggle.DARK_MODE);
|
75
|
+
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
|
76
|
+
}
|
77
|
+
|
78
|
+
setLight() {
|
79
|
+
$('html').attr(ModeToggle.MODE_ATTR, ModeToggle.LIGHT_MODE);
|
80
|
+
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
|
81
|
+
}
|
93
82
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
$(this).html(svgCode);
|
99
|
-
});
|
83
|
+
clearMode() {
|
84
|
+
$('html').removeAttr(ModeToggle.MODE_ATTR);
|
85
|
+
sessionStorage.removeItem(ModeToggle.MODE_KEY);
|
86
|
+
}
|
100
87
|
|
101
|
-
|
102
|
-
|
103
|
-
|
88
|
+
/* Notify another plugins that the theme mode has changed */
|
89
|
+
notify() {
|
90
|
+
window.postMessage({
|
91
|
+
direction: ModeToggle.ID,
|
92
|
+
message: this.modeStatus
|
93
|
+
}, "*");
|
104
94
|
}
|
105
95
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
if (this.isLightMode) {
|
110
|
-
this.clearMode();
|
111
|
-
} else {
|
112
|
-
this.setLight();
|
113
|
-
}
|
96
|
+
} /* ModeToggle */
|
97
|
+
|
98
|
+
const toggle = new ModeToggle();
|
114
99
|
|
100
|
+
function flipMode() {
|
101
|
+
if (toggle.hasMode) {
|
102
|
+
if (toggle.isSysDarkPrefer) {
|
103
|
+
if (toggle.isLightMode) {
|
104
|
+
toggle.clearMode();
|
115
105
|
} else {
|
116
|
-
|
117
|
-
this.clearMode();
|
118
|
-
} else {
|
119
|
-
this.setDark();
|
120
|
-
}
|
106
|
+
toggle.setLight();
|
121
107
|
}
|
122
108
|
|
123
109
|
} else {
|
124
|
-
if (
|
125
|
-
|
110
|
+
if (toggle.isDarkMode) {
|
111
|
+
toggle.clearMode();
|
126
112
|
} else {
|
127
|
-
|
113
|
+
toggle.setDark();
|
128
114
|
}
|
129
115
|
}
|
130
116
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
$(".mode-toggle").click(function() {
|
117
|
+
} else {
|
118
|
+
if (toggle.isSysDarkPrefer) {
|
119
|
+
toggle.setLight();
|
120
|
+
} else {
|
121
|
+
toggle.setDark();
|
122
|
+
}
|
123
|
+
}
|
140
124
|
|
141
|
-
toggle.
|
125
|
+
toggle.notify();
|
142
126
|
|
143
|
-
})
|
127
|
+
} /* flipMode() */
|
144
128
|
|
145
129
|
</script>
|
data/_includes/post-sharing.html
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
{% assign url = page.url | absolute_url %}
|
10
10
|
|
11
11
|
{% for share in site.data.share.platforms %}
|
12
|
-
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
|
12
|
+
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url | escape %}
|
13
13
|
<a href="{{ link }}" data-toggle="tooltip" data-placement="top"
|
14
14
|
title="{{ share.type }}" target="_blank" rel="noopener" aria-label="{{ share.type }}">
|
15
15
|
<i class="fa-fw {{ share.icon }}"></i>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<i id="copy-link" class="fa-fw fas fa-link small"
|
20
20
|
data-toggle="tooltip" data-placement="top"
|
21
21
|
title="{{ site.data.locales[lang].post.button.share_link.title }}"
|
22
|
-
title-succeed="{{ site.data.locales[lang].post.button.share_link.succeed }}">
|
22
|
+
data-title-succeed="{{ site.data.locales[lang].post.button.share_link.succeed }}">
|
23
23
|
</i>
|
24
24
|
|
25
25
|
</span>
|
data/_includes/read-time.html
CHANGED
@@ -22,9 +22,9 @@
|
|
22
22
|
<!-- return element -->
|
23
23
|
<span class="readtime" data-toggle="tooltip" data-placement="bottom"
|
24
24
|
title="{{ words }} {{ site.data.locales[lang].post.words }}">
|
25
|
-
{{- read_time -}}{{" "}}{{- site.data.locales[lang].post.read_time.unit -}}
|
25
|
+
<em>{{- read_time -}}{{" "}}{{- site.data.locales[lang].post.read_time.unit -}}</em>
|
26
26
|
{%- if include.prompt -%}
|
27
|
-
{
|
28
|
-
{
|
27
|
+
{%- assign _prompt_words = read_prompt | number_of_words: 'auto' -%}
|
28
|
+
{%- unless _prompt_words > 1 -%}{{ " " }}{%- endunless -%}{{ read_prompt }}
|
29
29
|
{%- endif -%}
|
30
30
|
</span>
|
@@ -38,63 +38,101 @@
|
|
38
38
|
%}
|
39
39
|
{% endif %}
|
40
40
|
|
41
|
-
|
42
41
|
<!-- images -->
|
43
42
|
|
44
|
-
{%
|
45
|
-
|
46
|
-
<!-- add CDN prefix if it exists -->
|
47
|
-
|
48
|
-
{% if site.img_cdn != '' %}
|
49
|
-
{% assign img_path_replacement = '<img src="' | append: site.img_cdn | append: '/' %}
|
50
|
-
{% else %}
|
51
|
-
{% assign img_path_replacement = '<img src="' | append: site.baseurl | append: '/' %}
|
52
|
-
{% endif %}
|
53
|
-
|
54
|
-
{% assign _content = _content | replace: '<img src="/', img_path_replacement %}
|
55
|
-
|
56
|
-
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
57
|
-
|
58
|
-
{% assign _content = _content | replace: '<img src="', '<img data-proofer-ignore data-src="' %}
|
59
|
-
|
60
|
-
<!-- add image placehoder to prevent layout reflow -->
|
43
|
+
{% assign IMG_TAG = '<img ' %}
|
61
44
|
|
45
|
+
{% if _content contains IMG_TAG %}
|
62
46
|
{% assign _img_content = nil %}
|
47
|
+
{% assign _img_snippets = _content | split: IMG_TAG %}
|
63
48
|
|
64
|
-
{%
|
65
|
-
|
66
|
-
{% for _img in _images %}
|
49
|
+
{% for _img_snippet in _img_snippets %}
|
67
50
|
{% if forloop.first %}
|
68
|
-
{% assign _img_content =
|
51
|
+
{% assign _img_content = _img_snippet %}
|
69
52
|
{% continue %}
|
70
53
|
{% endif %}
|
71
54
|
|
72
55
|
{% assign _width = nil %}
|
73
56
|
{% assign _height = nil %}
|
74
|
-
{% assign
|
57
|
+
{% assign _src = nil %}
|
58
|
+
|
59
|
+
{% assign _left = _img_snippet | split: '>' | first %}
|
60
|
+
{% assign _right = _img_snippet | remove: _left %}
|
61
|
+
|
62
|
+
{% assign _left = _left | remove: ' /' %}
|
63
|
+
{% assign _left = _left | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
64
|
+
{% assign _attrs = _left | split: ' ' %}
|
75
65
|
|
76
66
|
{% for _attr in _attrs %}
|
77
|
-
{%
|
78
|
-
{%
|
67
|
+
{% assign _pair = _attr | split: '=' %}
|
68
|
+
{% if _pair.size < 2 %}
|
69
|
+
{% continue %}
|
70
|
+
{% endif %}
|
71
|
+
|
72
|
+
{% capture _key %}{{ _pair | first }}{% endcapture %}
|
73
|
+
{% capture _value %}{{ _pair | last | replace: '"', '' }}{% endcapture %}
|
79
74
|
|
80
75
|
{% case _key %}
|
81
76
|
{% when 'width' %}
|
82
77
|
{% assign _width = _value %}
|
83
78
|
{% when 'height' %}
|
84
79
|
{% assign _height = _value %}
|
80
|
+
{% when 'src' %}
|
81
|
+
{% assign _src = _value %}
|
85
82
|
{% endcase %}
|
86
83
|
|
87
|
-
{% if _width and _height %}
|
88
|
-
{% capture _svg %}data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{_width}} {{_height}}'%3E%3C/svg%3E{% endcapture %}
|
89
|
-
{% assign _img_content = _img_content | append: '<img src="' | append: _svg | append: '" ' | append: _img %}
|
84
|
+
{% if _width and _height and _src %}
|
90
85
|
{% break %}
|
91
86
|
{% endif %}
|
92
|
-
|
93
87
|
{% endfor %}
|
94
88
|
|
95
|
-
{%
|
96
|
-
{%
|
97
|
-
|
89
|
+
{% if _src %}
|
90
|
+
{% unless _src contains '://' %}
|
91
|
+
|
92
|
+
<!-- Add CDN URL -->
|
93
|
+
{% if site.img_cdn %}
|
94
|
+
{% assign _src_prefix = site.img_cdn %}
|
95
|
+
{% else %}
|
96
|
+
{% assign _src_prefix = site.baseurl %}
|
97
|
+
{% endif %}
|
98
|
+
|
99
|
+
<!-- Add image path -->
|
100
|
+
{% if page.img_path %}
|
101
|
+
{% assign _path = page.img_path %}
|
102
|
+
{% assign last_char = _path | slice: -1 %}
|
103
|
+
|
104
|
+
{% unless last_char == '/' %}
|
105
|
+
{% assign _path = _path | append: '/' %}
|
106
|
+
{% endunless %}
|
107
|
+
|
108
|
+
{% assign _src_prefix = _src_prefix | append: _path %}
|
109
|
+
{% endif %}
|
110
|
+
|
111
|
+
{% assign _final_src = _src_prefix | append: _src %}
|
112
|
+
{% assign _left = _left | replace: _src, _final_src %}
|
113
|
+
|
114
|
+
{% endunless %}
|
115
|
+
|
116
|
+
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
117
|
+
|
118
|
+
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
119
|
+
|
120
|
+
{% endif %}
|
121
|
+
|
122
|
+
<!-- Add SVG placehoder to prevent layout reflow -->
|
123
|
+
|
124
|
+
{% if _width and _height %}
|
125
|
+
{%- capture _svg -%}
|
126
|
+
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
127
|
+
{%- endcapture -%}
|
128
|
+
|
129
|
+
{% assign _left = _svg | append: ' ' | append: _left %}
|
130
|
+
{% endif %}
|
131
|
+
|
132
|
+
<!-- Bypass the HTML-proofer test -->
|
133
|
+
{% assign _left = _left | append: ' data-proofer-ignore' %}
|
134
|
+
|
135
|
+
{% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
|
98
136
|
|
99
137
|
{% endfor %}
|
100
138
|
|
@@ -118,22 +156,22 @@
|
|
118
156
|
{% assign _left = _snippet | split: '><' | last%}
|
119
157
|
|
120
158
|
{% if _left contains 'file="' %}
|
121
|
-
{% assign
|
159
|
+
{% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
|
122
160
|
{% assign _label_icon = 'far fa-file-code' %}
|
123
161
|
{% else %}
|
124
162
|
{% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
|
125
|
-
{% capture
|
163
|
+
{% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %}
|
126
164
|
{% assign _label_icon = 'fas fa-code small' %}
|
127
165
|
{% endif %}
|
128
166
|
|
129
167
|
{% capture _label %}
|
130
|
-
<span text
|
168
|
+
<span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
|
131
169
|
{% endcapture %}
|
132
170
|
|
133
171
|
{% assign _new_content = _new_content | append: _snippet
|
134
172
|
| append: '<div class="code-header">'
|
135
173
|
| append: _label
|
136
|
-
| append: '<button aria-label="copy" title-succeed="'
|
174
|
+
| append: '<button aria-label="copy" data-title-succeed="'
|
137
175
|
| append: site.data.locales[lang].post.button.copy_code.succeed
|
138
176
|
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
139
177
|
| append: '<div class="highlight"><code>'
|
@@ -147,6 +185,92 @@
|
|
147
185
|
|
148
186
|
{% endif %}
|
149
187
|
|
188
|
+
<!-- Create heading anchors -->
|
189
|
+
|
190
|
+
{% assign heading_levels = '2,3,4,5' | split: ',' %}
|
191
|
+
{% assign _heading_content = _content %}
|
192
|
+
|
193
|
+
{% for level in heading_levels %}
|
194
|
+
{% capture mark_start %}<h{{ level }} id="{% endcapture %}
|
195
|
+
{% capture mark_end %}</h{{ level }}>{% endcapture %}
|
196
|
+
|
197
|
+
{% if _heading_content contains mark_start %}
|
198
|
+
{% assign _new_content = nil %}
|
199
|
+
{% assign heading_snippets = _heading_content | split: mark_start %}
|
200
|
+
|
201
|
+
{% for snippet in heading_snippets %}
|
202
|
+
{% if forloop.first %}
|
203
|
+
{% assign _new_content = snippet %}
|
204
|
+
{% continue %}
|
205
|
+
{% endif %}
|
206
|
+
|
207
|
+
{% assign id = snippet | split: '"' | first %}
|
208
|
+
{% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %}
|
209
|
+
|
210
|
+
{% assign left = snippet | split: mark_end | first %}
|
211
|
+
{% assign right = snippet | slice: left.size, snippet.size %}
|
212
|
+
{% assign left = left | replace: '">', '"><span class="mr-2">' | append: '</span>' %}
|
213
|
+
|
214
|
+
{% assign _new_content = _new_content | append: mark_start
|
215
|
+
| append: left | append: anchor | append: mark_end | append: right
|
216
|
+
%}
|
217
|
+
|
218
|
+
{% endfor %}
|
219
|
+
|
220
|
+
{% assign _heading_content = _new_content %}
|
221
|
+
|
222
|
+
{% endif %}
|
223
|
+
{% endfor %}
|
224
|
+
|
225
|
+
{% assign _content = _heading_content %}
|
226
|
+
|
227
|
+
<!-- Wrap prompt element of blockquote with the <div> tag -->
|
228
|
+
|
229
|
+
{% assign blockquote_start = '<blockquote class=' %}
|
230
|
+
{% assign blockquote_end = '</blockquote>' %}
|
231
|
+
{% assign cls_prefix = 'prompt-' %}
|
232
|
+
|
233
|
+
{% if _content contains blockquote_start %}
|
234
|
+
|
235
|
+
{% assign _prompt_content = nil %}
|
236
|
+
{% assign _prompt_snippets = _content | split: blockquote_start %}
|
237
|
+
|
238
|
+
{% for _snippet in _prompt_snippets %}
|
239
|
+
|
240
|
+
{% if forloop.first %}
|
241
|
+
{% assign _prompt_content = _snippet %}
|
242
|
+
{% continue %}
|
243
|
+
{% endif %}
|
244
|
+
|
245
|
+
{% assign left = _snippet | split: blockquote_end | first %}
|
246
|
+
{% assign right = _snippet | slice: left.size, _snippet.size %}
|
247
|
+
|
248
|
+
{% assign cls_str = left | split: '>' | first %}
|
249
|
+
{% assign cls_array = cls_str | remove: '"' | split: ' ' %}
|
250
|
+
{% assign is_prompt = false %}
|
251
|
+
|
252
|
+
{% for cls in cls_array %}
|
253
|
+
{% if cls contains cls_prefix %}
|
254
|
+
{% assign is_prompt = true %}
|
255
|
+
{% break %}
|
256
|
+
{% endif %}
|
257
|
+
{% endfor %}
|
258
|
+
|
259
|
+
{% unless is_prompt %}
|
260
|
+
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: _snippet %}
|
261
|
+
{% continue %}
|
262
|
+
{% endunless %}
|
263
|
+
|
264
|
+
{% assign left = left | slice: cls_str.size, left.size %}
|
265
|
+
{% assign left = cls_str | append: '><div' | append: left | append: '</div>' %}
|
266
|
+
|
267
|
+
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: left | append: right %}
|
268
|
+
|
269
|
+
{% endfor %}
|
270
|
+
|
271
|
+
{% assign _content = _prompt_content %}
|
272
|
+
|
273
|
+
{% endif %}
|
150
274
|
|
151
275
|
<!-- return -->
|
152
276
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
{% capture not_found %}<p class="mt-5">{{ site.data.locales[lang].search.no_results }}</p>{% endcapture %}
|
18
18
|
|
19
|
-
<script src="
|
19
|
+
<script src="{{ site.data.assets[origin].search.js }}"></script>
|
20
20
|
|
21
21
|
<script>
|
22
22
|
SimpleJekyllSearch({
|
@@ -4,15 +4,7 @@
|
|
4
4
|
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
|
5
5
|
<div class="col-12 col-sm-11 post-content">
|
6
6
|
<div id="search-hints">
|
7
|
-
<h4 class="text-muted mb-4">{{ site.data.locales[lang].panel.trending_tags }}</h4>
|
8
|
-
|
9
7
|
{% include trending-tags.html %}
|
10
|
-
|
11
|
-
{% for tag in trending_tags %}
|
12
|
-
{% capture url %}/tags/{{ tag | slugify | url_encode }}/{% endcapture %}
|
13
|
-
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
|
14
|
-
{% endfor %}
|
15
|
-
|
16
8
|
</div>
|
17
9
|
<div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
|
18
10
|
</div>
|
data/_includes/sidebar.html
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
The Side Bar
|
3
3
|
-->
|
4
4
|
|
5
|
-
<div id="sidebar" class="d-flex flex-column align-items-end"
|
5
|
+
<div id="sidebar" class="d-flex flex-column align-items-end">
|
6
6
|
<div class="profile-wrapper text-center">
|
7
7
|
<div id="avatar">
|
8
8
|
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto">
|
9
|
-
{% if site.avatar !=
|
9
|
+
{% if site.avatar != empty and site.avatar %}
|
10
10
|
{% capture avatar_url %}
|
11
|
-
{
|
11
|
+
{% if site.avatar contains '://' %}
|
12
12
|
{{ site.avatar }}
|
13
|
-
{
|
13
|
+
{% elsif site.img_cdn != empty and site.img_cdn %}
|
14
14
|
{{ site.avatar | prepend: site.img_cdn }}
|
15
|
-
{
|
15
|
+
{% else %}
|
16
16
|
{{ site.avatar | relative_url }}
|
17
|
-
{
|
17
|
+
{% endif %}
|
18
18
|
{% endcapture %}
|
19
19
|
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'">
|
20
20
|
{% endif %}
|
@@ -53,6 +53,16 @@
|
|
53
53
|
|
54
54
|
<div class="sidebar-bottom mt-auto d-flex flex-wrap justify-content-center align-items-center">
|
55
55
|
|
56
|
+
{% unless site.theme_mode %}
|
57
|
+
<button class="mode-toggle btn" aria-label="Switch Mode">
|
58
|
+
<i class="fas fa-adjust"></i>
|
59
|
+
</button>
|
60
|
+
|
61
|
+
{% if site.data.contact.size > 0 %}
|
62
|
+
<span class="icon-border"></span>
|
63
|
+
{% endif %}
|
64
|
+
{% endunless %}
|
65
|
+
|
56
66
|
{% for entry in site.data.contact %}
|
57
67
|
{% capture url %}
|
58
68
|
{%- if entry.type == 'github' -%}
|
@@ -71,7 +81,6 @@
|
|
71
81
|
|
72
82
|
{% if url %}
|
73
83
|
<a href="{{ url }}" aria-label="{{ entry.type }}"
|
74
|
-
{% unless site.theme_mode %}class="order-{{ forloop.index | plus: 2 }}"{% endunless %}
|
75
84
|
{% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
|
76
85
|
<i class="{{ entry.icon }}"></i>
|
77
86
|
</a>
|
@@ -79,16 +88,6 @@
|
|
79
88
|
|
80
89
|
{% endfor %}
|
81
90
|
|
82
|
-
{% unless site.theme_mode %}
|
83
|
-
{% if site.data.contact.size > 0 %}
|
84
|
-
<span class="icon-border order-2"></span>
|
85
|
-
{% endif %}
|
86
|
-
|
87
|
-
<span id="mode-toggle-wrapper" class="order-1">
|
88
|
-
{% include mode-toggle.html %}
|
89
|
-
</span>
|
90
|
-
{% endunless %}
|
91
|
-
|
92
91
|
</div> <!-- .sidebar-bottom -->
|
93
92
|
|
94
93
|
</div><!-- #sidebar -->
|
data/_includes/timeago.html
CHANGED
@@ -1,27 +1,15 @@
|
|
1
1
|
<!--
|
2
2
|
Date format snippet
|
3
|
-
See: /
|
3
|
+
See: ${JS_ROOT}/utils/timeago.js
|
4
4
|
-->
|
5
5
|
|
6
|
-
{%
|
7
|
-
{
|
8
|
-
{%
|
9
|
-
|
10
|
-
{%
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
{
|
15
|
-
|
16
|
-
data-placement="bottom"
|
17
|
-
title="{{ include.date | date: tooltip_df }}"
|
18
|
-
{% endif %}>
|
19
|
-
{%- assign this_year = site.time | date: "%Y" -%}
|
20
|
-
{%- assign post_year = include.date | date: "%Y" -%}
|
21
|
-
{%- if post_year == this_year -%}
|
22
|
-
{{ include.date | date: post_short_df }}
|
23
|
-
{%- else -%}
|
24
|
-
{{ include.date | date: post_long_df }}
|
25
|
-
{%- endif -%}
|
26
|
-
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
|
27
|
-
</span>
|
6
|
+
<em class="timeago{% if include.class %} {{ include.class }}{% endif %}"
|
7
|
+
data-ts="{{ include.date | date: '%s' }}"
|
8
|
+
{% if include.tooltip %}
|
9
|
+
data-toggle="tooltip" data-placement="bottom" data-tooltip-df="llll"
|
10
|
+
{% endif %}
|
11
|
+
{% if include.capitalize %}
|
12
|
+
data-capitalize="true"
|
13
|
+
{% endif %}>
|
14
|
+
{{ include.date | date: '%Y-%m-%d' }}
|
15
|
+
</em>
|
data/_includes/toc.html
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
{% assign enable_toc = false %}
|
2
|
+
{% if site.toc and page.toc %}
|
3
|
+
{% if page.content contains '<h2' or page.content contains '<h3' %}
|
4
|
+
{% assign enable_toc = true %}
|
5
|
+
{% endif %}
|
6
|
+
{% endif %}
|
7
|
+
|
8
|
+
{% if enable_toc %}
|
9
|
+
<!-- BS-toc.js will be loaded at medium priority -->
|
10
|
+
<script src="{{ site.data.assets[origin].bootstrap-toc.js }}"></script>
|
11
|
+
|
12
|
+
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
13
|
+
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[lang].panel.toc -}}</div>
|
14
|
+
<nav id="toc" data-toggle="toc"></nav>
|
15
|
+
</div>
|
16
|
+
{% endif %}
|