Skip to content

Commit 63acf59

Browse files
committed
2 parents f106ce0 + ed4d304 commit 63acf59

29 files changed

+283
-186
lines changed

.github/codeql/codeql-config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
paths-ignore:
2+
- "assets/js"

.github/dependabot.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ updates:
77
bundler:
88
dependency-type: "production"
99
schedule:
10-
interval: "monthly"
10+
interval: "weekly"
1111
- package-ecosystem: "npm"
1212
directory: "/"
1313
versioning-strategy: increase
1414
groups:
1515
npm:
1616
dependency-type: "development"
1717
schedule:
18-
interval: "monthly"
18+
interval: "weekly"
1919
- package-ecosystem: "github-actions"
2020
directory: "/"
2121
groups:
2222
gh-actions:
2323
update-types:
2424
- "major"
2525
schedule:
26-
interval: "monthly"
26+
interval: "weekly"

.github/workflows/codeql.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ name: "CodeQL"
22

33
on:
44
push:
5-
paths: ["**.js"]
5+
paths: ["_javascript/**/*.js"]
66
pull_request:
7-
paths: ["**.js"]
8-
schedule:
9-
- cron: "0 0 * * 5"
7+
paths: ["_javascript/**/*.js"]
108

119
jobs:
1210
analyze:
@@ -32,6 +30,7 @@ jobs:
3230
uses: github/codeql-action/init@v3
3331
with:
3432
languages: "${{ matrix.language }}"
33+
config-file: .github/codeql/codeql-config.yml
3534

3635
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
3736
# If this step fails, then you should remove it and run the build manually (see below)

.github/workflows/stale.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
steps:
2323
- uses: actions/stale@v9
2424
with:
25-
days-before-stale: 30
26-
days-before-close: 1
25+
# 60 days before marking issues/PRs stale
26+
days-before-close: -1 # does not close automatically
2727
stale-issue-label: ${{ env.STALE_LABEL }}
2828
exempt-issue-labels: ${{ env.EXEMPT_LABELS }}
2929
stale-issue-message: ${{ env.MESSAGE }}

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ package-lock.json
2626

2727
# IDE configurations
2828
.idea
29-
.vscode
3029

3130
# Misc
3231
assets/js/dist

.vscode/extensions.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"recommendations": [
3+
// Liquid tags auto-complete
4+
"killalau.vscode-liquid-snippets",
5+
// Liquid syntax highlighting and formatting
6+
"Shopify.theme-check-vscode",
7+
// Common formatter
8+
"esbenp.prettier-vscode",
9+
"foxundermoon.shell-format",
10+
"stylelint.vscode-stylelint"
11+
]
12+
}

.vscode/settings.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// Prettier
3+
"editor.defaultFormatter": "esbenp.prettier-vscode",
4+
"editor.formatOnSave": true,
5+
"prettier.trailingComma": "none",
6+
// Shopify Liquid
7+
"files.associations": {
8+
"*.html": "liquid"
9+
},
10+
// Formatter
11+
"[html][liquid]": {
12+
"editor.defaultFormatter": "Shopify.theme-check-vscode"
13+
},
14+
"[shellscript]": {
15+
"editor.defaultFormatter": "foxundermoon.shell-format"
16+
},
17+
// Disable vscode built-in stylelint
18+
"css.validate": false,
19+
"scss.validate": false,
20+
"less.validate": false,
21+
// Stylint extension settings
22+
"stylelint.snippet": ["css", "less", "postcss", "scss"],
23+
"stylelint.validate": ["css", "less", "postcss", "scss"]
24+
}

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
````
3232

3333
语言支持情况:
34-
| 已支持的语言 | `run="lang"` 参数 | 后端 |
35-
| :-: | :-: | :-: |
36-
| C++ | `run="cpp"` | [Coliru](https://coliru.stacked-crooked.com/) |
37-
| JavaScript | `run="javascript"` | N/A (本地) |
38-
| Python | `run="python"` | [Online Python](https://www.online-python.com/) |
39-
| Rust | `run="rust"` | [Rust Playground](https://play.rust-lang.org/) |
34+
| 已支持的语言 | `run="lang"` 参数 | 后端 |
35+
| :----------: | :----------------: | :---------------------------------------------: |
36+
| C++ | `run="cpp"` | [Coliru](https://coliru.stacked-crooked.com/) |
37+
| JavaScript | `run="javascript"` | N/A (本地) |
38+
| Python | `run="python"` | [Online Python](https://www.online-python.com/) |
39+
| Rust | `run="rust"` | [Rust Playground](https://play.rust-lang.org/) |
4040

4141
* (2022-11-29) 支持同名的多级 categories,如果你是从旧版本更新到当前版本,请在本地运行 `bundle update`。原版 Chirpy 使用 `jekyll-archives` 插件生成 categories,该插件将所有 categories 视为同等级别关系,这导致在 Chirpy 中无法使用相同名字的二级 categories,这个问题在本分支中得以修复,可以使用任何同名的多级 categories 了。注意:由于将 `jekyll-archives` 下载到本地 `.gems` 目录,并且将 `Gemfile` 指向本地路径,因此本地需要 `bundle update` 之后才能生效。
4242
* (2022-12-12) 添加了动画背景效果和鼠标点击效果,考虑到不是所有人都喜欢特效,默认情况下这两都是禁用的。如需开启,请在 `_config.yml` 中配置 `backgroud_animation` 和 `mouse_click_effect` 为 `true`。

_config.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ google_site_verification: # 填入你的认证字符串
5454
google_analytics:
5555
id: # 填入你的 Google Analytics ID
5656

57+
goatcounter:
58+
id: # 填入你的 Goatcounter ID
59+
5760
# 设置首选配色方案
5861
#
5962
# 提示: 保留空白会跟随系统的默认首选配色,并且在侧边栏的底部会出现
@@ -64,7 +67,7 @@ google_analytics:
6467
# light - 使用亮色方案
6568
# dark - 使用暗色方案
6669
#
67-
theme_mode: # [light|dark]
70+
theme_mode: # [light | dark]
6871

6972
# 启用动画背景特效
7073
backgroud_animation: false
@@ -140,7 +143,13 @@ assets:
140143
env: # [development|production]
141144

142145
pwa:
143-
enabled: true # PWA 特性选项
146+
enabled: true # PWA 特性选项(可安装)
147+
cache:
148+
enabled: true # PWA 离线缓存选项
149+
# 在此处定义不被 PWA 缓存的路径。
150+
# 通常其值是使用和当前网站相同域名的其他网站的 `baseurl`。
151+
deny_paths:
152+
# - "/example" # 符合 `<SITE_URL>/example/*` 的 URL 不会被 PWA 缓存
144153

145154
# 每一页的帖子数量
146155
paginate: 10
@@ -192,10 +201,6 @@ defaults:
192201
values:
193202
layout: page
194203
permalink: /:title/
195-
- scope:
196-
path: assets/img/favicons
197-
values:
198-
swcache: true
199204
- scope:
200205
path: assets/js/dist
201206
values:

_data/origin/cors.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ cdns:
88
- url: https://fonts.googleapis.com
99
# jsDelivr CDN
1010
- url: https://cdn.jsdelivr.net
11+
# polyfill.io for math
12+
- url: https://polyfill.io
1113

1214
# fonts
1315

@@ -33,7 +35,7 @@ search:
3335
js: https://cdn.jsdelivr.net/npm/[email protected]/dest/simple-jekyll-search.min.js
3436

3537
mermaid:
36-
js: https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js
38+
js: https://cdn.jsdelivr.net/npm/mermaid@10.8.0/dist/mermaid.min.js
3739

3840
dayjs:
3941
js:

_includes/favicons.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
<link rel="apple-touch-icon" sizes="180x180" href="{{ favicon_path }}/apple-touch-icon.png">
99
<link rel="icon" type="image/png" sizes="32x32" href="{{ favicon_path }}/favicon-32x32.png">
1010
<link rel="icon" type="image/png" sizes="16x16" href="{{ favicon_path }}/favicon-16x16.png">
11-
<link rel="manifest" href="{{ favicon_path }}/site.webmanifest">
11+
{% if site.pwa.enabled %}
12+
<link rel="manifest" href="{{ favicon_path }}/site.webmanifest">
13+
{% endif %}
1214
<link rel="shortcut icon" href="{{ favicon_path }}/favicon.ico">
1315
<meta name="apple-mobile-web-app-title" content="{{ site.title }}">
1416
<meta name="application-name" content="{{ site.title }}">

_includes/footer.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
"
99
>
1010
<p>
11-
{{ '©' }}
11+
{{- '©' }}
1212
<time>{{ 'now' | date: '%Y' }}</time>
13-
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
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+
1420
{% if site.data.locales[include.lang].copyright.brief %}
1521
<span
1622
data-bs-toggle="tooltip"

_includes/goatcounter.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- GoatCounter -->
2+
3+
<script
4+
data-goatcounter="https://{{ site.goatcounter.id }}.goatcounter.com/count"
5+
async
6+
src="https://gc.zgo.at/count.js"
7+
></script>
8+

_includes/head.html

+10-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
{% unless src contains '://' %}
2222
{%- capture img_url -%}
23-
{% include img-url.html src=src img_path=page.img_path %}
23+
{% include img-url.html src=src img_path=page.img_path absolute=true %}
2424
{%- endcapture -%}
2525

2626
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
@@ -31,15 +31,20 @@
3131

3232
{% elsif site.social_preview_image %}
3333
{%- capture img_url -%}
34-
{% include img-url.html src=site.social_preview_image %}
34+
{% include img-url.html src=site.social_preview_image absolute=true %}
3535
{%- endcapture -%}
3636

3737
{%- capture og_image -%}
3838
<meta property="og:image" content="{{ img_url }}" />
3939
{%- endcapture -%}
4040

41-
{% assign old_meta_clip = '<meta name="twitter:card"' %}
42-
{% assign new_meta_clip = og_image | append: old_meta_clip %}
41+
{%- capture twitter_image -%}
42+
<meta property="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 %}
4348
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
4449
{% endif %}
4550

@@ -76,7 +81,7 @@
7681
{% endif %}
7782

7883
<!-- Bootstrap -->
79-
<link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url}}">
84+
<link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url }}">
8085

8186
<!-- Font Awesome -->
8287
<link rel="stylesheet" href="{{ site.data.origin[type].fontawesome.css | relative_url }}">

_includes/img-url.html

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
Generate image final URL based on `site.img_cdn`, `page.img_path`
33

44
Arguments:
5-
src - basic image path, required
6-
img_path - relative path of image, optional
5+
src - required, basic image path
6+
img_path - optional, relative path of image
7+
absolute - optional, boolean, if true, generate absolute URL
78

89
Return:
910
image URL
@@ -14,7 +15,7 @@
1415
{%- if url -%}
1516
{% unless url contains ':' %}
1617
{%- comment -%} CND URL {%- endcomment -%}
17-
{% assign prefix = site.img_cdn | default: '' | relative_url %}
18+
{% assign prefix = site.img_cdn | default: '' %}
1819

1920
{%- comment -%} Add page image path prefix {%- endcomment -%}
2021
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
@@ -26,6 +27,12 @@
2627
| replace: '//', '/'
2728
| replace: ':', ':/'
2829
%}
30+
31+
{% if include.absolute %}
32+
{% assign url = url | absolute_url %}
33+
{% else %}
34+
{% assign url = url | relative_url %}
35+
{% endif %}
2936
{% endunless %}
3037
{%- endif -%}
3138

_includes/js-selector.html

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
<!-- layout specified -->
1313

14+
{% assign js_dist = '/assets/js/dist/' %}
15+
1416
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
1517
{% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %}
1618

@@ -65,7 +67,7 @@
6567
{% assign js = 'commons' %}
6668
{% endcase %}
6769

68-
{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}
70+
{% capture script %}{{ js_dist }}{{ js }}.min.js{% endcapture %}
6971
<script defer src="{{ script | relative_url }}"></script>
7072

7173
{% if page.math %}
@@ -83,7 +85,9 @@
8385
displayMath: [
8486
['$$', '$$'],
8587
['\\[', '\\]']
86-
]
88+
],
89+
/* equation numbering */
90+
tags: 'ams'
8791
}
8892
};
8993
</script>
@@ -94,13 +98,16 @@
9498
{% if jekyll.environment == 'production' %}
9599
<!-- PWA -->
96100
{% if site.pwa.enabled %}
97-
<script defer src="{{ '/app.js' | relative_url }}"></script>
98-
{% else %}
99-
<script defer src="{{ '/unregister.js' | relative_url }}"></script>
101+
<script defer src="{{ 'app.min.js' | prepend: js_dist | relative_url }}"></script>
100102
{% endif %}
101103

102104
<!-- GA -->
103105
{% if site.google_analytics.id != empty and site.google_analytics.id %}
104106
{% include google-analytics.html %}
105107
{% endif %}
108+
109+
<!-- GoatCounter -->
110+
{% if site.goatcounter.id != empty and site.goatcounter.id %}
111+
{% include goatcounter.html %}
112+
{% endif %}
106113
{% endif %}

_includes/topbar.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{% if forloop.first %}
1818
<span>
1919
<a href="{{ '/' | relative_url }}">
20-
{{ site.data.locales[include.lang].tabs.home | capitalize }}
20+
{{- site.data.locales[include.lang].tabs.home | capitalize -}}
2121
</a>
2222
</span>
2323

@@ -30,8 +30,8 @@
3030

3131
{% elsif page.layout == 'category' or page.layout == 'tag' %}
3232
<span>
33-
<a href="{{ item | relative_url }}">
34-
{{ site.data.locales[include.lang].tabs[item] | default: page.title | flatify }}
33+
<a href="{{ item | append: '/' | relative_url }}">
34+
{{- site.data.locales[include.lang].tabs[item] | default: page.title | flatify -}}
3535
</a>
3636
</span>
3737
{% endif %}

_javascript/modules/components/toc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export function toc() {
2-
if (document.querySelector('main h2')) {
2+
if (document.querySelector('main h2, main h3')) {
33
// see: https://github.com/tscanlin/tocbot#usage
44
tocbot.init({
55
tocSelector: '#toc',

_sass/addon/commons.scss

+8
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ footer {
156156
}
157157
}
158158

159+
em {
160+
@extend %text-highlight;
161+
}
162+
159163
p {
160164
text-align: center;
161165
margin-bottom: 0;
@@ -1749,3 +1753,7 @@ details {
17491753
}
17501754
}
17511755
}
1756+
1757+
.btn-link {
1758+
text-decoration: none;
1759+
}

0 commit comments

Comments
 (0)