Han-theme 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/_includes/comments.html +5 -0
- data/_includes/custom.html +3 -0
- data/_includes/datetime.html +20 -0
- data/_includes/favicons.html +19 -0
- data/_includes/footer.html +36 -0
- data/_includes/head.html +107 -0
- data/_includes/js-selector.html +106 -0
- data/_includes/jsdelivr-combine.html +26 -0
- data/_includes/lang.html +10 -0
- data/_includes/language-alias.html +70 -0
- data/_includes/media-url.html +37 -0
- data/_includes/mermaid.html +62 -0
- data/_includes/metadata-hook.html +1 -0
- data/_includes/mode-toggle.html +116 -0
- data/_includes/no-linenos.html +10 -0
- data/_includes/notification.html +24 -0
- data/_includes/origin-type.html +13 -0
- data/_includes/post-description.html +16 -0
- data/_includes/post-nav.html +34 -0
- data/_includes/post-paginator.html +91 -0
- data/_includes/post-sharing.html +52 -0
- data/_includes/read-time.html +37 -0
- data/_includes/refactor-content.html +255 -0
- data/_includes/related-posts.html +94 -0
- data/_includes/search-loader.html +47 -0
- data/_includes/search-results.html +10 -0
- data/_includes/sidebar.html +102 -0
- data/_includes/toc.html +13 -0
- data/_includes/topbar.html +77 -0
- data/_includes/trending-tags.html +46 -0
- data/_includes/update-list.html +40 -0
- data/_layouts/archives.html +35 -0
- data/_layouts/categories.html +138 -0
- data/_layouts/category.html +24 -0
- data/_layouts/compress.html +10 -0
- data/_layouts/default.html +76 -0
- data/_layouts/home.html +115 -0
- data/_layouts/page.html +20 -0
- data/_layouts/portfolio.html +82 -0
- data/_layouts/post.html +152 -0
- data/_layouts/tag.html +23 -0
- data/_layouts/tags.html +22 -0
- data/assets/404.html +14 -0
- data/assets/feed.xml +54 -0
- data/assets/robots.txt +10 -0
- metadata +282 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f3d220aac0f7d5f66c47126d0c7fda4c8fb7313adc83b50838a821f77d900ab6
|
4
|
+
data.tar.gz: 3a4d00559811d5fde4eb66eca255b8fd067a62ff998784878dde9dbe5552de65
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c5e85aceb41a58e7494b7274fb54e2f7efa528b56e00b5b1044819a02ae4a7a44d7677d0738579d94cba4c6d38a13a03f4dea13cc061ace91d3b3a87becf3fcb
|
7
|
+
data.tar.gz: b6ff7539ea7c213cf0cefeab2db0d5f5fe8befdc078bd2d4ace01135125024d24d7aa5993f212174c00f75f745a3c962964f929fc88be6515d057c7e3dba85f7
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!--
|
2
|
+
Date format snippet
|
3
|
+
See: ${JS_ROOT}/utils/locale-dateime.js
|
4
|
+
-->
|
5
|
+
|
6
|
+
{% assign df_strftime = site.data.locales[include.lang].df.post.strftime | default: '%d/%m/%Y' %}
|
7
|
+
{% assign df_dayjs = site.data.locales[include.lang].df.post.dayjs | default: 'DD/MM/YYYY' %}
|
8
|
+
|
9
|
+
<time
|
10
|
+
{% if include.class %}
|
11
|
+
class="{{ include.class }}"
|
12
|
+
{% endif %}
|
13
|
+
data-ts="{{ include.date | date: '%s' }}"
|
14
|
+
data-df="{{ df_dayjs }}"
|
15
|
+
{% if include.tooltip %}
|
16
|
+
data-bs-toggle="tooltip" data-bs-placement="bottom"
|
17
|
+
{% endif %}
|
18
|
+
>
|
19
|
+
{{ include.date | date: df_strftime }}
|
20
|
+
</time>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!--
|
2
|
+
The Favicons for Web, Android, Microsoft, and iOS (iPhone and iPad) Apps
|
3
|
+
Generated by: https://realfavicongenerator.net/
|
4
|
+
-->
|
5
|
+
|
6
|
+
{% capture favicon_path %}{{ '/assets/img/favicons' | relative_url }}{% endcapture %}
|
7
|
+
|
8
|
+
<link rel="apple-touch-icon" sizes="180x180" href="{{ favicon_path }}/apple-touch-icon.png">
|
9
|
+
<link rel="icon" type="image/png" sizes="32x32" href="{{ favicon_path }}/favicon-32x32.png">
|
10
|
+
<link rel="icon" type="image/png" sizes="16x16" href="{{ favicon_path }}/favicon-16x16.png">
|
11
|
+
{% if site.pwa.enabled %}
|
12
|
+
<link rel="manifest" href="{{ favicon_path }}/site.webmanifest">
|
13
|
+
{% endif %}
|
14
|
+
<link rel="shortcut icon" href="{{ favicon_path }}/favicon.ico">
|
15
|
+
<meta name="apple-mobile-web-app-title" content="{{ site.title }}">
|
16
|
+
<meta name="application-name" content="{{ site.title }}">
|
17
|
+
<meta name="msapplication-TileColor" content="#da532c">
|
18
|
+
<meta name="msapplication-config" content="{{ favicon_path }}/browserconfig.xml">
|
19
|
+
<meta name="theme-color" content="#ffffff">
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<!-- The Footer -->
|
2
|
+
|
3
|
+
<footer
|
4
|
+
aria-label="Site Info"
|
5
|
+
class="
|
6
|
+
d-flex flex-column justify-content-center text-muted
|
7
|
+
flex-lg-row justify-content-lg-between align-items-lg-center pb-lg-3
|
8
|
+
"
|
9
|
+
>
|
10
|
+
<p>
|
11
|
+
{{- '©' }}
|
12
|
+
<time>{{ 'now' | date: '%Y' }}</time>
|
13
|
+
|
14
|
+
{% if site.social.links %}
|
15
|
+
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
|
16
|
+
{% else %}
|
17
|
+
<em class="fst-normal">{{ site.social.name }}</em>.
|
18
|
+
{% endif %}
|
19
|
+
|
20
|
+
{% if site.data.locales[include.lang].copyright.brief %}
|
21
|
+
<span
|
22
|
+
data-bs-toggle="tooltip"
|
23
|
+
data-bs-placement="top"
|
24
|
+
title="{{ site.data.locales[include.lang].copyright.verbose }}"
|
25
|
+
>
|
26
|
+
{{- site.data.locales[include.lang].copyright.brief -}}
|
27
|
+
</span>
|
28
|
+
{% endif %}
|
29
|
+
</p>
|
30
|
+
|
31
|
+
<p>
|
32
|
+
{%- capture _platform -%}
|
33
|
+
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
|
34
|
+
{%- endcapture -%}
|
35
|
+
</p>
|
36
|
+
</footer>
|
data/_includes/head.html
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
<head>
|
2
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
3
|
+
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
|
4
|
+
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1b1b1e">
|
5
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
6
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
7
|
+
<meta
|
8
|
+
name="viewport"
|
9
|
+
content="width=device-width, user-scalable=no initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
|
10
|
+
>
|
11
|
+
|
12
|
+
{%- capture seo_tags -%}
|
13
|
+
{% seo title=false %}
|
14
|
+
{%- endcapture -%}
|
15
|
+
|
16
|
+
<!-- Setup Open Graph image -->
|
17
|
+
|
18
|
+
{% if page.image %}
|
19
|
+
{% assign src = page.image.path | default: page.image %}
|
20
|
+
|
21
|
+
{% unless src contains '://' %}
|
22
|
+
{%- capture img_url -%}
|
23
|
+
{% include media-url.html src=src subpath=page.media_subpath absolute=true %}
|
24
|
+
{%- endcapture -%}
|
25
|
+
|
26
|
+
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
|
27
|
+
{%- capture new_url -%}{{ img_url }}{%- endcapture -%}
|
28
|
+
|
29
|
+
{% assign seo_tags = seo_tags | replace: old_url, new_url %}
|
30
|
+
{% endunless %}
|
31
|
+
|
32
|
+
{% elsif site.social_preview_image %}
|
33
|
+
{%- capture img_url -%}
|
34
|
+
{% include media-url.html src=site.social_preview_image absolute=true %}
|
35
|
+
{%- endcapture -%}
|
36
|
+
|
37
|
+
{%- capture og_image -%}
|
38
|
+
<meta property="og:image" content="{{ img_url }}" />
|
39
|
+
{%- endcapture -%}
|
40
|
+
|
41
|
+
{%- capture twitter_image -%}
|
42
|
+
<meta name="twitter:card" content="summary_large_image" />
|
43
|
+
<meta property="twitter:image" content="{{ img_url }}" />
|
44
|
+
{%- endcapture -%}
|
45
|
+
|
46
|
+
{% assign old_meta_clip = '<meta name="twitter:card" content="summary" />' %}
|
47
|
+
{% assign new_meta_clip = og_image | append: twitter_image %}
|
48
|
+
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
|
49
|
+
{% endif %}
|
50
|
+
|
51
|
+
{{ seo_tags }}
|
52
|
+
|
53
|
+
<title>
|
54
|
+
{%- unless page.layout == 'home' -%}
|
55
|
+
{{ page.title | append: ' | ' }}
|
56
|
+
{%- endunless -%}
|
57
|
+
{{ site.title }}
|
58
|
+
</title>
|
59
|
+
|
60
|
+
{% include_cached favicons.html %}
|
61
|
+
|
62
|
+
<!-- Resource Hints -->
|
63
|
+
{% unless site.assets.self_host.enabled %}
|
64
|
+
{% for hint in site.data.origin.cors.resource_hints %}
|
65
|
+
{% for link in hint.links %}
|
66
|
+
<link rel="{{ link.rel }}" href="{{ hint.url }}" {{ link.opts | join: ' ' }}>
|
67
|
+
{% endfor %}
|
68
|
+
{% endfor %}
|
69
|
+
{% endunless %}
|
70
|
+
|
71
|
+
<!-- Bootstrap -->
|
72
|
+
{% unless jekyll.environment == 'production' %}
|
73
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
74
|
+
{% endunless %}
|
75
|
+
|
76
|
+
<!-- Theme style -->
|
77
|
+
<link rel="stylesheet" href="{{ '/assets/css/:THEME.css' | replace: ':THEME', site.theme | relative_url }}">
|
78
|
+
|
79
|
+
<!-- Web Font -->
|
80
|
+
<link rel="stylesheet" href="{{ site.data.origin[type].webfonts | relative_url }}">
|
81
|
+
|
82
|
+
<!-- Font Awesome Icons -->
|
83
|
+
<link rel="stylesheet" href="{{ site.data.origin[type].fontawesome.css | relative_url }}">
|
84
|
+
|
85
|
+
<!-- 3rd-party Dependencies -->
|
86
|
+
|
87
|
+
{% if site.toc and page.toc %}
|
88
|
+
<link rel="stylesheet" href="{{ site.data.origin[type].toc.css | relative_url }}">
|
89
|
+
{% endif %}
|
90
|
+
|
91
|
+
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
|
92
|
+
<link rel="stylesheet" href="{{ site.data.origin[type]['lazy-polyfill'].css | relative_url }}">
|
93
|
+
{% endif %}
|
94
|
+
|
95
|
+
{% if page.layout == 'page' or page.layout == 'post' %}
|
96
|
+
<!-- Image Popup -->
|
97
|
+
<link rel="stylesheet" href="{{ site.data.origin[type].glightbox.css | relative_url }}">
|
98
|
+
{% endif %}
|
99
|
+
|
100
|
+
<!-- JavaScript -->
|
101
|
+
|
102
|
+
{% unless site.theme_mode %}
|
103
|
+
{% include mode-toggle.html %}
|
104
|
+
{% endunless %}
|
105
|
+
|
106
|
+
{% include metadata-hook.html %}
|
107
|
+
</head>
|
@@ -0,0 +1,106 @@
|
|
1
|
+
<!-- JS selector for site. -->
|
2
|
+
|
3
|
+
<!-- commons -->
|
4
|
+
|
5
|
+
{% assign urls = site.data.origin[type].search.js %}
|
6
|
+
|
7
|
+
<!-- layout specified -->
|
8
|
+
|
9
|
+
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
|
10
|
+
{% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %}
|
11
|
+
|
12
|
+
{% unless page.layout == 'home' %}
|
13
|
+
<!-- image lazy-loading & popup & clipboard -->
|
14
|
+
{% assign urls = urls
|
15
|
+
| append: ','
|
16
|
+
| append: site.data.origin[type].glightbox.js
|
17
|
+
| append: ','
|
18
|
+
| append: site.data.origin[type].clipboard.js
|
19
|
+
%}
|
20
|
+
{% endunless %}
|
21
|
+
{% endif %}
|
22
|
+
|
23
|
+
{% if page.layout == 'home'
|
24
|
+
or page.layout == 'post'
|
25
|
+
or page.layout == 'archives'
|
26
|
+
or page.layout == 'category'
|
27
|
+
or page.layout == 'tag'
|
28
|
+
%}
|
29
|
+
{% assign locale = include.lang | split: '-' | first %}
|
30
|
+
|
31
|
+
{% assign urls = urls
|
32
|
+
| append: ','
|
33
|
+
| append: site.data.origin[type].dayjs.js.common
|
34
|
+
| append: ','
|
35
|
+
| append: site.data.origin[type].dayjs.js.locale
|
36
|
+
| replace: ':LOCALE', locale
|
37
|
+
| append: ','
|
38
|
+
| append: site.data.origin[type].dayjs.js.relativeTime
|
39
|
+
| append: ','
|
40
|
+
| append: site.data.origin[type].dayjs.js.localizedFormat
|
41
|
+
%}
|
42
|
+
{% endif %}
|
43
|
+
|
44
|
+
{% if page.content contains '<h2' or page.content contains '<h3' and site.toc and page.toc %}
|
45
|
+
{% assign urls = urls | append: ',' | append: site.data.origin[type].toc.js %}
|
46
|
+
{% endif %}
|
47
|
+
|
48
|
+
{% if page.mermaid %}
|
49
|
+
{% assign urls = urls | append: ',' | append: site.data.origin[type].mermaid.js %}
|
50
|
+
{% endif %}
|
51
|
+
|
52
|
+
{% include jsdelivr-combine.html urls=urls %}
|
53
|
+
|
54
|
+
{% case page.layout %}
|
55
|
+
{% when 'home', 'categories', 'post', 'page' %}
|
56
|
+
{% assign js = page.layout %}
|
57
|
+
{% when 'archives', 'category', 'tag' %}
|
58
|
+
{% assign js = 'misc' %}
|
59
|
+
{% else %}
|
60
|
+
{% assign js = 'commons' %}
|
61
|
+
{% endcase %}
|
62
|
+
|
63
|
+
{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}
|
64
|
+
|
65
|
+
<script src="{{ script | relative_url }}"></script>
|
66
|
+
|
67
|
+
{% if page.math %}
|
68
|
+
<!-- MathJax -->
|
69
|
+
<script src="{{ '/assets/js/data/mathjax.js' | relative_url }}"></script>
|
70
|
+
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
|
71
|
+
<script id="MathJax-script" async src="{{ site.data.origin[type].mathjax.js | relative_url }}"></script>
|
72
|
+
{% endif %}
|
73
|
+
|
74
|
+
<!-- Pageviews -->
|
75
|
+
{% if page.layout == 'post' %}
|
76
|
+
{% assign provider = site.pageviews.provider %}
|
77
|
+
|
78
|
+
{% if provider and provider != empty %}
|
79
|
+
{% case provider %}
|
80
|
+
{% when 'goatcounter' %}
|
81
|
+
{% if site.analytics[provider].id != empty and site.analytics[provider].id %}
|
82
|
+
{% include pageviews/{{ provider }}.html %}
|
83
|
+
{% endif %}
|
84
|
+
{% endcase %}
|
85
|
+
{% endif %}
|
86
|
+
{% endif %}
|
87
|
+
|
88
|
+
{% if page.mermaid %}
|
89
|
+
{% include mermaid.html %}
|
90
|
+
{% endif %}
|
91
|
+
|
92
|
+
{% if jekyll.environment == 'production' %}
|
93
|
+
<!-- PWA -->
|
94
|
+
{% if site.pwa.enabled %}
|
95
|
+
<script defer src="{{ 'app.min.js' | relative_url }}"></script>
|
96
|
+
{% endif %}
|
97
|
+
|
98
|
+
<!-- Web Analytics -->
|
99
|
+
{% for analytics in site.analytics %}
|
100
|
+
{% capture str %}{{ analytics }}{% endcapture %}
|
101
|
+
{% assign type = str | split: '{' | first %}
|
102
|
+
{% if site.analytics[type].id and site.analytics[type].id != empty %}
|
103
|
+
{% include analytics/{{ type }}.html %}
|
104
|
+
{% endif %}
|
105
|
+
{% endfor %}
|
106
|
+
{% endif %}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{% assign urls = include.urls | split: ',' %}
|
2
|
+
|
3
|
+
{% assign combined_urls = nil %}
|
4
|
+
|
5
|
+
{% assign domain = 'https://cdn.jsdelivr.net/' %}
|
6
|
+
|
7
|
+
{% for url in urls %}
|
8
|
+
{% if url contains domain %}
|
9
|
+
{% assign url_snippet = url | slice: domain.size, url.size %}
|
10
|
+
|
11
|
+
{% if combined_urls %}
|
12
|
+
{% assign combined_urls = combined_urls | append: ',' | append: url_snippet %}
|
13
|
+
{% else %}
|
14
|
+
{% assign combined_urls = domain | append: 'combine/' | append: url_snippet %}
|
15
|
+
{% endif %}
|
16
|
+
|
17
|
+
{% elsif url contains '//' %}
|
18
|
+
<script src="{{ url }}"></script>
|
19
|
+
{% else %}
|
20
|
+
<script src="{{ url | relative_url }}"></script>
|
21
|
+
{% endif %}
|
22
|
+
{% endfor %}
|
23
|
+
|
24
|
+
{% if combined_urls %}
|
25
|
+
<script src="{{ combined_urls }}"></script>
|
26
|
+
{% endif %}
|
data/_includes/lang.html
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
{% comment %}
|
2
|
+
Detect appearance language and return it through variable "lang"
|
3
|
+
{% endcomment %}
|
4
|
+
{% if site.data.locales[page.lang] %}
|
5
|
+
{% assign lang = page.lang %}
|
6
|
+
{% elsif site.data.locales[site.lang] %}
|
7
|
+
{% assign lang = site.lang %}
|
8
|
+
{% else %}
|
9
|
+
{% assign lang = 'en' %}
|
10
|
+
{% endif %}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
{% comment %}
|
2
|
+
|
3
|
+
Convert the alias of the syntax language to the official name
|
4
|
+
|
5
|
+
See: <https://github.com/rouge-ruby/rouge/wiki/List-of-supported-languages-and-lexers>
|
6
|
+
|
7
|
+
{% endcomment %}
|
8
|
+
|
9
|
+
{% assign _lang = include.language | default: '' %}
|
10
|
+
|
11
|
+
{% case _lang %}
|
12
|
+
{% when 'actionscript', 'as', 'as3' %}
|
13
|
+
{{ 'ActionScript' }}
|
14
|
+
{% when 'applescript' %}
|
15
|
+
{{ 'AppleScript' }}
|
16
|
+
{% when 'brightscript', 'bs', 'brs' %}
|
17
|
+
{{ 'BrightScript' }}
|
18
|
+
{% when 'cfscript', 'cfc' %}
|
19
|
+
{{ 'CFScript' }}
|
20
|
+
{% when 'coffeescript', 'coffee', 'coffee-script' %}
|
21
|
+
{{ 'CoffeeScript' }}
|
22
|
+
{% when 'cs', 'csharp' %}
|
23
|
+
{{ 'C#' }}
|
24
|
+
{% when 'erl' %}
|
25
|
+
{{ 'Erlang' }}
|
26
|
+
{% when 'graphql' %}
|
27
|
+
{{ 'GraphQL' }}
|
28
|
+
{% when 'haskell', 'hs' %}
|
29
|
+
{{ 'Haskell' }}
|
30
|
+
{% when 'javascript', 'js' %}
|
31
|
+
{{ 'JavaScript' }}
|
32
|
+
{% when 'make', 'mf', 'gnumake', 'bsdmake' %}
|
33
|
+
{{ 'Makefile' }}
|
34
|
+
{% when 'md', 'mkd' %}
|
35
|
+
{{ 'Markdown' }}
|
36
|
+
{% when 'm' %}
|
37
|
+
{{ 'Matlab' }}
|
38
|
+
{% when 'objective_c', 'objc', 'obj-c', 'obj_c', 'objectivec' %}
|
39
|
+
{{ 'Objective-C' }}
|
40
|
+
{% when 'perl', 'pl' %}
|
41
|
+
{{ 'Perl' }}
|
42
|
+
{% when 'php','php3','php4','php5' %}
|
43
|
+
{{ 'PHP' }}
|
44
|
+
{% when 'py' %}
|
45
|
+
{{ 'Python' }}
|
46
|
+
{% when 'rb' %}
|
47
|
+
{{ 'Ruby' }}
|
48
|
+
{% when 'rs','no_run','ignore','should_panic' %}
|
49
|
+
{{ 'Rust' }}
|
50
|
+
{% when 'bash', 'zsh', 'ksh', 'sh' %}
|
51
|
+
{{ 'Shell' }}
|
52
|
+
{% when 'st', 'squeak' %}
|
53
|
+
{{ 'Smalltalk' }}
|
54
|
+
{% when 'tex'%}
|
55
|
+
{{ 'TeX' }}
|
56
|
+
{% when 'latex' %}
|
57
|
+
{{ 'LaTex' }}
|
58
|
+
{% when 'ts', 'typescript' %}
|
59
|
+
{{ 'TypeScript' }}
|
60
|
+
{% when 'vb', 'visualbasic' %}
|
61
|
+
{{ 'Visual Basic' }}
|
62
|
+
{% when 'vue', 'vuejs' %}
|
63
|
+
{{ 'Vue.js' }}
|
64
|
+
{% when 'yml' %}
|
65
|
+
{{ 'YAML' }}
|
66
|
+
{% when 'css', 'html', 'scss', 'ssh', 'toml', 'xml', 'yaml', 'json' %}
|
67
|
+
{{ _lang | upcase }}
|
68
|
+
{% else %}
|
69
|
+
{{ _lang | capitalize }}
|
70
|
+
{% endcase %}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
{%- comment -%}
|
2
|
+
Generate media resource final URL based on `site.cdn`, `page.media_subpath`
|
3
|
+
|
4
|
+
Arguments:
|
5
|
+
src - required, basic media resources path
|
6
|
+
subpath - optional, relative path of media resources
|
7
|
+
absolute - optional, boolean, if true, generate absolute URL
|
8
|
+
|
9
|
+
Return:
|
10
|
+
media resources URL
|
11
|
+
{%- endcomment -%}
|
12
|
+
|
13
|
+
{% assign url = include.src %}
|
14
|
+
|
15
|
+
{%- if url -%}
|
16
|
+
{% unless url contains ':' %}
|
17
|
+
{%- comment -%} Add media resources subpath prefix {%- endcomment -%}
|
18
|
+
{% assign url = include.subpath | default: '' | append: '/' | append: url %}
|
19
|
+
|
20
|
+
{%- comment -%} Prepend CND URL {%- endcomment -%}
|
21
|
+
{% if site.cdn %}
|
22
|
+
{% assign url = site.cdn | append: '/' | append: url %}
|
23
|
+
{% endif %}
|
24
|
+
|
25
|
+
{% assign url = url | replace: '///', '/' | replace: '//', '/' | replace: ':/', '://' %}
|
26
|
+
|
27
|
+
{% unless url contains '://' %}
|
28
|
+
{% if include.absolute %}
|
29
|
+
{% assign url = site.url | append: site.baseurl | append: url %}
|
30
|
+
{% else %}
|
31
|
+
{% assign url = site.baseurl | append: url %}
|
32
|
+
{% endif %}
|
33
|
+
{% endunless %}
|
34
|
+
{% endunless %}
|
35
|
+
{%- endif -%}
|
36
|
+
|
37
|
+
{{- url -}}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<!-- mermaid-js loader -->
|
2
|
+
<script type="text/javascript">
|
3
|
+
function updateMermaid(event) {
|
4
|
+
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
|
5
|
+
const mode = event.data.message;
|
6
|
+
|
7
|
+
if (typeof mermaid === 'undefined') {
|
8
|
+
return;
|
9
|
+
}
|
10
|
+
|
11
|
+
let expectedTheme = mode === ModeToggle.DARK_MODE ? 'dark' : 'default';
|
12
|
+
let config = { theme: expectedTheme };
|
13
|
+
|
14
|
+
{%- comment -%}
|
15
|
+
Re-render the SVG › <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344>
|
16
|
+
{%- endcomment -%}
|
17
|
+
const mermaidList = document.getElementsByClassName('mermaid');
|
18
|
+
|
19
|
+
[...mermaidList].forEach((elem) => {
|
20
|
+
const svgCode = elem.previousSibling.children.item(0).innerHTML;
|
21
|
+
elem.innerHTML = svgCode;
|
22
|
+
elem.removeAttribute('data-processed');
|
23
|
+
});
|
24
|
+
|
25
|
+
mermaid.initialize(config);
|
26
|
+
mermaid.init(undefined, '.mermaid');
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
(function () {
|
31
|
+
let initTheme = 'default';
|
32
|
+
const html = document.documentElement;
|
33
|
+
|
34
|
+
if (
|
35
|
+
(html.hasAttribute('data-mode') && html.getAttribute('data-mode') === 'dark') ||
|
36
|
+
(!html.hasAttribute('data-mode') && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
37
|
+
) {
|
38
|
+
initTheme = 'dark';
|
39
|
+
}
|
40
|
+
|
41
|
+
let mermaidConf = {
|
42
|
+
theme: initTheme {%- comment -%} <default | dark | forest | neutral> {%- endcomment -%}
|
43
|
+
};
|
44
|
+
|
45
|
+
{%- comment -%} Create mermaid tag {%- endcomment -%}
|
46
|
+
const basicList = document.getElementsByClassName('language-mermaid');
|
47
|
+
[...basicList].forEach((elem) => {
|
48
|
+
const svgCode = elem.textContent;
|
49
|
+
const backup = elem.parentElement;
|
50
|
+
backup.classList.add('d-none');
|
51
|
+
{%- comment -%} create mermaid node {%- endcomment -%}
|
52
|
+
let mermaid = document.createElement('pre');
|
53
|
+
mermaid.classList.add('mermaid');
|
54
|
+
const text = document.createTextNode(svgCode);
|
55
|
+
mermaid.appendChild(text);
|
56
|
+
backup.after(mermaid);
|
57
|
+
});
|
58
|
+
|
59
|
+
mermaid.initialize(mermaidConf);
|
60
|
+
window.addEventListener('message', updateMermaid);
|
61
|
+
})();
|
62
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
<!-- A placeholder to allow defining custom metadata -->
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<!-- Switch the mode between dark and light. -->
|
2
|
+
|
3
|
+
<script type="text/javascript">
|
4
|
+
class ModeToggle {
|
5
|
+
static get MODE_KEY() {
|
6
|
+
return 'mode';
|
7
|
+
}
|
8
|
+
static get MODE_ATTR() {
|
9
|
+
return 'data-mode';
|
10
|
+
}
|
11
|
+
static get DARK_MODE() {
|
12
|
+
return 'dark';
|
13
|
+
}
|
14
|
+
static get LIGHT_MODE() {
|
15
|
+
return 'light';
|
16
|
+
}
|
17
|
+
static get ID() {
|
18
|
+
return 'mode-toggle';
|
19
|
+
}
|
20
|
+
|
21
|
+
constructor() {
|
22
|
+
let self = this;
|
23
|
+
|
24
|
+
{%- comment -%} always follow the system prefers {%- endcomment -%}
|
25
|
+
this.sysDarkPrefers.addEventListener('change', () => {
|
26
|
+
if (self.hasMode) {
|
27
|
+
self.clearMode();
|
28
|
+
}
|
29
|
+
self.notify();
|
30
|
+
});
|
31
|
+
|
32
|
+
if (!this.hasMode) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
|
36
|
+
if (this.isDarkMode) {
|
37
|
+
this.setDark();
|
38
|
+
} else {
|
39
|
+
this.setLight();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
get sysDarkPrefers() {
|
44
|
+
return window.matchMedia('(prefers-color-scheme: dark)');
|
45
|
+
}
|
46
|
+
|
47
|
+
get isPreferDark() {
|
48
|
+
return this.sysDarkPrefers.matches;
|
49
|
+
}
|
50
|
+
|
51
|
+
get isDarkMode() {
|
52
|
+
return this.mode === ModeToggle.DARK_MODE;
|
53
|
+
}
|
54
|
+
|
55
|
+
get hasMode() {
|
56
|
+
return this.mode != null;
|
57
|
+
}
|
58
|
+
|
59
|
+
get mode() {
|
60
|
+
return sessionStorage.getItem(ModeToggle.MODE_KEY);
|
61
|
+
}
|
62
|
+
|
63
|
+
{%- comment -%} get the current mode on screen {%- endcomment -%}
|
64
|
+
get modeStatus() {
|
65
|
+
if (this.hasMode) {
|
66
|
+
return this.mode;
|
67
|
+
} else {
|
68
|
+
return this.isPreferDark ? ModeToggle.DARK_MODE : ModeToggle.LIGHT_MODE;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
setDark() {
|
73
|
+
document.documentElement.setAttribute(ModeToggle.MODE_ATTR, ModeToggle.DARK_MODE);
|
74
|
+
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
|
75
|
+
}
|
76
|
+
|
77
|
+
setLight() {
|
78
|
+
document.documentElement.setAttribute(ModeToggle.MODE_ATTR, ModeToggle.LIGHT_MODE);
|
79
|
+
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
|
80
|
+
}
|
81
|
+
|
82
|
+
clearMode() {
|
83
|
+
document.documentElement.removeAttribute(ModeToggle.MODE_ATTR);
|
84
|
+
sessionStorage.removeItem(ModeToggle.MODE_KEY);
|
85
|
+
}
|
86
|
+
|
87
|
+
{%- comment -%}
|
88
|
+
Notify another plugins that the theme mode has changed
|
89
|
+
{%- endcomment -%}
|
90
|
+
notify() {
|
91
|
+
window.postMessage(
|
92
|
+
{
|
93
|
+
direction: ModeToggle.ID,
|
94
|
+
message: this.modeStatus
|
95
|
+
},
|
96
|
+
'*'
|
97
|
+
);
|
98
|
+
}
|
99
|
+
|
100
|
+
flipMode() {
|
101
|
+
if (this.hasMode) {
|
102
|
+
this.clearMode();
|
103
|
+
} else {
|
104
|
+
if (this.isPreferDark) {
|
105
|
+
this.setLight();
|
106
|
+
} else {
|
107
|
+
this.setDark();
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
this.notify();
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
const modeToggle = new ModeToggle();
|
116
|
+
</script>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{% comment %}
|
2
|
+
Remove the line number of the code snippet.
|
3
|
+
{% endcomment %}
|
4
|
+
|
5
|
+
{% assign content = include.content %}
|
6
|
+
|
7
|
+
{% if content contains '<td class="rouge-gutter gl"><pre class="lineno">' %}
|
8
|
+
{% assign content = content | replace: '<td class="rouge-gutter gl"><pre class="lineno">', '<!-- <td class="rouge-gutter gl"><pre class="lineno">'%}
|
9
|
+
{% assign content = content | replace: '</td><td class="rouge-code">', '</td> --><td class="rouge-code">' %}
|
10
|
+
{% endif %}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<aside
|
2
|
+
id="notification"
|
3
|
+
class="toast"
|
4
|
+
role="alert"
|
5
|
+
aria-live="assertive"
|
6
|
+
aria-atomic="true"
|
7
|
+
data-bs-animation="true"
|
8
|
+
data-bs-autohide="false"
|
9
|
+
>
|
10
|
+
<div class="toast-header">
|
11
|
+
<button
|
12
|
+
type="button"
|
13
|
+
class="btn-close ms-auto"
|
14
|
+
data-bs-dismiss="toast"
|
15
|
+
aria-label="Close"
|
16
|
+
></button>
|
17
|
+
</div>
|
18
|
+
<div class="toast-body text-center pt-0">
|
19
|
+
<p class="px-2 mb-3">{{ site.data.locales[include.lang].notification.update_found }}</p>
|
20
|
+
<button type="button" class="btn btn-primary" aria-label="Update">
|
21
|
+
{{ site.data.locales[include.lang].notification.update }}
|
22
|
+
</button>
|
23
|
+
</div>
|
24
|
+
</aside>
|