From 9630fd647f89740d137d9a8d5aa559b44369c796 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 12 May 2024 07:35:58 +0800 Subject: [PATCH 001/177] ci(release): pass secrets to called workflow --- .github/workflows/cd.yml | 3 +++ .github/workflows/publish.yml | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 160750d6..d0cc84a3 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -35,3 +35,6 @@ jobs: publish: needs: release uses: ./.github/workflows/publish.yml + secrets: + GH_PAT: ${{ secrets.GH_PAT }} + BUILDER: ${{ secrets.BUILDER }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 20e46915..99114ea3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,11 @@ on: branches: - docs workflow_call: + secrets: + GH_PAT: + required: true + BUILDER: + required: true jobs: launch: From c4b58e350265362e1e78119bea9529fc0fcf20cc Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 17 May 2024 00:03:53 +0800 Subject: [PATCH 002/177] build: upgrade dependencies Updates `@fortawesome/fontawesome-free` to 6.5.2 - [Release notes](https://github.com/FortAwesome/Font-Awesome/releases) - [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/6.x/CHANGELOG.md) - [Commits](https://github.com/FortAwesome/Font-Awesome/compare/6.5.1...6.5.2) Updates `dayjs` to 1.11.11 - [Release notes](https://github.com/iamkun/dayjs/releases) - [Changelog](https://github.com/iamkun/dayjs/blob/dev/CHANGELOG.md) - [Commits](https://github.com/iamkun/dayjs/compare/v1.11.10...v1.11.11) Updates `mermaid` to 10.9.0 - [Release notes](https://github.com/mermaid-js/mermaid/releases) - [Changelog](https://github.com/mermaid-js/mermaid/blob/develop/CHANGELOG.md) - [Commits](https://github.com/mermaid-js/mermaid/compare/v10.8.0...v10.9.0) Updates `tocbot` to 4.27.20 - [Release notes](https://github.com/tscanlin/tocbot/releases) - [Changelog](https://github.com/tscanlin/tocbot/blob/master/CHANGELOG.md) - [Commits](https://github.com/tscanlin/tocbot/compare/v4.25.0...v4.27.20) --- _data/origin/cors.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index abedb6c6..18806665 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -20,24 +20,24 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour # Libraries toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.25.0/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.25.0/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.js fontawesome: - css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/css/all.min.css + css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css search: js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js mermaid: - js: https://cdn.jsdelivr.net/npm/mermaid@10.8.0/dist/mermaid.min.js + js: https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js dayjs: js: - common: https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js - locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.10/locale/:LOCALE.min.js - relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.10/plugin/relativeTime.min.js - localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.10/plugin/localizedFormat.min.js + common: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/dayjs.min.js + locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/locale/:LOCALE.min.js + relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/relativeTime.min.js + localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/localizedFormat.min.js glightbox: css: https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/css/glightbox.min.css From 5cdde7dbc5d2ae7dfba4fd53e2991d3acc2a073d Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 17 May 2024 20:11:08 +0800 Subject: [PATCH 003/177] ci: enable ci/style-lint for the `hotfix` branches --- .github/workflows/ci.yml | 1 + .github/workflows/style-lint.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 078e4f13..fa8d0c9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ on: push: branches: - "master" + - "hotfix/**" paths-ignore: - ".github/**" - "!.github/workflows/ci.yml" diff --git a/.github/workflows/style-lint.yml b/.github/workflows/style-lint.yml index 89eeaeff..a2cf4f69 100644 --- a/.github/workflows/style-lint.yml +++ b/.github/workflows/style-lint.yml @@ -2,7 +2,7 @@ name: "Style Lint" on: push: - branches: ["master"] + branches: ["master", "hotfix/**"] paths: ["_sass/**/*.scss"] pull_request: paths: ["_sass/**/*.scss"] From 00a27a1b85f665d0642b77babd54c6903fbdeb22 Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Sat, 18 May 2024 14:47:12 +0400 Subject: [PATCH 004/177] fix: audio/video path apply variable `media_subpath` (#1745) --- _includes/embed/audio.html | 2 +- _includes/embed/video.html | 2 +- _posts/2019-08-08-write-a-new-post.md | 331 ++++++++++++-------------- 3 files changed, 152 insertions(+), 183 deletions(-) diff --git a/_includes/embed/audio.html b/_includes/embed/audio.html index e2b89790..cf928a7f 100644 --- a/_includes/embed/audio.html +++ b/_includes/embed/audio.html @@ -4,7 +4,7 @@ {% unless src contains '://' %} {%- capture src -%} - {% include media-url.html src=src %} + {% include media-url.html src=src subpath=page.media_subpath %} {%- endcapture -%} {% endunless %} diff --git a/_includes/embed/video.html b/_includes/embed/video.html index 712a266a..9b6918f7 100644 --- a/_includes/embed/video.html +++ b/_includes/embed/video.html @@ -5,7 +5,7 @@ {% unless video_url contains '://' %} {%- capture video_url -%} - {% include media-url.html src=video_url %} + {% include media-url.html src=video_url subpath=page.media_subpath %} {%- endcapture -%} {% endunless %} diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index bda7705e..e6259ba3 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -107,76 +107,35 @@ comments: false --- ``` -## Mathematics - -We use [**MathJax**][mathjax] to generate mathematics. For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by: - -[mathjax]: https://www.mathjax.org/ +## Media -```yaml ---- -math: true ---- -``` +We refer to images, audio and video as media resources in _Chirpy_. -After enabling the mathematical feature, you can add math equations with the following syntax: +### URL Prefix -- **Block math** should be added with `$$ math $$` with **mandatory** blank lines before and after `$$` - - **Inserting equation numbering** should be added with `$$\begin{equation} math \end{equation}$$` - - **Referencing equation numbering** should be done with `\label{eq:label_name}` in the equation block and `\eqref{eq:label_name}` inline with text (see example below) -- **Inline math** (in lines) should be added with `$$ math $$` without any blank line before or after `$$` -- **Inline math** (in lists) should be added with `\$$ math $$` +From time to time we have to define duplicate URL prefixes for multiple resources in a post, which is a boring task that you can avoid by setting two parameters. -```markdown - - -$$ -LaTeX_math_expression -$$ - - - -$$ -\begin{equation} - LaTeX_math_expression - \label{eq:label_name} -\end{equation} -$$ +- If you are using a CDN to host media files, you can specify the `cdn` in `_config.yml`{: .filepath }. The URLs of media resources for site avatar and posts are then prefixed with the CDN domain name. -Can be referenced as \eqref{eq:label_name}. - - - -"Lorem ipsum dolor sit amet, $$ LaTeX_math_expression $$ consectetur adipiscing elit." - - - -1. \$$ LaTeX_math_expression $$ -2. \$$ LaTeX_math_expression $$ -3. \$$ LaTeX_math_expression $$ -``` - -> Starting with `v7.0.0`, configuration options for **MathJax** have been moved to file `assets/js/data/mathjax.js`{: .filepath }, and you can change the options as needed, such as adding [extensions][mathjax-exts]. -> If you are building the site via `chirpy-starter`, copy that file from the gem installation directory (check with command `bundle info --path jekyll-theme-chirpy`) to the same directory in your repository. -{: .prompt-tip } - -[mathjax-exts]: https://docs.mathjax.org/en/latest/input/tex/extensions/index.html - -## Mermaid + ```yaml + cdn: https://cdn.com + ``` + {: file='_config.yml' .nolineno } -[**Mermaid**](https://github.com/mermaid-js/mermaid) is a great diagram generation tool. To enable it on your post, add the following to the YAML block: +- To specify the resource path prefix for the current post/page range, set `media_subpath` in the _front matter_ of the post: -```yaml ---- -mermaid: true ---- -``` + ```yaml + --- + media_subpath: /path/to/media/ + --- + ``` + {: .nolineno } -Then you can use it like other markdown languages: surround the graph code with ```` ```mermaid ```` and ```` ``` ````. +The option `site.cdn` and `page.media_subpath` can be used individually or in combination to flexibly compose the final resource URL: `[site.cdn/][page.media_subpath/]file.ext` -## Images +### Images -### Caption +#### Caption Add italics to the next line of an image, then it will become the caption and appear at the bottom of the image: @@ -186,7 +145,7 @@ _Image Caption_ ``` {: .nolineno} -### Size +#### Size In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image. @@ -205,7 +164,7 @@ Starting from _Chirpy v5.0.0_, `height` and `width` support abbreviations (`heig ``` {: .nolineno} -### Position +#### Position By default, the image is centered, but you can specify the position by using one of the classes `normal`, `left`, and `right`. @@ -235,7 +194,7 @@ By default, the image is centered, but you can specify the position by using one ``` {: .nolineno} -### Dark/Light mode +#### Dark/Light mode You can make images follow theme preferences in dark/light mode. This requires you to prepare two images, one for dark mode and one for light mode, and then assign them a specific class (`dark` or `light`): @@ -244,7 +203,7 @@ You can make images follow theme preferences in dark/light mode. This requires y ![Dark mode only](/path/to/dark-mode.png){: .dark } ``` -### Shadow +#### Shadow The screenshots of the program window can be considered to show the shadow effect: @@ -253,56 +212,7 @@ The screenshots of the program window can be considered to show the shadow effec ``` {: .nolineno} -### CDN URL - -If you host the media resources on the CDN, you can save the time of repeatedly writing the CDN URL by assigning the variable `cdn` of `_config.yml`{: .filepath} file: - -```yaml -cdn: https://cdn.com -``` -{: file='_config.yml' .nolineno} - -Once `cdn` is assigned, the CDN URL will be added to the path of all media resources (site avatar, posts' images, audio and video files) starting with `/`. - -For instance, when using images: - -```markdown -![The flower](/path/to/flower.png) -``` -{: .nolineno} - -The parsing result will automatically add the CDN prefix `https://cdn.com` before the image path: - -```html -The flower -``` -{: .nolineno } - -### Media Subpath - -When a post contains many images, it will be a time-consuming task to repeatedly define the path of the media resources. To solve this, we can define this path in the YAML block of the post: - -```yml ---- -media_subpath: /img/path/ ---- -``` - -And then, the image source of Markdown can write the file name directly: - -```md -![The flower](flower.png) -``` -{: .nolineno } - -The output will be: - -```html -The flower -``` -{: .nolineno } - -### Preview Image +#### Preview Image If you want to add an image at the top of the post, please provide an image with a resolution of `1200 x 630`. Please note that if the image aspect ratio does not meet `1.91 : 1`, the image will be scaled and cropped. @@ -316,7 +226,7 @@ image: --- ``` -Note that the [`media_subpath`](#media-subpath) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name. +Note that the [`media_subpath`](#url-prefix) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name. For simple use, you can also just use `image` to define the path. @@ -326,7 +236,7 @@ image: /path/to/image --- ``` -### LQIP +#### LQIP For preview images: @@ -346,6 +256,86 @@ For normal images: ``` {: .nolineno } +### Video + +#### Social Media Platform + +You can embed videos from social media platforms with the following syntax: + +```liquid +{% include embed/{Platform}.html id='{ID}' %} +``` + +Where `Platform` is the lowercase of the platform name, and `ID` is the video ID. + +The following table shows how to get the two parameters we need in a given video URL, and you can also know the currently supported video platforms. + +| Video URL | Platform | ID | +| -------------------------------------------------------------------------------------------------- | ---------- | :------------- | +| [https://www.**youtube**.com/watch?v=**H-B46URT4mg**](https://www.youtube.com/watch?v=H-B46URT4mg) | `youtube` | `H-B46URT4mg` | +| [https://www.**twitch**.tv/videos/**1634779211**](https://www.twitch.tv/videos/1634779211) | `twitch` | `1634779211` | +| [https://www.**bilibili**.com/video/**BV1Q44y1B7Wf**](https://www.bilibili.com/video/BV1Q44y1B7Wf) | `bilibili` | `BV1Q44y1B7Wf` | + +#### Video Files + +If you want to embed a video file directly, use the following syntax: + +```liquid +{% include embed/video.html src='{URL}' %} +``` + +Where `URL` is an URL to a video file e.g. `/path/to/sample/video.mp4`. + +You can also specify additional attributes for the embedded video file. Here is a full list of attributes allowed. + +- `poster='/path/to/poster.png'` — poster image for a video that is shown while video is downloading +- `title='Text'` — title for a video that appears below the video and looks same as for images +- `autoplay=true` — video automatically begins to play back as soon as it can +- `loop=true` — automatically seek back to the start upon reaching the end of the video +- `muted=true` — audio will be initially silenced +- `types` — specify the extensions of additional video formats separated by `|`. Ensure these files exist in the same directory as your primary video file. + +Consider an example utilizing all of the above: + +```liquid +{% + include embed/video.html + src='/path/to/video.mp4' + types='ogg|mov' + poster='poster.png' + title='Demo video' + autoplay=true + loop=true + muted=true +%} +``` + +### Audios + +If you want to embed an audio file directly, use the following syntax: + +```liquid +{% include embed/audio.html src='{URL}' %} +``` + +Where `URL` is an URL to an audio file e.g. `/path/to/audio.mp3`. + +You can also specify additional attributes for the embedded audio file. Here is a full list of attributes allowed. + +- `title='Text'` — title for an audio that appears below the audio and looks same as for images +- `types` — specify the extensions of additional audio formats separated by `|`. Ensure these files exist in the same directory as your primary audio file. + +Consider an example utilizing all of the above: + +```liquid +{% + include embed/audio.html + src='/path/to/audio.mp3' + types='ogg|wav|aac' + title='Demo audio' +%} +``` + ## Pinned Posts You can pin one or more posts to the top of the home page, and the fixed posts are sorted in reverse order according to their release date. Enable by: @@ -443,95 +433,74 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{% Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block. -## Videos - -### Video Sharing Platform - -You can embed a video with the following syntax: - -```liquid -{% include embed/{Platform}.html id='{ID}' %} ``` -Where `Platform` is the lowercase of the platform name, and `ID` is the video ID. - -The following table shows how to get the two parameters we need in a given video URL, and you can also know the currently supported video platforms. - -| Video URL | Platform | ID | -| -------------------------------------------------------------------------------------------------- | ---------- | :------------- | -| [https://www.**youtube**.com/watch?v=**H-B46URT4mg**](https://www.youtube.com/watch?v=H-B46URT4mg) | `youtube` | `H-B46URT4mg` | -| [https://www.**twitch**.tv/videos/**1634779211**](https://www.twitch.tv/videos/1634779211) | `twitch` | `1634779211` | -| [https://www.**bilibili**.com/video/**BV1Q44y1B7Wf**](https://www.bilibili.com/video/BV1Q44y1B7Wf) | `bilibili` | `BV1Q44y1B7Wf` | +## Mathematics -### Video File +We use [**MathJax**][mathjax] to generate mathematics. For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by: -If you want to embed a video file directly, use the following syntax: +[mathjax]: https://www.mathjax.org/ -```liquid -{% include embed/video.html src='{URL}' %} +```yaml +--- +math: true +--- ``` -Where `URL` is an URL to a video file e.g. `/assets/img/sample/video.mp4`. +After enabling the mathematical feature, you can add math equations with the following syntax: -You can also specify additional attributes for the embedded video file. Here is a full list of attributes allowed. +- **Block math** should be added with `$$ math $$` with **mandatory** blank lines before and after `$$` + - **Inserting equation numbering** should be added with `$$\begin{equation} math \end{equation}$$` + - **Referencing equation numbering** should be done with `\label{eq:label_name}` in the equation block and `\eqref{eq:label_name}` inline with text (see example below) +- **Inline math** (in lines) should be added with `$$ math $$` without any blank line before or after `$$` +- **Inline math** (in lists) should be added with `\$$ math $$` -- `poster='/path/to/poster.png'` - poster image for a video that is shown while video is downloading -- `title='Text'` - title for a video that appears below the video and looks same as for images -- `autoplay=true` - video automatically begins to play back as soon as it can -- `loop=true` - automatically seek back to the start upon reaching the end of the video -- `muted=true` - audio will be initially silenced -- `types` - specify the extensions of additional video formats separated by `|`. Ensure these files exist in the same directory as your primary video file. +```markdown + -Consider an example utilizing all of the above: +$$ +LaTeX_math_expression +$$ -```liquid -{% - include embed/video.html - src='/path/to/video/video.mp4' - types='ogg|mov' - poster='poster.png' - title='Demo video' - autoplay=true - loop=true - muted=true -%} -``` + -> It's not recommended to host video files in `assets` folder as they cannot be cached by PWA and may cause issues. -> Instead, use CDN to host video files. Alternatively, use a separate folder that is excluded from PWA (see `pwa.deny_paths` setting in `_config.yml`). -{: .prompt-warning } +$$ +\begin{equation} + LaTeX_math_expression + \label{eq:label_name} +\end{equation} +$$ + +Can be referenced as \eqref{eq:label_name}. -## Audios + -### Audio File +"Lorem ipsum dolor sit amet, $$ LaTeX_math_expression $$ consectetur adipiscing elit." -If you want to embed an audio file directly, use the following syntax: + -```liquid -{% include embed/audio.html src='{URL}' %} +1. \$$ LaTeX_math_expression $$ +2. \$$ LaTeX_math_expression $$ +3. \$$ LaTeX_math_expression $$ ``` -Where `URL` is an URL to an audio file e.g. `/assets/img/sample/audio.mp3`. +> Starting with `v7.0.0`, configuration options for **MathJax** have been moved to file `assets/js/data/mathjax.js`{: .filepath }, and you can change the options as needed, such as adding [extensions][mathjax-exts]. +> If you are building the site via `chirpy-starter`, copy that file from the gem installation directory (check with command `bundle info --path jekyll-theme-chirpy`) to the same directory in your repository. +{: .prompt-tip } -You can also specify additional attributes for the embedded audio file. Here is a full list of attributes allowed. +[mathjax-exts]: https://docs.mathjax.org/en/latest/input/tex/extensions/index.html -- `title='Text'` - title for an audio that appears below the audio and looks same as for images -- `types` - specify the extensions of additional audio formats separated by `|`. Ensure these files exist in the same directory as your primary audio file. +## Mermaid -Consider an example utilizing all of the above: +[**Mermaid**](https://github.com/mermaid-js/mermaid) is a great diagram generation tool. To enable it on your post, add the following to the YAML block: -```liquid -{% - include embed/audio.html - src='/path/to/audio/audio.mp3' - types='ogg|wav|aac' - title='Demo audio' -%} +```yaml +--- +mermaid: true +--- ``` -> It's not recommended to host audio files in `assets` folder as they cannot be cached by PWA and may cause issues. -> Instead, use CDN to host audio files. Alternatively, use a separate folder that is excluded from PWA (see `pwa.deny_paths` setting in `_config.yml`). -{: .prompt-warning } +Then you can use it like other markdown languages: surround the graph code with ```` ```mermaid ```` and ```` ``` ````. ## Learn More From 33a1fa7cae2181625e2f335708d59de4dd20ee7d Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 18 May 2024 18:52:45 +0800 Subject: [PATCH 005/177] fix(analytics): goatcounter pv greater than 1K cannot be converted to numbers (#1762) The goatcounter PV report splits numbers with spaces, e.g. 1024 would be '1 024' --- _includes/pageviews/goatcounter.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_includes/pageviews/goatcounter.html b/_includes/pageviews/goatcounter.html index af536dbd..e62fd698 100644 --- a/_includes/pageviews/goatcounter.html +++ b/_includes/pageviews/goatcounter.html @@ -9,7 +9,8 @@ fetch(url) .then((response) => response.json()) .then((data) => { - pv.innerText = new Intl.NumberFormat().format(data.count); + const count = data.count.replace(/\s/g, ''); + pv.innerText = new Intl.NumberFormat().format(count); }) .catch((error) => { pv.innerText = '1'; From 20987f2afe033cf9af8d6b534079b5bd06f6a30f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 18 May 2024 11:01:22 +0000 Subject: [PATCH 006/177] chore(release): 7.0.1 ## [7.0.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.0.0...v7.0.1) (2024-05-18) ### Bug Fixes * **analytics:** goatcounter pv greater than 1K cannot be converted to numbers ([#1762](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1762)) ([33a1fa7](https://github.com/cotes2020/jekyll-theme-chirpy/commit/33a1fa7cae2181625e2f335708d59de4dd20ee7d)) * audio/video path apply variable `media_subpath` ([#1745](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1745)) ([00a27a1](https://github.com/cotes2020/jekyll-theme-chirpy/commit/00a27a1b85f665d0642b77babd54c6903fbdeb22)) --- docs/CHANGELOG.md | 7 +++++++ jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 777e27b2..abe0a178 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [7.0.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.0.0...v7.0.1) (2024-05-18) + +### Bug Fixes + +* **analytics:** goatcounter pv greater than 1K cannot be converted to numbers ([#1762](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1762)) ([33a1fa7](https://github.com/cotes2020/jekyll-theme-chirpy/commit/33a1fa7cae2181625e2f335708d59de4dd20ee7d)) +* audio/video path apply variable `media_subpath` ([#1745](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1745)) ([00a27a1](https://github.com/cotes2020/jekyll-theme-chirpy/commit/00a27a1b85f665d0642b77babd54c6903fbdeb22)) + ## [7.0.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.5.5...v7.0.0) (2024-05-11) ### ⚠ BREAKING CHANGES diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 88d5c424..91d618c1 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-theme-chirpy" - spec.version = "7.0.0" + spec.version = "7.0.1" spec.authors = ["Cotes Chung"] spec.email = ["cotes.chung@gmail.com"] diff --git a/package.json b/package.json index 00f85453..8600aa4e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jekyll-theme-chirpy", - "version": "7.0.0", + "version": "7.0.1", "description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.", "repository": { "type": "git", From 0102abae062be24ec289fb7facb11950aca79e3f Mon Sep 17 00:00:00 2001 From: Jason <50330957+itsjason-net@users.noreply.github.com> Date: Sat, 18 May 2024 06:05:09 -0500 Subject: [PATCH 007/177] feat: add Bluesky social links (#1759) --- _data/contact.yml | 4 ++++ _data/share.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/_data/contact.yml b/_data/contact.yml index 1ed228a0..d6819e0d 100644 --- a/_data/contact.yml +++ b/_data/contact.yml @@ -26,3 +26,7 @@ # - type: stack-overflow # icon: 'fab fa-stack-overflow' # url: '' # Fill with your stackoverflow homepage +# +# - type: bluesky +# icon: 'fa-brands fa-bluesky' +# url: '' # Fill with your Bluesky profile link diff --git a/_data/share.yml b/_data/share.yml index b1d077dc..0aa28fd4 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -36,3 +36,7 @@ platforms: # link: "https://fosstodon.org/" # - label: photog.social # link: "https://photog.social/" + # + # - type: Bluesky + # icon: "fa-brands fa-bluesky" + # link: "https://bsky.app/intent/compose?text=TITLE%20URL" From 64ae7a3671335409e11a9b467d5a89847528b812 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 30 May 2024 03:33:35 +0800 Subject: [PATCH 008/177] docs: correct markdown syntax of tutorial (#1787) --- _posts/2019-08-08-write-a-new-post.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index e6259ba3..3ad1438b 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -433,8 +433,6 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{% Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block. -``` - ## Mathematics We use [**MathJax**][mathjax] to generate mathematics. For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by: From 1c5fa0880d3bb21c7a3a5f53d0e7d3bab146baba Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 1 Jun 2024 04:11:01 +0800 Subject: [PATCH 009/177] refactor: restore shell script extensions Without an extension, the shell script configuration in `.gitattribute` will not work. --- .github/workflows/ci.yml | 2 +- _posts/2019-08-09-getting-started.md | 2 +- package.json | 4 ++-- tools/{init => init.sh} | 0 tools/{release => release.sh} | 2 +- tools/{run => run.sh} | 0 tools/{test => test.sh} | 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) rename tools/{init => init.sh} (100%) rename tools/{release => release.sh} (98%) rename tools/{run => run.sh} (100%) rename tools/{test => test.sh} (97%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa8d0c9e..ca60bd67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,4 +42,4 @@ jobs: run: npm i && npm run build - name: Test Site - run: bash tools/test + run: bash tools/test.sh diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 1cea5be9..3e0327a7 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -35,7 +35,7 @@ Sign in to GitHub to [fork **Chirpy**](https://github.com/cotes2020/jekyll-theme Next, clone the repository to your local machine, make sure it has [Node.js][nodejs] installed, then go to the root directory of the repo and run the following command: ```console -$ bash tools/init +$ bash tools/init.sh ``` > If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. diff --git a/package.json b/package.json index 8600aa4e..2c065bb6 100644 --- a/package.json +++ b/package.json @@ -156,8 +156,8 @@ [ "@semantic-release/exec", { - "prepareCmd": "bash tools/release --prepare", - "publishCmd": "bash tools/release" + "prepareCmd": "bash tools/release.sh --prepare", + "publishCmd": "bash tools/release.sh" } ], [ diff --git a/tools/init b/tools/init.sh similarity index 100% rename from tools/init rename to tools/init.sh diff --git a/tools/release b/tools/release.sh similarity index 98% rename from tools/release rename to tools/release.sh index c2ea59e1..6d010b63 100755 --- a/tools/release +++ b/tools/release.sh @@ -37,7 +37,7 @@ help() { echo " 2. Merge the release branch into the default branch" echo echo "Usage:" - echo " bash ./tools/release [options]" + echo " bash $0 [options]" echo echo "Options:" echo " --prepare Preparation for release" diff --git a/tools/run b/tools/run.sh similarity index 100% rename from tools/run rename to tools/run.sh diff --git a/tools/test b/tools/test.sh similarity index 97% rename from tools/test rename to tools/test.sh index fe47d446..331de1c3 100755 --- a/tools/test +++ b/tools/test.sh @@ -19,7 +19,7 @@ help() { echo echo "Usage:" echo - echo " bash ./tools/test [options]" + echo " bash $0 [options]" echo echo "Options:" echo ' -c, --config "" Specify config file(s)' From 1e3d4a6323ba3eed06a57f8bf1b2edefd890b127 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:12:54 +0800 Subject: [PATCH 010/177] feat(dev): support vscode dev-container (#1781) --- .devcontainer/devcontainer.json | 31 +++++++++++++++++++++++++++++++ .devcontainer/post-create.sh | 10 ++++++++++ .github/dependabot.yml | 4 ++++ .gitignore | 2 +- .vscode/extensions.json | 12 +----------- .vscode/settings.json | 6 +++--- README.md | 9 +++++---- tools/run.sh | 4 ++++ 8 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/post-create.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..a891b7ee --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +{ + "name": "Jekyll", + "image": "mcr.microsoft.com/devcontainers/jekyll:2-bullseye", + "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "postCreateCommand": "bash .devcontainer/post-create.sh", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh", + // Speed up extension installation + "extensions.verifySignature": false + }, + "extensions": [ + // Liquid tags auto-complete + "killalau.vscode-liquid-snippets", + // Liquid syntax highlighting and formatting + "Shopify.theme-check-vscode", + // Shell + "timonwong.shellcheck", + "mkhl.shfmt", + // Common formatter + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "stylelint.vscode-stylelint", + "yzhang.markdown-all-in-one", + // Git + "mhutchie.git-graph" + ] + } + } +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 00000000..14422cbf --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +if [ -f package.json ]; then + bash -i -c "nvm install --lts && nvm install-latest-npm" + npm i + npm run build +fi + +# Install dependencies for shfmt extension +curl -sS https://webi.sh/shfmt | sh &>/dev/null diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 393fa980..82bf3f77 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -23,3 +23,7 @@ updates: - "major" schedule: interval: "weekly" + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.gitignore b/.gitignore index d6bf5096..e7803e6e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ package-lock.json # IDE configurations .idea -.vscode +.vscode/* !.vscode/settings.json !.vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 52bd6fbd..082bc94c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,13 +1,3 @@ { - "recommendations": [ - // Liquid tags auto-complete - "killalau.vscode-liquid-snippets", - // Liquid syntax highlighting and formatting - "Shopify.theme-check-vscode", - // Common formatter - "esbenp.prettier-vscode", - "foxundermoon.shell-format", - "stylelint.vscode-stylelint", - "yzhang.markdown-all-in-one" - ] + "recommendations": ["ms-vscode-remote.remote-containers"] } diff --git a/.vscode/settings.json b/.vscode/settings.json index b0e2e099..787a0c84 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,13 +15,13 @@ "editor.defaultFormatter": "Shopify.theme-check-vscode" }, "[shellscript]": { - "editor.defaultFormatter": "foxundermoon.shell-format" + "editor.defaultFormatter": "mkhl.shfmt" }, // Disable vscode built-in stylelint "css.validate": false, "scss.validate": false, "less.validate": false, // Stylint extension settings - "stylelint.snippet": ["css", "less", "postcss", "scss"], - "stylelint.validate": ["css", "less", "postcss", "scss"] + "stylelint.snippet": ["css", "scss"], + "stylelint.validate": ["css", "scss"] } diff --git a/README.md b/README.md index 747b8bc1..6f3b158e 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)][gem]  - [![CI](https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml/badge.svg?branch=master&event=push)][ci]  + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=gainsboro&label=gem&color=brightgreen)][gem]  + [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github&logoColor=gainsboro)][ci]  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy]  - [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)][license]  - [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) + [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license]  + [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&logoColor=gainsboro&message=Open&color=deepskyblue)][open-container] [**Live Demo** →][demo] @@ -72,6 +72,7 @@ This project is published under [MIT License][license]. [ci]: https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml?query=event%3Apush+branch%3Amaster [codacy]: https://app.codacy.com/gh/cotes2020/jekyll-theme-chirpy/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade [license]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE +[open-container]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/cotes2020/jekyll-theme-chirpy [jekyllrb]: https://jekyllrb.com/ [clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/ [demo]: https://cotes2020.github.io/chirpy-demo/ diff --git a/tools/run.sh b/tools/run.sh index 04f23f5e..0efc452d 100755 --- a/tools/run.sh +++ b/tools/run.sh @@ -46,5 +46,9 @@ if $prod; then command="JEKYLL_ENV=production $command" fi +if [ -e /proc/1/cgroup ] && grep -q docker /proc/1/cgroup; then + command="$command --force_polling" +fi + echo -e "\n> $command\n" eval "$command" From 3b46629dc0c4bf401cc4775121adfa2cdd342043 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 4 Jun 2024 01:36:27 +0800 Subject: [PATCH 011/177] build(deps-dev): bump the npm group across 1 directory with 8 updates Updates the requirements on [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core), [@babel/plugin-transform-class-properties](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-class-properties), [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env), [conventional-changelog-conventionalcommits](https://github.com/conventional-changelog/conventional-changelog/tree/HEAD/packages/conventional-changelog-conventionalcommits), [rollup](https://github.com/rollup/rollup), [rollup-plugin-license](https://github.com/mjeanroy/rollup-plugin-license), [semantic-release](https://github.com/semantic-release/semantic-release) and [stylelint](https://github.com/stylelint/stylelint) to permit the latest version. Updates `@babel/core` to 7.24.6 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-core) Updates `@babel/plugin-transform-class-properties` to 7.24.6 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-plugin-transform-class-properties) Updates `@babel/preset-env` to 7.24.6 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-preset-env) Updates `conventional-changelog-conventionalcommits` from 7.0.2 to 8.0.0 - [Release notes](https://github.com/conventional-changelog/conventional-changelog/releases) - [Changelog](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-conventionalcommits/CHANGELOG.md) - [Commits](https://github.com/conventional-changelog/conventional-changelog/commits/conventional-changelog-conventionalcommits-v8.0.0/packages/conventional-changelog-conventionalcommits) Updates `rollup` to 4.18.0 - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v4.17.2...v4.18.0) Updates `rollup-plugin-license` to 3.4.0 - [Changelog](https://github.com/mjeanroy/rollup-plugin-license/blob/master/CHANGELOG.md) - [Commits](https://github.com/mjeanroy/rollup-plugin-license/compare/v3.3.1...v3.4.0) Updates `semantic-release` from 23.1.1 to 24.0.0 - [Release notes](https://github.com/semantic-release/semantic-release/releases) - [Commits](https://github.com/semantic-release/semantic-release/compare/v23.1.1...v24.0.0) Updates `stylelint` to 16.6.1 - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/16.5.0...16.6.1) --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 2c065bb6..57489865 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,9 @@ "bootstrap": "^5.3.3" }, "devDependencies": { - "@babel/core": "^7.24.5", - "@babel/plugin-transform-class-properties": "^7.24.1", - "@babel/preset-env": "^7.24.5", + "@babel/core": "^7.24.6", + "@babel/plugin-transform-class-properties": "^7.24.6", + "@babel/preset-env": "^7.24.6", "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", "@rollup/plugin-babel": "^6.0.4", @@ -39,13 +39,13 @@ "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", "concurrently": "^8.2.2", - "conventional-changelog-conventionalcommits": "^7.0.2", + "conventional-changelog-conventionalcommits": "^8.0.0", "husky": "^9.0.11", "purgecss": "^6.0.0", - "rollup": "^4.17.2", - "rollup-plugin-license": "^3.3.1", - "semantic-release": "^23.1.1", - "stylelint": "^16.5.0", + "rollup": "^4.18.0", + "rollup-plugin-license": "^3.4.0", + "semantic-release": "^24.0.0", + "stylelint": "^16.6.1", "stylelint-config-standard-scss": "^13.1.0" }, "prettier": { From 88b844ce80a4aada081ec919d652c2fddb2fa77e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:26:17 +0800 Subject: [PATCH 012/177] build(deps): improve dependency grouping --- .github/dependabot.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 82bf3f77..a51f37eb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,11 +8,10 @@ updates: directory: "/" versioning-strategy: increase groups: - npm: - update-types: - - "major" - - "minor" - - "patch" + prod-deps: + dependency-type: production + dev-deps: + dependency-type: development schedule: interval: "weekly" - package-ecosystem: "github-actions" From 250880c088955f7d2f09129edc69ae7b9486d1ef Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:28:02 +0800 Subject: [PATCH 013/177] docs: change ordering of badges --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6f3b158e..2cc38073 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=gainsboro&label=gem&color=brightgreen)][gem]  - [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github&logoColor=gainsboro)][ci]  - [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy]  + [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&message=Open&color=deepskyblue)][open-container]  + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=tomato)][gem]  [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license]  - [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&logoColor=gainsboro&message=Open&color=deepskyblue)][open-container] + [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]  + [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy] [**Live Demo** →][demo] From 7ca9c5978425d2ca052ce14cc0592c16436b8174 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 5 Jun 2024 23:51:10 +0800 Subject: [PATCH 014/177] build(deps-dev): remove package `rollup-plugin-license` (#1796) The `rollup-plugin-license` has been using too many deprecated dependencies, so it is necessary to remove it. As an alternative, this changes uses Rollup `output.banner` to insert copyright information. Since `terser` runs after `output`, it is not possible to insert the Front Matter defining permlink for `sw.js` through the same way (Jekyll Front Matter is YAML rather than JS, which would cause errors with terser). Therefore, _Jekyll Collection_ is now used to add permlink to `sw.js`, with the collection named `app`, and the directory placed in `_app`. This directory is not tracked by git, but it will be included when building the gem. --- .gitignore | 1 + _config.yml | 7 +++-- _includes/js-selector.html | 7 +++-- _javascript/_copyright | 1 - _javascript/pwa/_frontmatter | 3 --- jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- rollup.config.js | 50 +++++++++++++++++------------------- tools/init.sh | 2 +- tools/release.sh | 18 ++----------- 10 files changed, 35 insertions(+), 58 deletions(-) delete mode 100644 _javascript/_copyright delete mode 100644 _javascript/pwa/_frontmatter diff --git a/.gitignore b/.gitignore index e7803e6e..104d0531 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ Gemfile.lock .jekyll-cache .jekyll-metadata _site +_app # RubyGems *.gem diff --git a/_config.yml b/_config.yml index 613b043b..8e54ea7f 100644 --- a/_config.yml +++ b/_config.yml @@ -168,6 +168,9 @@ collections: tabs: output: true sort_by: order + app: + output: true + permalink: /:name defaults: - scope: @@ -190,10 +193,6 @@ defaults: values: layout: page permalink: /:title/ - - scope: - path: assets/js/dist - values: - swcache: true sass: style: compressed diff --git a/_includes/js-selector.html b/_includes/js-selector.html index b229b70d..99651076 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -6,8 +6,6 @@ -{% assign js_dist = '/assets/js/dist/' %} - {% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %} {% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %} @@ -62,7 +60,8 @@ {% assign js = 'commons' %} {% endcase %} -{% capture script %}{{ js_dist }}{{ js }}.min.js{% endcapture %} +{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %} + {% if page.math %} @@ -93,7 +92,7 @@ {% if jekyll.environment == 'production' %} {% if site.pwa.enabled %} - + {% endif %} diff --git a/_javascript/_copyright b/_javascript/_copyright deleted file mode 100644 index 60a706be..00000000 --- a/_javascript/_copyright +++ /dev/null @@ -1 +0,0 @@ -Chirpy v<%= pkg.version %> | © 2019 <%= pkg.author %> | <%= pkg.license %> Licensed | <%= pkg.homepage %> diff --git a/_javascript/pwa/_frontmatter b/_javascript/pwa/_frontmatter deleted file mode 100644 index 97ecf0a6..00000000 --- a/_javascript/pwa/_frontmatter +++ /dev/null @@ -1,3 +0,0 @@ ---- -permalink: /:basename ---- diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 91d618c1..2c77572b 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").select { |f| - f.match(%r!^((_(includes|layouts|sass|(data\/(locales|origin)))|assets)\/|README|LICENSE)!i) + f.match(%r!^((_(includes|layouts|sass|app|(data\/(locales|origin)))|assets)\/|README|LICENSE)!i) } spec.metadata = { diff --git a/package.json b/package.json index 57489865..21cab364 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "author": "Cotes Chung", "license": "MIT", + "since": 2019, "bugs": { "url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues" }, @@ -43,7 +44,6 @@ "husky": "^9.0.11", "purgecss": "^6.0.0", "rollup": "^4.18.0", - "rollup-plugin-license": "^3.4.0", "semantic-release": "^24.0.0", "stylelint": "^16.6.1", "stylelint-config-standard-scss": "^13.1.0" diff --git a/rollup.config.js b/rollup.config.js index 823401e0..94507b92 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,38 +1,43 @@ import babel from '@rollup/plugin-babel'; import terser from '@rollup/plugin-terser'; -import license from 'rollup-plugin-license'; import { nodeResolve } from '@rollup/plugin-node-resolve'; -import fs from 'fs'; -import path from 'path'; import yaml from '@rollup/plugin-yaml'; +import fs from 'fs'; +import pkg from './package.json'; const SRC_DEFAULT = '_javascript'; const DIST_DEFAULT = 'assets/js/dist'; + const SRC_PWA = `${SRC_DEFAULT}/pwa`; +const DIST_PWA = '_app'; + +const banner = `/*! + * ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage} + */`; const isProd = process.env.BUILD === 'production'; -if (fs.existsSync(DIST_DEFAULT)) { - fs.rm(DIST_DEFAULT, { recursive: true, force: true }, (err) => { - if (err) { - throw err; - } - }); +function cleanup(...directories) { + for (const dir of directories) { + fs.rm(dir, { recursive: true, force: true }, (err) => { + if (err) { + console.error(`Failed to remove directory ${dir}: ${err}`); + } + }); + } } function build(filename, opts = {}) { const src = opts.src || SRC_DEFAULT; const dist = opts.dist || DIST_DEFAULT; - const bannerUrl = - opts.bannerUrl || path.join(__dirname, SRC_DEFAULT, '_copyright'); - const commentStyle = opts.commentStyle || 'ignored'; return { - input: [`${src}/${filename}.js`], + input: `${src}/${filename}.js`, output: { file: `${dist}/${filename}.min.js`, format: 'iife', name: 'Chirpy', + banner, sourcemap: !isProd }, watch: { @@ -46,18 +51,13 @@ function build(filename, opts = {}) { }), nodeResolve(), yaml(), - isProd && commentStyle === 'none' && terser(), - license({ - banner: { - commentStyle, - content: { file: bannerUrl } - } - }), - isProd && commentStyle !== 'none' && terser() + isProd && terser() ] }; } +cleanup(DIST_DEFAULT, DIST_PWA); + export default [ build('commons'), build('home'), @@ -65,10 +65,6 @@ export default [ build('page'), build('post'), build('misc'), - build('app', { src: SRC_PWA }), - build('sw', { - src: SRC_PWA, - bannerUrl: path.join(__dirname, SRC_PWA, '_frontmatter'), - commentStyle: 'none' - }) + build('app', { src: SRC_PWA, dist: DIST_PWA }), + build('sw', { src: SRC_PWA, dist: DIST_PWA }) ]; diff --git a/tools/init.sh b/tools/init.sh index ed478d79..c0c4e183 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -92,7 +92,7 @@ init_files() { npm i && npm run build # track the CSS/JS output - _sedi "/.*\/dist$/d" .gitignore + _sedi "/.*\/dist$/d;/^_app$/d" .gitignore } commit() { diff --git a/tools/release.sh b/tools/release.sh index 6d010b63..e505f1a2 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -17,6 +17,7 @@ CONFIG="_config.yml" CSS_DIST="_sass/dist" JS_DIST="assets/js/dist" +PWA_DIST="_app" FILES=( "$GEM_SPEC" @@ -111,20 +112,13 @@ prepare() { ## Build a Gem package build_gem() { - if $opt_pkg; then - BACKUP_PATH="$(mktemp -d)" - mkdir -p "$BACKUP_PATH"/css "$BACKUP_PATH"/js - [[ -d $CSS_DIST ]] && cp "$CSS_DIST"/* "$BACKUP_PATH"/css - [[ -d $JS_DIST ]] && cp "$JS_DIST"/* "$BACKUP_PATH"/js - fi - # Remove unnecessary theme settings sed -i -E "s/(^timezone:).*/\1/;s/(^cdn:).*/\1/;s/(^avatar:).*/\1/" $CONFIG rm -f ./*.gem npm run build # add CSS/JS distribution files to gem package - git add "$CSS_DIST" "$JS_DIST" -f + git add "$CSS_DIST" "$JS_DIST" "$PWA_DIST" -f echo -e "\n> gem build $GEM_SPEC\n" gem build "$GEM_SPEC" @@ -132,14 +126,6 @@ build_gem() { echo -e "\n> Resume file changes ...\n" git reset git checkout . - - if $opt_pkg; then - # restore the dist files for future development - mkdir -p "$CSS_DIST" "$JS_DIST" - cp "$BACKUP_PATH"/css/* "$CSS_DIST" - cp "$BACKUP_PATH"/js/* "$JS_DIST" - rm -rf "$BACKUP_PATH" - fi } # Push the gem to RubyGems.org (using $GEM_HOST_API_KEY) From cf853f14e4acb3deb097c57ef151b20f47ed84cb Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 7 Jun 2024 19:27:54 +0800 Subject: [PATCH 015/177] chore: upgrade `husky` v9 settings --- .husky/commit-msg | 5 +---- package.json | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) mode change 100755 => 100644 .husky/commit-msg diff --git a/.husky/commit-msg b/.husky/commit-msg old mode 100755 new mode 100644 index 7f23494b..0a4b97de --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx --no -- commitlint --edit ${1} +npx --no -- commitlint --edit $1 diff --git a/package.json b/package.json index 21cab364..d6f442b6 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "watch:js": "rollup -c --bundleConfigAsCjs -w", "lint:scss": "stylelint _sass/**/*.scss", "lint:fix:scss": "npm run lint:scss -- --fix", - "test": "npm run lint:scss" + "test": "npm run lint:scss", + "prepare": "husky" }, "dependencies": { "@popperjs/core": "^2.11.8", From f1d35832f425814cf0ee5dd3513597999bb31fc0 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 8 Jun 2024 00:45:59 +0800 Subject: [PATCH 016/177] build(devcontainer): add omz plugins & verify extension signature VSCode fixed signature validation hangs in v1.90 --- .devcontainer/devcontainer.json | 4 +--- .devcontainer/post-create.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a891b7ee..39c428df 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,9 +6,7 @@ "customizations": { "vscode": { "settings": { - "terminal.integrated.defaultProfile.linux": "zsh", - // Speed up extension installation - "extensions.verifySignature": false + "terminal.integrated.defaultProfile.linux": "zsh" }, "extensions": [ // Liquid tags auto-complete diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 14422cbf..a4bc2825 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -8,3 +8,11 @@ fi # Install dependencies for shfmt extension curl -sS https://webi.sh/shfmt | sh &>/dev/null + +# Add OMZ plugins +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting +git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions +sed -i -E "s/^(plugins=\()(git)(\))/\1\2 zsh-syntax-highlighting zsh-autosuggestions\3/" ~/.zshrc + +# Avoid git log use less +echo -e "\nunset LESS" >>~/.zshrc From 0709854dc8f6099d38c2578967a02f73b4be0dc8 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 16 Jun 2024 22:25:41 +0800 Subject: [PATCH 017/177] fix: adapt the giscus localization parameter (#1810) --- _includes/comments/giscus.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/_includes/comments/giscus.html b/_includes/comments/giscus.html index c8d48e67..f9becfe9 100644 --- a/_includes/comments/giscus.html +++ b/_includes/comments/giscus.html @@ -17,6 +17,12 @@ initTheme = darkTheme; } + let lang = '{{ site.comments.giscus.lang | default: lang }}'; + {%- comment -%} https://github.com/giscus/giscus/tree/main/locales {%- endcomment -%} + if (lang.length > 2 && !lang.startsWith('zh')) { + lang = lang.slice(0, 2); + } + let giscusAttributes = { src: 'https://giscus.app/client.js', 'data-repo': '{{ site.comments.giscus.repo}}', @@ -29,7 +35,7 @@ 'data-emit-metadata': '0', 'data-theme': initTheme, 'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}', - 'data-lang': '{{ site.comments.giscus.lang | default: lang }}', + 'data-lang': lang, 'data-loading': 'lazy', crossorigin: 'anonymous', async: '' From 9ca7519239d878258300814a5b201fd5b926a192 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 27 Jun 2024 05:30:53 +0800 Subject: [PATCH 018/177] docs: unify the style of badges --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2cc38073..32210f53 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&message=Open&color=deepskyblue)][open-container]  + [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=visualstudiocode)][open-container]  [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=tomato)][gem]  [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license]  [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]  - [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy] + [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy] [**Live Demo** →][demo] From c876731901784a72ef9d2e9e2936df65ddff5f61 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 1 Jul 2024 07:02:36 +0800 Subject: [PATCH 019/177] feat(ui): improve visibility of inline code (#1831) --- _sass/addon/syntax.scss | 2 +- _sass/colors/syntax-dark.scss | 2 +- _sass/colors/syntax-light.scss | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/_sass/addon/syntax.scss b/_sass/addon/syntax.scss index 68796f28..73c66aae 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/addon/syntax.scss @@ -102,7 +102,7 @@ code { &.highlighter-rouge { font-size: $code-font-size; - padding: 3px 5px; + padding: 3px 6px; word-break: break-word; border-radius: 4px; background-color: var(--inline-code-bg); diff --git a/_sass/colors/syntax-dark.scss b/_sass/colors/syntax-dark.scss index d898c651..eb92204d 100644 --- a/_sass/colors/syntax-dark.scss +++ b/_sass/colors/syntax-dark.scss @@ -7,7 +7,7 @@ --highlight-bg-color: #151515; --highlighter-rouge-color: #c9def1; --highlight-lineno-color: #808080; - --inline-code-bg: #323238; + --inline-code-bg: rgba(255, 255, 255, 0.05); --code-color: #b0b0b0; --code-header-text-color: #6a6a6a; --code-header-muted-color: #353535; diff --git a/_sass/colors/syntax-light.scss b/_sass/colors/syntax-light.scss index 6562c76f..76aa6691 100644 --- a/_sass/colors/syntax-light.scss +++ b/_sass/colors/syntax-light.scss @@ -8,17 +8,13 @@ --highlight-bg-color: #f6f8fa; --highlighter-rouge-color: #3f596f; --highlight-lineno-color: #9e9e9e; - --inline-code-bg: #f6f6f7; + --inline-code-bg: rgba(25, 25, 28, 0.05); --code-color: #3a3a3a; --code-header-text-color: #a3a3a3; --code-header-muted-color: #e5e5e5; --code-header-icon-color: #c9c8c8; --clipboard-checked-color: #43c743; - [class^='prompt-'] { - --inline-code-bg: #fbfafa; - } - /* --- Syntax highlight theme from `rougify style github` --- */ .highlight table td { From fbba0a4204f6aea9816b92b357ccd0969d41c53f Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 2 Jul 2024 06:00:39 +0800 Subject: [PATCH 020/177] chore: fix typos in project files and docs --- _config.yml | 24 +++++------ .../modules/components/search-display.js | 2 +- _posts/2019-08-08-text-and-typography.md | 8 ++-- _posts/2019-08-08-write-a-new-post.md | 14 +++---- _posts/2019-08-09-getting-started.md | 40 +++++++++---------- _sass/addon/module.scss | 2 +- _sass/colors/typography-dark.scss | 2 +- _sass/colors/typography-light.scss | 2 +- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/_config.yml b/_config.yml index 8e54ea7f..d862178c 100644 --- a/_config.yml +++ b/_config.yml @@ -16,20 +16,20 @@ timezone: Asia/Shanghai title: Chirpy # the main title -tagline: A text-focused Jekyll theme # it will display as the sub-title +tagline: A text-focused Jekyll theme # it will display as the subtitle description: >- # used by seo meta and the atom feed A minimal, responsive and feature-rich Jekyll theme for technical writing. # Fill in the protocol & hostname for your site. -# e.g. 'https://username.github.io', note that it does not end with a '/'. +# E.g. 'https://username.github.io', note that it does not end with a '/'. url: "" github: - username: github_username # change to your github username + username: github_username # change to your GitHub username twitter: - username: twitter_username # change to your twitter username + username: twitter_username # change to your Twitter username social: # Change to your full name. @@ -38,8 +38,8 @@ social: email: example@domain.com # change to your email address links: # The first element serves as the copyright owner's link - - https://twitter.com/username # change to your twitter homepage - - https://github.com/username # change to your github homepage + - https://twitter.com/username # change to your Twitter homepage + - https://github.com/username # change to your GitHub homepage # Uncomment below to add more social links # - https://www.facebook.com/username # - https://www.linkedin.com/in/username @@ -71,7 +71,7 @@ analytics: cloudflare: id: # fill in your Cloudflare Web Analytics token -# Pageviews settings +# Page views settings pageviews: provider: # now only supports 'goatcounter' @@ -83,8 +83,8 @@ pageviews: # # Available options: # -# light - Use the light color scheme -# dark - Use the dark color scheme +# light — Use the light color scheme +# dark — Use the dark color scheme # theme_mode: # [light | dark] @@ -106,7 +106,7 @@ social_preview_image: # string, local or CORS resources toc: true comments: - # Global switch for the post comment system. Keeping it empty means disabled. + # Global switch for the post-comment system. Keeping it empty means disabled. provider: # [disqus | utterances | giscus] # The provider options are as follows: disqus: @@ -136,9 +136,9 @@ assets: env: # [development | production] pwa: - enabled: true # the option for PWA feature (installable) + enabled: true # The option for PWA feature (installable) cache: - enabled: true # the option for PWA offline cache + enabled: true # The option for PWA offline cache # Paths defined here will be excluded from the PWA cache. # Usually its value is the `baseurl` of another website that # shares the same domain name as the current website. diff --git a/_javascript/modules/components/search-display.js b/_javascript/modules/components/search-display.js index 21d634ef..40059ac1 100644 --- a/_javascript/modules/components/search-display.js +++ b/_javascript/modules/components/search-display.js @@ -1,5 +1,5 @@ /** - * This script make #search-result-wrapper switch to unloaded or shown automatically. + * This script make #search-result-wrapper switch to unload or shown automatically. */ const btnSbTrigger = document.getElementById('sidebar-trigger'); diff --git a/_posts/2019-08-08-text-and-typography.md b/_posts/2019-08-08-text-and-typography.md index 7064d5d4..a8db26a0 100644 --- a/_posts/2019-08-08-text-and-typography.md +++ b/_posts/2019-08-08-text-and-typography.md @@ -18,16 +18,16 @@ image: -# H1 - heading +# H1 — heading {: .mt-4 .mb-0 } -## H2 - heading +## H2 — heading {: data-toc-skip='' .mt-4 .mb-0 } -### H3 - heading +### H3 — heading {: data-toc-skip='' .mt-4 .mb-0 } -#### H4 - heading +#### H4 — heading {: data-toc-skip='' .mt-4 } diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index 3ad1438b..69eaf34a 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -31,7 +31,7 @@ tags: [TAG] # TAG names should always be lowercase ### Timezone of Date -In order to accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`. +To accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`. ### Categories and Tags @@ -147,7 +147,7 @@ _Image Caption_ #### Size -In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image. +To prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image. ```markdown ![Desktop View](/assets/img/sample/mockup.png){: width="700" height="400" } @@ -284,7 +284,7 @@ If you want to embed a video file directly, use the following syntax: {% include embed/video.html src='{URL}' %} ``` -Where `URL` is an URL to a video file e.g. `/path/to/sample/video.mp4`. +Where `URL` is a URL to a video file e.g. `/path/to/sample/video.mp4`. You can also specify additional attributes for the embedded video file. Here is a full list of attributes allowed. @@ -295,7 +295,7 @@ You can also specify additional attributes for the embedded video file. Here is - `muted=true` — audio will be initially silenced - `types` — specify the extensions of additional video formats separated by `|`. Ensure these files exist in the same directory as your primary video file. -Consider an example utilizing all of the above: +Consider an example using all of the above: ```liquid {% @@ -318,14 +318,14 @@ If you want to embed an audio file directly, use the following syntax: {% include embed/audio.html src='{URL}' %} ``` -Where `URL` is an URL to an audio file e.g. `/path/to/audio.mp3`. +Where `URL` is a URL to an audio file e.g. `/path/to/audio.mp3`. You can also specify additional attributes for the embedded audio file. Here is a full list of attributes allowed. - `title='Text'` — title for an audio that appears below the audio and looks same as for images - `types` — specify the extensions of additional audio formats separated by `|`. Ensure these files exist in the same directory as your primary audio file. -Consider an example utilizing all of the above: +Consider an example using all of the above: ```liquid {% @@ -365,7 +365,7 @@ There are several types of prompts: `tip`, `info`, `warning`, and `danger`. They ``` {: .nolineno } -### Filepath Hightlight +### Filepath Highlight ```md `/path/to/a/file.extend`{: .filepath} diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 3e0327a7..3cad3839 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -60,7 +60,7 @@ $ bundle ### Configuration -Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options: +Update the variables in `_config.yml`{: .filepath} as needed. Some typical options include: - `url` - `avatar` @@ -69,17 +69,17 @@ Update the variables of `_config.yml`{: .filepath} as needed. Some of them are t ### Social Contact Options -Social contact options are displayed at the bottom of the sidebar. You can turn on/off the specified contacts in file `_data/contact.yml`{: .filepath }. +Social contact options are displayed at the bottom of the sidebar. You can enable or disable specific contacts in the `_data/contact.yml`{: .filepath} file. -### Customizing Stylesheet +### Customizing the Stylesheet -If you need to customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of it. +To customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} file to the same path in your Jekyll site, and add your custom styles at the end of the file. -Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main sass file `_sass/main.scss`{: .filepath} into the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign new value. +Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main SASS file `_sass/main.scss`{: .filepath} to the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign your new values there. -### Customing Static Assets +### Customizing Static Assets -Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined by file `_data/origin/cors.yml`{: .filepath }, and you can replace some of them according to the network conditions in the region where your website is published. +Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on to the network conditions in the region where your website is published. Also, if you'd like to self-host the static assets, please refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme). @@ -95,42 +95,42 @@ After a few seconds, the local service will be published at _ Date: Thu, 4 Jul 2024 01:42:29 +0800 Subject: [PATCH 021/177] refactor: fix typos in locale variable statment -> statement --- _data/locales/ar.yml | 2 +- _data/locales/bg-BG.yml | 2 +- _data/locales/cs-CZ.yml | 2 +- _data/locales/de-DE.yml | 4 ++-- _data/locales/el-GR.yml | 2 +- _data/locales/en.yml | 2 +- _data/locales/es-ES.yml | 2 +- _data/locales/fi-FI.yml | 2 +- _data/locales/fr-FR.yml | 2 +- _data/locales/hu-HU.yml | 2 +- _data/locales/id-ID.yml | 2 +- _data/locales/it-IT.yml | 2 +- _data/locales/ko-KR.yml | 2 +- _data/locales/my-MM.yml | 2 +- _data/locales/pt-BR.yml | 2 +- _data/locales/ru-RU.yml | 4 ++-- _data/locales/sl-SI.yml | 2 +- _data/locales/sv-SE.yml | 2 +- _data/locales/th.yml | 2 +- _data/locales/tr-TR.yml | 2 +- _data/locales/uk-UA.yml | 2 +- _data/locales/vi-VN.yml | 2 +- _data/locales/zh-CN.yml | 2 +- _data/locales/zh-TW.yml | 2 +- assets/404.html | 2 +- 25 files changed, 27 insertions(+), 27 deletions(-) diff --git a/_data/locales/ar.yml b/_data/locales/ar.yml index c6082981..a79e0200 100644 --- a/_data/locales/ar.yml +++ b/_data/locales/ar.yml @@ -43,7 +43,7 @@ copyright: meta: باستخدام :PLATFORM السمة :THEME not_found: - statment: عذرا, الرابط التالي غير صالح أو انه يشير إلى صفحة غير موجودة. + statement: عذرا, الرابط التالي غير صالح أو انه يشير إلى صفحة غير موجودة. notification: update_found: يتوفر اصدار جديد للمحتوى. diff --git a/_data/locales/bg-BG.yml b/_data/locales/bg-BG.yml index 3e049938..3fb060fd 100644 --- a/_data/locales/bg-BG.yml +++ b/_data/locales/bg-BG.yml @@ -43,7 +43,7 @@ copyright: meta: Създадено чрез :PLATFORM и :THEME тема not_found: - statment: Съжалявам, но на този URL адрес няма налично съдържание. + statement: Съжалявам, но на този URL адрес няма налично съдържание. notification: update_found: Налична е нова версия на съдържанието. diff --git a/_data/locales/cs-CZ.yml b/_data/locales/cs-CZ.yml index e515c08f..cf93f614 100644 --- a/_data/locales/cs-CZ.yml +++ b/_data/locales/cs-CZ.yml @@ -43,7 +43,7 @@ copyright: meta: Použití :PLATFORM s motivem :THEME not_found: - statment: Omlouváme se, adresu URL jsme špatně umístili nebo odkazuje na něco, co neexistuje. + statement: Omlouváme se, adresu URL jsme špatně umístili nebo odkazuje na něco, co neexistuje. notification: update_found: Je k dispozici nová verze obsahu. diff --git a/_data/locales/de-DE.yml b/_data/locales/de-DE.yml index 6b187b4c..6c9d91d4 100644 --- a/_data/locales/de-DE.yml +++ b/_data/locales/de-DE.yml @@ -42,7 +42,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource. + statement: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource. notification: update_found: Eine neue Version ist verfügbar. @@ -76,7 +76,7 @@ df: post: strftime: "%d.%m.%Y" dayjs: "DD.MM.YYYY" - + # categories page categories: category_measure: diff --git a/_data/locales/el-GR.yml b/_data/locales/el-GR.yml index ab5fb0e7..b6d2a866 100644 --- a/_data/locales/el-GR.yml +++ b/_data/locales/el-GR.yml @@ -43,7 +43,7 @@ copyright: meta: Αξιοποιώντας την :PLATFORM theme :THEME not_found: - statment: Συγνώμη, έχουμε τοποθετήσει λάθος αυτήν την διεύθυνση URL ή υποδεικνύει κάτι που δεν υπάρχει. + statement: Συγνώμη, έχουμε τοποθετήσει λάθος αυτήν την διεύθυνση URL ή υποδεικνύει κάτι που δεν υπάρχει. notification: update_found: Υπάρχει διαθέσιμη μια νέα έκδοση του περιεχομένου. diff --git a/_data/locales/en.yml b/_data/locales/en.yml index 0dbe7136..152d090a 100644 --- a/_data/locales/en.yml +++ b/_data/locales/en.yml @@ -43,7 +43,7 @@ copyright: meta: Using the :THEME theme for :PLATFORM. not_found: - statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. + statement: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. notification: update_found: A new version of content is available. diff --git a/_data/locales/es-ES.yml b/_data/locales/es-ES.yml index 55292308..8f8d149e 100644 --- a/_data/locales/es-ES.yml +++ b/_data/locales/es-ES.yml @@ -43,7 +43,7 @@ copyright: meta: Hecho con :PLATFORM usando el tema :THEME not_found: - statment: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe. + statement: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe. notification: update_found: Hay una nueva versión de contenido disponible. diff --git a/_data/locales/fi-FI.yml b/_data/locales/fi-FI.yml index c817d2b8..60c98620 100644 --- a/_data/locales/fi-FI.yml +++ b/_data/locales/fi-FI.yml @@ -42,7 +42,7 @@ copyright: meta: Käytetään :PLATFORM iä Teema :THEME not_found: - statment: Valitettavasti tällä URL-osoitteella ei ole saatavilla sisältöä. + statement: Valitettavasti tällä URL-osoitteella ei ole saatavilla sisältöä. notification: update_found: Uusi versio sisällöstä on saatavilla. diff --git a/_data/locales/fr-FR.yml b/_data/locales/fr-FR.yml index 72b034db..3f3c9a0c 100644 --- a/_data/locales/fr-FR.yml +++ b/_data/locales/fr-FR.yml @@ -43,7 +43,7 @@ copyright: meta: Propulsé par :PLATFORM avec le thème :THEME not_found: - statment: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas. + statement: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas. notification: update_found: Une nouvelle version du contenu est disponible. diff --git a/_data/locales/hu-HU.yml b/_data/locales/hu-HU.yml index b09f2cdc..53d88e96 100644 --- a/_data/locales/hu-HU.yml +++ b/_data/locales/hu-HU.yml @@ -45,7 +45,7 @@ copyright: meta: Készítve :PLATFORM motorral :THEME témával not_found: - statment: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat. + statement: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat. notification: update_found: Elérhető a tartalom új verziója. diff --git a/_data/locales/id-ID.yml b/_data/locales/id-ID.yml index 29ad1569..d772ec34 100644 --- a/_data/locales/id-ID.yml +++ b/_data/locales/id-ID.yml @@ -43,7 +43,7 @@ copyright: meta: Didukung oleh :PLATFORM dengan tema :THEME not_found: - statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. + statement: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. notification: update_found: Versi konten baru tersedia. diff --git a/_data/locales/it-IT.yml b/_data/locales/it-IT.yml index cf7b691b..c8dfb447 100644 --- a/_data/locales/it-IT.yml +++ b/_data/locales/it-IT.yml @@ -42,7 +42,7 @@ copyright: meta: Servizio offerto da :PLATFORM con tema :THEME not_found: - statment: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente. + statement: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente. notification: update_found: Nuova versione del contenuto disponibile. diff --git a/_data/locales/ko-KR.yml b/_data/locales/ko-KR.yml index 4dd221b9..82976349 100644 --- a/_data/locales/ko-KR.yml +++ b/_data/locales/ko-KR.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: 해당 URL은 존재하지 않습니다. + statement: 해당 URL은 존재하지 않습니다. notification: update_found: 새 버전의 콘텐츠를 사용할 수 있습니다. diff --git a/_data/locales/my-MM.yml b/_data/locales/my-MM.yml index 98848d59..d5bf728f 100644 --- a/_data/locales/my-MM.yml +++ b/_data/locales/my-MM.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ + statement: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ notification: update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။ diff --git a/_data/locales/pt-BR.yml b/_data/locales/pt-BR.yml index 4cef833d..7ca60a74 100644 --- a/_data/locales/pt-BR.yml +++ b/_data/locales/pt-BR.yml @@ -43,7 +43,7 @@ copyright: meta: Feito com :PLATFORM usando o tema :THEME not_found: - statment: Desculpe, a página não foi encontrada. + statement: Desculpe, a página não foi encontrada. notification: update_found: Uma nova versão do conteúdo está disponível. diff --git a/_data/locales/ru-RU.yml b/_data/locales/ru-RU.yml index 185407c1..868ba957 100644 --- a/_data/locales/ru-RU.yml +++ b/_data/locales/ru-RU.yml @@ -42,7 +42,7 @@ copyright: meta: Использует тему :THEME для :PLATFORM not_found: - statment: Извините, мы перепутали URL-адрес или он указывает на что-то несуществующее. + statement: Извините, мы перепутали URL-адрес или он указывает на что-то несуществующее. notification: update_found: Доступна новая версия контента. @@ -76,7 +76,7 @@ df: post: strftime: "%d.%m.%Y" dayjs: "DD.MM.YYYY" - + # categories page categories: category_measure: diff --git a/_data/locales/sl-SI.yml b/_data/locales/sl-SI.yml index 7ab18b1d..4d9434d4 100644 --- a/_data/locales/sl-SI.yml +++ b/_data/locales/sl-SI.yml @@ -43,7 +43,7 @@ copyright: meta: Uporabljena :PLATFORM tema :THEME #Using the :PLATFORM theme :THEME not_found: - statment: Oprostite, hiperpovezava je neustrezna ali vsebina ne obstajata. #Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. + statement: Oprostite, hiperpovezava je neustrezna ali vsebina ne obstajata. #Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. notification: update_found: Novejša različica vsebine je na voljo. #A new version of content is available. diff --git a/_data/locales/sv-SE.yml b/_data/locales/sv-SE.yml index 7ec2ee23..decb59cf 100644 --- a/_data/locales/sv-SE.yml +++ b/_data/locales/sv-SE.yml @@ -43,7 +43,7 @@ copyright: meta: Byggd med :PLATFORM och temat :THEME not_found: - statment: Ursäkta, vi har tappat bort den här webbadressen eller så pekar den på något som inte längre finns. + statement: Ursäkta, vi har tappat bort den här webbadressen eller så pekar den på något som inte längre finns. notification: update_found: Det finns en ny version av innehållet. diff --git a/_data/locales/th.yml b/_data/locales/th.yml index 22cb00aa..a3f41a0e 100644 --- a/_data/locales/th.yml +++ b/_data/locales/th.yml @@ -43,7 +43,7 @@ copyright: meta: กำลังใช้ธีมของ :PLATFORM ชื่อ :THEME not_found: - statment: ขออภัย เราวาง URL นั้นไว้ผิดที่ หรือมันชี้ไปยังสิ่งที่ไม่มีอยู่ + statement: ขออภัย เราวาง URL นั้นไว้ผิดที่ หรือมันชี้ไปยังสิ่งที่ไม่มีอยู่ notification: update_found: มีเวอร์ชันใหม่ของเนื้อหา diff --git a/_data/locales/tr-TR.yml b/_data/locales/tr-TR.yml index 50d81102..768f57cd 100644 --- a/_data/locales/tr-TR.yml +++ b/_data/locales/tr-TR.yml @@ -43,7 +43,7 @@ copyright: meta: :PLATFORM ve :THEME teması not_found: - statment: Üzgünüz, bu linki yanlış yerleştirdik veya var olmayan bir şeye işaret ediyor. + statement: Üzgünüz, bu linki yanlış yerleştirdik veya var olmayan bir şeye işaret ediyor. notification: update_found: İçeriğin yeni bir sürümü mevcut. diff --git a/_data/locales/uk-UA.yml b/_data/locales/uk-UA.yml index b6050738..8fef52e8 100644 --- a/_data/locales/uk-UA.yml +++ b/_data/locales/uk-UA.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: Вибачте, це посилання вказує на ресурс, що не існує. + statement: Вибачте, це посилання вказує на ресурс, що не існує. notification: update_found: Доступна нова версія вмісту. diff --git a/_data/locales/vi-VN.yml b/_data/locales/vi-VN.yml index 617431a0..6c2ceffd 100644 --- a/_data/locales/vi-VN.yml +++ b/_data/locales/vi-VN.yml @@ -42,7 +42,7 @@ copyright: meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME not_found: - statment: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại. + statement: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại. notification: update_found: Đã có phiên bản mới của nội dung. diff --git a/_data/locales/zh-CN.yml b/_data/locales/zh-CN.yml index f8281346..5c134101 100644 --- a/_data/locales/zh-CN.yml +++ b/_data/locales/zh-CN.yml @@ -42,7 +42,7 @@ copyright: meta: 本站采用 :PLATFORM 主题 :THEME not_found: - statment: 抱歉,我们放错了该 URL,或者它指向了不存在的内容。 + statement: 抱歉,我们放错了该 URL,或者它指向了不存在的内容。 notification: update_found: 发现新版本的内容。 diff --git a/_data/locales/zh-TW.yml b/_data/locales/zh-TW.yml index 911253b6..33a4330b 100644 --- a/_data/locales/zh-TW.yml +++ b/_data/locales/zh-TW.yml @@ -42,7 +42,7 @@ copyright: meta: 本網站使用 :PLATFORM 產生,採用 :THEME 主題 not_found: - statment: 抱歉,您可能正在存取一個已被移動的 URL,或者它從未存在。 + statement: 抱歉,您可能正在存取一個已被移動的 URL,或者它從未存在。 notification: update_found: 發現新版本更新。 diff --git a/assets/404.html b/assets/404.html index 5b46cc8c..af89d6d1 100644 --- a/assets/404.html +++ b/assets/404.html @@ -11,4 +11,4 @@ {% include lang.html %} -

{{ site.data.locales[lang].not_found.statment }}

+

{{ site.data.locales[lang].not_found.statement }}

From db9e58bab23f5cc4993efa36d90ae390be7d6e3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Jul 2024 01:49:30 +0800 Subject: [PATCH 022/177] build(deps-dev): bump the dev-deps group with 3 updates (#1824) Updates the requirements on [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core), [@babel/plugin-transform-class-properties](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-class-properties) and [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) to permit the latest version. Updates `@babel/core` to 7.24.7 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.7/packages/babel-core) Updates `@babel/plugin-transform-class-properties` to 7.24.7 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.7/packages/babel-plugin-transform-class-properties) Updates `@babel/preset-env` to 7.24.7 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.7/packages/babel-preset-env) --- updated-dependencies: - dependency-name: "@babel/core" dependency-type: direct:development dependency-group: dev-deps - dependency-name: "@babel/plugin-transform-class-properties" dependency-type: direct:development dependency-group: dev-deps - dependency-name: "@babel/preset-env" dependency-type: direct:development dependency-group: dev-deps ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d6f442b6..7d4835f3 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "bootstrap": "^5.3.3" }, "devDependencies": { - "@babel/core": "^7.24.6", - "@babel/plugin-transform-class-properties": "^7.24.6", - "@babel/preset-env": "^7.24.6", + "@babel/core": "^7.24.7", + "@babel/plugin-transform-class-properties": "^7.24.7", + "@babel/preset-env": "^7.24.7", "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", "@rollup/plugin-babel": "^6.0.4", From a07a57ec922249d3a22da56fbcb30d83eadef728 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 4 Jul 2024 02:21:22 +0800 Subject: [PATCH 023/177] feat(ui): make `info-prompt` icon looks like the letter "i" (#1835) --- _sass/addon/commons.scss | 4 ++-- _sass/addon/module.scss | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index e6cf7c26..4087d241 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -107,8 +107,8 @@ blockquote { } } - @include prompt('tip', '\f0eb', 'regular'); - @include prompt('info', '\f06a'); + @include prompt('tip', '\f0eb', $fa-style: 'regular'); + @include prompt('info', '\f06a', $rotate: 180); @include prompt('warning', '\f06a'); @include prompt('danger', '\f071'); } diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index edc5f3ef..9e85adc0 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -187,7 +187,7 @@ transform: translateX(-50%); } -@mixin prompt($type, $fa-content, $fa-style: 'solid') { +@mixin prompt($type, $fa-content, $fa-style: 'solid', $rotate: 0) { &.prompt-#{$type} { background-color: var(--prompt-#{$type}-bg); @@ -195,6 +195,10 @@ content: $fa-content; color: var(--prompt-#{$type}-icon-color); font: var(--fa-font-#{$fa-style}); + + @if $rotate != 0 { + transform: rotate(#{$rotate}deg); + } } } } From 8673e1335f0771eac364d0a2866f27476d61a58b Mon Sep 17 00:00:00 2001 From: Daniel Singleton <48238314+goodnightdaniel@users.noreply.github.com> Date: Fri, 5 Jul 2024 05:03:01 -0700 Subject: [PATCH 024/177] feat: add Reddit social option (#1836) --- _data/contact.yml | 4 ++++ _data/share.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/_data/contact.yml b/_data/contact.yml index d6819e0d..87df4606 100644 --- a/_data/contact.yml +++ b/_data/contact.yml @@ -30,3 +30,7 @@ # - type: bluesky # icon: 'fa-brands fa-bluesky' # url: '' # Fill with your Bluesky profile link +# +# - type: reddit +# icon: 'fa-brands fa-reddit' +# url: '' # Fill with your Reddit profile link diff --git a/_data/share.yml b/_data/share.yml index 0aa28fd4..04bac44c 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -40,3 +40,7 @@ platforms: # - type: Bluesky # icon: "fa-brands fa-bluesky" # link: "https://bsky.app/intent/compose?text=TITLE%20URL" + # + # - type: Reddit + # icon: "fa-brands fa-square-reddit" + # link: "https://www.reddit.com/submit?url=URL&title=TITLE" From e3a78b6243f7056105d72185bb6e94b436834e5b Mon Sep 17 00:00:00 2001 From: Daniel Singleton <48238314+goodnightdaniel@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:53:02 -0700 Subject: [PATCH 025/177] feat: add Threads social links (#1837) --- _data/contact.yml | 4 ++++ _data/share.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/_data/contact.yml b/_data/contact.yml index 87df4606..ed40acb7 100644 --- a/_data/contact.yml +++ b/_data/contact.yml @@ -34,3 +34,7 @@ # - type: reddit # icon: 'fa-brands fa-reddit' # url: '' # Fill with your Reddit profile link +# +# - type: threads +# icon: 'fa-brands fa-threads' +# url: '' # Fill with your Threads profile link diff --git a/_data/share.yml b/_data/share.yml index 04bac44c..6f975680 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -44,3 +44,7 @@ platforms: # - type: Reddit # icon: "fa-brands fa-square-reddit" # link: "https://www.reddit.com/submit?url=URL&title=TITLE" + # + # - type: Threads + # icon: "fa-brands fa-square-threads" + # link: "https://www.threads.net/intent/post?text=TITLE%20URL" From e4db1a176f3f69f676cbc0bf27b1d5a657ece05e Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Thu, 11 Jul 2024 00:14:47 +0400 Subject: [PATCH 026/177] feat(dev): add vscode tasks (#1843) --- .gitignore | 1 + .vscode/tasks.json | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index 104d0531..5d05699c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ package-lock.json .vscode/* !.vscode/settings.json !.vscode/extensions.json +!.vscode/tasks.json # Misc _sass/dist diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..99ed5c5b --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,64 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run Jekyll Server", + "type": "shell", + "command": "./tools/run.sh", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "detail": "Runs the Jekyll server with live reload." + }, + { + "label": "Build Jekyll Site", + "type": "shell", + "command": "./tools/test.sh", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build the Jekyll site for production." + }, + { + "label": "Build JS (watch)", + "type": "shell", + "command": "npm run watch:js", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build JS files in watch mode." + }, + { + "label": "Build CSS", + "type": "shell", + "command": "npm run build:css", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build CSS files." + }, + { + "label": "Build JS & CSS", + "type": "shell", + "command": "npm run build", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build JS & CSS for production." + }, + { + "label": "Run Jekyll Server + Build JS (watch)", + "dependsOn": ["Run Jekyll Server", "Build JS (watch)"], + "group": { + "kind": "build" + }, + "detail": "Runs both the Jekyll server with live reload and build JS files in watch mode." + } + ] +} From 8c30f0a9c349eb039bc7fa151ed140e2eb26a643 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 12 Jul 2024 02:03:52 +0800 Subject: [PATCH 027/177] build(dev): support for running tasks in macOS --- .vscode/settings.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 787a0c84..1d784c0e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,5 +23,9 @@ "less.validate": false, // Stylint extension settings "stylelint.snippet": ["css", "scss"], - "stylelint.validate": ["css", "scss"] + "stylelint.validate": ["css", "scss"], + // Run tasks in macOS + "terminal.integrated.profiles.osx": { + "zsh": { "path": "/bin/zsh", "args": ["-l", "-i"] } + } } From 979f86cf64e1fcace4231fb070c7e6398fd4e5ec Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Wed, 17 Jul 2024 19:32:48 +0400 Subject: [PATCH 028/177] fix: avoid caching pageviews data (#1849) --- _javascript/pwa/sw.js | 16 ++++++++++++++-- assets/js/data/swconf.js | 26 ++++++++++++++++++-------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/_javascript/pwa/sw.js b/_javascript/pwa/sw.js index bc67bd83..94b64bf7 100644 --- a/_javascript/pwa/sw.js +++ b/_javascript/pwa/sw.js @@ -3,11 +3,23 @@ import { baseurl } from '../../_config.yml'; importScripts(`${baseurl}/assets/js/data/swconf.js`); const purge = swconf.purge; +const interceptor = swconf.interceptor; function verifyUrl(url) { - const requestPath = new URL(url).pathname; + const requestUrl = new URL(url); + const requestPath = requestUrl.pathname; - for (const path of swconf.denyPaths) { + if (!requestUrl.protocol.startsWith('http')) { + return false; + } + + for (const prefix of interceptor.urlPrefixes) { + if (requestUrl.href.startsWith(prefix)) { + return false; + } + } + + for (const path of interceptor.paths) { if (requestPath.startsWith(path)) { return false; } diff --git a/assets/js/data/swconf.js b/assets/js/data/swconf.js index 5c1ed292..798888a9 100644 --- a/assets/js/data/swconf.js +++ b/assets/js/data/swconf.js @@ -22,14 +22,24 @@ const swconf = { {% endfor %} ], - {%- comment -%} The request url with below path will not be cached. {%- endcomment -%} - denyPaths: [ - {% for path in site.pwa.cache.deny_paths %} - {% unless path == empty %} - '{{ path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} - {% endunless %} - {% endfor %} - ], + interceptor: { + {%- comment -%} URLs containing the following paths will not be cached. {%- endcomment -%} + paths: [ + {% for path in site.pwa.cache.deny_paths %} + {% unless path == empty %} + '{{ path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} + {% endunless %} + {% endfor %} + ], + + {%- comment -%} URLs containing the following prefixes will not be cached. {%- endcomment -%} + urlPrefixes: [ + {% if site.analytics.goatcounter.id != nil and site.pageviews.provider == 'goatcounter' %} + 'https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/' + {% endif %} + ] + }, + purge: false {% else %} purge: true From b641b364809ea15c46d16ce1379a267d395d55d0 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 18 Jul 2024 01:20:17 +0800 Subject: [PATCH 029/177] ci: set node version to LTS There are some problems with the latest version. See: https://github.com/cotes2020/jekyll-theme-chirpy/actions/runs/9977150040 --- .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/style-lint.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d0cc84a3..4f2da0e3 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - run: npm install - run: npx semantic-release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca60bd67..50a158b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - name: Build Assets run: npm i && npm run build diff --git a/.github/workflows/style-lint.yml b/.github/workflows/style-lint.yml index a2cf4f69..f84f3bcc 100644 --- a/.github/workflows/style-lint.yml +++ b/.github/workflows/style-lint.yml @@ -18,6 +18,6 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - run: npm i - run: npm test From 5c5910f1fc661ec3dce203ac961c7f64f1991895 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:17:11 +0800 Subject: [PATCH 030/177] fix: remove extra dual-mode images from lightbox (#1883) --- _javascript/modules/components/img-popup.js | 41 +++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/_javascript/modules/components/img-popup.js b/_javascript/modules/components/img-popup.js index b5c7c6ea..6c3e733a 100644 --- a/_javascript/modules/components/img-popup.js +++ b/_javascript/modules/components/img-popup.js @@ -4,12 +4,47 @@ * Dependencies: https://github.com/biati-digital/glightbox */ -const IMG_CLASS = 'popup'; +const html = document.documentElement; +const lightImages = '.popup:not(.dark)'; +const darkImages = '.popup:not(.light)'; +let selector = lightImages; + +function updateImages(lightbox) { + if (selector === lightImages) { + selector = darkImages; + } else { + selector = lightImages; + } + + lightbox.destroy(); + lightbox = GLightbox({ selector: `${selector}` }); +} export function imgPopup() { - if (document.getElementsByClassName(IMG_CLASS).length === 0) { + if (document.querySelector('.popup') === null) { return; } - GLightbox({ selector: `.${IMG_CLASS}` }); + if ( + (html.hasAttribute('data-mode') && + html.getAttribute('data-mode') === 'dark') || + (!html.hasAttribute('data-mode') && + window.matchMedia('(prefers-color-scheme: dark)').matches) + ) { + selector = darkImages; + } + + let lightbox = GLightbox({ selector: `${selector}` }); + + if (document.getElementById('mode-toggle')) { + window.addEventListener('message', (event) => { + if ( + event.source === window && + event.data && + event.data.direction === ModeToggle.ID + ) { + updateImages(lightbox); + } + }); + } } From 35fdea0c4fa6faa927dd1346b1def9d6531ce003 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:25:55 +0800 Subject: [PATCH 031/177] docs: add devcontainers tutorial (#1844) --- _posts/2019-08-09-getting-started.md | 90 +++++++++++++++------------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 3cad3839..6cbd4e69 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -11,51 +11,60 @@ pin: true media_subpath: '/posts/20180809' --- -## Prerequisites +## Creating a site repository -Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of the basic environment. [Git](https://git-scm.com/) also needs to be installed. +There are two methods to create a site repository for **Chirpy**: -## Installation +- [**Using the starter**](#option-1-using-the-starter) — This approach simplifies upgrades and isolates unnecessary project files, enabling you to concentrate on your content. It's ideal for those who want a hassle-free setup focused primarily on writing. +- [**Forking the theme**](#option-2-forking-the-theme) — This method allows for customization and development but presents challenges during upgrades. It is not recommended to use this approach unless you are familiar with Jekyll and plan to modify this project. -### Creating a New Site +### Option 1: using the starter -There are two ways to create a new repository for this theme: +1. Sign in to GitHub and navigate to the [**starter**][starter]. +2. Click the Use this template button and then select Create a new repository. -- [**Using the Chirpy Starter**](#option-1-using-the-chirpy-starter) — Easy to upgrade, isolates irrelevant project files so you can focus on writing. -- [**GitHub Fork**](#option-2-github-fork) — Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended. +### Option 2: forking the theme -#### Option 1. Using the Chirpy Starter +Sign in to GitHub and [fork the theme](https://github.com/cotes2020/jekyll-theme-chirpy/fork). -Sign in to GitHub and browse to [**Chirpy Starter**][starter], click the button Use this template > Create a new repository, and name the new repository `USERNAME.github.io`, where `USERNAME` represents your GitHub username. +## Name your new repository -#### Option 2. GitHub Fork +Rename your repository to `.github.io`. The `username` represents your lowercase GitHub username. -Sign in to GitHub to [fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), and then rename it to `USERNAME.github.io` (`USERNAME` means your username). +## Setting up the environment -Next, clone the repository to your local machine, make sure it has [Node.js][nodejs] installed, then go to the root directory of the repo and run the following command: +The easiest way to set up the runtime environment, especially on Windows, is by using [Dev Containers](#setting-up-in-dev-containers). This method installs all packages within a Docker container, isolating them from the host machine and ensuring no interference with existing settings. -```console -$ bash tools/init.sh -``` +For Unix-like systems, besides using Dev Containers, you can also [natively set up](#setting-up-natively) the runtime environment to achieve optimal performance. + +### Setting up in Dev Containers -> If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. -{: .prompt-info } +1. Install Docker: + - On Windows/macOS, install [Docker Desktop][docker-desktop]. + - On Linux, install [Docker Engine][docker-engine]. +2. Install [VS Code][vscode] and the [Dev Containers extension][dev-containers]. +3. Clone your repository: + - For Docker Desktop: Start VS Code and [clone your repo in a container volume][dc-clone-in-vol]. + - For Docker Engine: Clone your repo to the local disk, then launch VS Code and [open your repo in the container][dc-open-in-container]. +4. Wait a few minutes for Dev Containers to finish installing. -The above command will: +### Setting up natively -1. Check out the code to the [latest tag][latest-tag] (to ensure the stability of your site: as the code for the default branch is under development). -2. Remove non-essential sample files and take care of GitHub-related files. -3. Build CSS/JS assets files and then make them tracked by Git. -4. Automatically create a new commit to save the changes above. +1. Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of the basic environment. Ensure that [Git](https://git-scm.com/) is also installed. +2. Clone your repository to a local disk. +3. If your site is created by forking the theme, install [Node.js][nodejs] and run `bash tools/init.sh` in the root directory. This will initialize the repository files and create a commit to save the changes. +4. Install the dependencies by running `bundle`. -### Installing Dependencies +### Start the local server -Before running local server for the first time, go to the root directory of your site and run: +To run the site locally, use the following command: ```console -$ bundle +$ bundle exec jekyll s ``` +After a few seconds, the local server will be available at . + ## Usage ### Configuration @@ -67,31 +76,21 @@ Update the variables in `_config.yml`{: .filepath} as needed. Some typical optio - `timezone` - `lang` -### Social Contact Options +### Social contact options Social contact options are displayed at the bottom of the sidebar. You can enable or disable specific contacts in the `_data/contact.yml`{: .filepath} file. -### Customizing the Stylesheet +### Customizing the stylesheet To customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} file to the same path in your Jekyll site, and add your custom styles at the end of the file. Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main SASS file `_sass/main.scss`{: .filepath} to the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign your new values there. -### Customizing Static Assets - -Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on to the network conditions in the region where your website is published. +### Customizing static assets -Also, if you'd like to self-host the static assets, please refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme). - -### Running Local Server - -You may want to preview the site contents before publishing, so just run it by: - -```console -$ bundle exec jekyll s -``` +Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on the network conditions in the region where your website is published. -After a few seconds, the local service will be published at __. +If you prefer to self-host the static assets, refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme) repository. ## Deployment @@ -99,7 +98,7 @@ Before deploying, check the `_config.yml`{: .filepath} file and ensure the `url` Now you can choose _ONE_ of the following methods to deploy your Jekyll site. -### Deploy Using GitHub Actions +### Deploy using GitHub Actions Prepare the following: @@ -120,7 +119,7 @@ Next, configure the _Pages_ service: You can now visit the URL provided by GitHub to access your site. -### Manual Build and Deployment +### Manual build and deployment For self-hosted servers, you will need to build the site on your local machine and then upload the site files to the server. @@ -135,4 +134,9 @@ Unless you specified the output path, the generated site files will be placed in [nodejs]: https://nodejs.org/ [starter]: https://github.com/cotes2020/chirpy-starter [pages-workflow-src]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow -[latest-tag]: https://github.com/cotes2020/jekyll-theme-chirpy/tags +[docker-desktop]: https://www.docker.com/products/docker-desktop/ +[docker-engine]: https://docs.docker.com/engine/install/ +[vscode]: https://code.visualstudio.com/ +[dev-containers]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers +[dc-clone-in-vol]: https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume +[dc-open-in-container]: https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container From e347d0632f063b514a030f85f9900bee8397f1cc Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:43:38 +0800 Subject: [PATCH 032/177] build: update ruby version requirements `html-proofer` 5.x requires Ruby `>= 3.1, < 4.0` --- jekyll-theme-chirpy.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 2c77572b..a1b97cc2 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| "plugin_type" => "theme" } - spec.required_ruby_version = ">= 3.0" + spec.required_ruby_version = "~> 3.1" spec.add_runtime_dependency "jekyll", "~> 4.3" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" From 23729c9c8f2c803a839d5579d954efd85abf82c5 Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Fri, 9 Aug 2024 01:24:30 -0400 Subject: [PATCH 033/177] refactor: update the sass mixed declarations (#1872) See: https://sass-lang.com/d/mixed-decls --- _sass/addon/commons.scss | 22 +++++++++++----------- _sass/addon/syntax.scss | 6 +++--- _sass/colors/typography-dark.scss | 12 ++++++------ _sass/colors/typography-light.scss | 16 ++++++++-------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 4087d241..c4c68e78 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -1,6 +1,8 @@ /* The common styles */ html { + font-size: 16px; + @media (prefers-color-scheme: light) { &:not([data-mode]), &[data-mode='light'] { @@ -22,8 +24,6 @@ html { @include light-scheme; } } - - font-size: 16px; } body { @@ -218,13 +218,13 @@ i { #access-lastmod { a { + color: inherit; + &:hover { @extend %link-hover; } @extend %no-bottom-border; - - color: inherit; } } @@ -682,15 +682,15 @@ $btn-mb: 0.5rem; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border-color); + /* Hide scrollbar for IE, Edge and Firefox */ + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ + /* Hide scrollbar for Chrome, Safari and Opera */ &::-webkit-scrollbar { display: none; } - /* Hide scrollbar for IE, Edge and Firefox */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ - %sidebar-link-hover { &:hover { color: var(--sidebar-active-color); @@ -1036,6 +1036,9 @@ search { padding-bottom: 3rem; a { + font-size: 1.4rem; + line-height: 2.5rem; + &:hover { @extend %link-hover; } @@ -1043,9 +1046,6 @@ search { @extend %link-color; @extend %no-bottom-border; @extend %heading; - - font-size: 1.4rem; - line-height: 2.5rem; } > article { diff --git a/_sass/addon/syntax.scss b/_sass/addon/syntax.scss index 73c66aae..b0efd202 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/addon/syntax.scss @@ -50,13 +50,13 @@ html { @extend %rounded; @extend %code-snippet-bg; + overflow: auto; + padding-bottom: 0.75rem; + @at-root figure#{&} { @extend %code-snippet-bg; } - overflow: auto; - padding-bottom: 0.75rem; - pre { margin-bottom: 0; font-size: $code-font-size; diff --git a/_sass/colors/typography-dark.scss b/_sass/colors/typography-dark.scss index 7d0fd302..12427ec4 100644 --- a/_sass/colors/typography-dark.scss +++ b/_sass/colors/typography-dark.scss @@ -84,27 +84,29 @@ --prompt-danger-bg: rgb(86, 28, 8, 0.8); --prompt-danger-icon-color: #cd0202; - /* tags */ + /* Tags */ --tag-border: rgb(59, 79, 88); --tag-shadow: rgb(32, 33, 33); --dash-color: rgb(63, 65, 68); --search-tag-bg: #292828; - /* categories */ + /* Categories */ --categories-border: rgb(64, 66, 69, 0.5); --categories-hover-bg: rgb(73, 75, 76); --categories-icon-hover-color: white; - /* archives */ + /* Archive */ --timeline-node-bg: rgb(150, 152, 156); --timeline-color: rgb(63, 65, 68); --timeline-year-dot-color: var(--timeline-color); + color-scheme: dark; + .light { display: none; } - /* categories */ + /* Categories */ .categories.card, .list-group-item { background-color: var(--card-bg); @@ -138,8 +140,6 @@ ); } - color-scheme: dark; - /* stylelint-disable-next-line selector-id-pattern */ #disqus_thread { color-scheme: none; diff --git a/_sass/colors/typography-light.scss b/_sass/colors/typography-light.scss index 557f937d..78000746 100644 --- a/_sass/colors/typography-light.scss +++ b/_sass/colors/typography-light.scss @@ -92,14 +92,6 @@ --tag-hover: rgb(222, 226, 230); --search-tag-bg: #f8f9fa; - [class^='prompt-'] { - --link-underline-color: rgb(219, 216, 216); - } - - .dark { - display: none; - } - /* Categories */ --categories-border: rgba(0, 0, 0, 0.125); --categories-hover-bg: var(--btn-border-color); @@ -109,4 +101,12 @@ --timeline-color: rgba(0, 0, 0, 0.075); --timeline-node-bg: #c2c6cc; --timeline-year-dot-color: #ffffff; + + [class^='prompt-'] { + --link-underline-color: rgb(219, 216, 216); + } + + .dark { + display: none; + } } /* light-scheme */ From d74bfaeda25f5b75d665b99b38b44f6f8dc98df1 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 13 Aug 2024 13:50:40 +0800 Subject: [PATCH 034/177] chore(tools): improve the init-script --- tools/init.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/init.sh b/tools/init.sh index c0c4e183..603e5175 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -80,13 +80,13 @@ init_files() { rm -rf .github && mkdir -p .github/workflows mv "$temp/$ACTIONS_WORKFLOW" .github/workflows/"$ACTIONS_WORKFLOW" rm -rf "$temp" - - ## Cleanup image settings in site config - _sedi "s/(^timezone:).*/\1/;s/(^.*cdn:).*/\1/;s/(^avatar:).*/\1/" _config.yml fi + # Cleanup image settings in site config + _sedi "s/(^timezone:).*/\1/;s/(^.*cdn:).*/\1/;s/(^avatar:).*/\1/" _config.yml + # remove the other files - rm -rf _posts/* + rm -rf tools/init.sh tools/release.sh _posts/* # build assets npm i && npm run build From 7f83c3d00dd2a535c847d162d6c17d695f45eb0d Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:05:39 +0800 Subject: [PATCH 035/177] refactor: improve the efficiency of `GLightbox` switching Repeatedly using `GLightbox.destroy()` (>= 4 times) will cause `GLightbox` to fail to generate new objects --- _javascript/modules/components/img-popup.js | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/_javascript/modules/components/img-popup.js b/_javascript/modules/components/img-popup.js index 6c3e733a..ac120435 100644 --- a/_javascript/modules/components/img-popup.js +++ b/_javascript/modules/components/img-popup.js @@ -9,15 +9,18 @@ const lightImages = '.popup:not(.dark)'; const darkImages = '.popup:not(.light)'; let selector = lightImages; -function updateImages(lightbox) { +function updateImages(current, reverse) { if (selector === lightImages) { selector = darkImages; } else { selector = lightImages; } - lightbox.destroy(); - lightbox = GLightbox({ selector: `${selector}` }); + if (reverse === null) { + reverse = GLightbox({ selector: `${selector}` }); + } + + [current, reverse] = [reverse, current]; } export function imgPopup() { @@ -25,6 +28,11 @@ export function imgPopup() { return; } + const hasDualImages = !( + document.querySelector('.popup.light') === null && + document.querySelector('.popup.dark') === null + ); + if ( (html.hasAttribute('data-mode') && html.getAttribute('data-mode') === 'dark') || @@ -34,16 +42,18 @@ export function imgPopup() { selector = darkImages; } - let lightbox = GLightbox({ selector: `${selector}` }); + let current = GLightbox({ selector: `${selector}` }); + + if (hasDualImages && document.getElementById('mode-toggle')) { + let reverse = null; - if (document.getElementById('mode-toggle')) { window.addEventListener('message', (event) => { if ( event.source === window && event.data && event.data.direction === ModeToggle.ID ) { - updateImages(lightbox); + updateImages(current, reverse); } }); } From efd2941ce08f8bb2a56e543ee04da7525c2bacc7 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:28:14 +0800 Subject: [PATCH 036/177] build: resume platform-specific dependencies --- Gemfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 672e9e4b..66f9337d 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,11 @@ source "https://rubygems.org" gemspec -group :test do - gem "html-proofer", "~> 5.0" +gem "html-proofer", "~> 5.0", group: :test + +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" end + +gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] From 99eaf6089ecc663730f638c699969250d0f406b5 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:28:57 +0800 Subject: [PATCH 037/177] chore: remove duplicate config --- .vscode/settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1d784c0e..5e8a04f3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,6 @@ // Prettier "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, - "prettier.trailingComma": "none", // Shopify Liquid "files.associations": { "*.html": "liquid" From bf6c996c4ea69c2be2deda4d8606de776f6689b5 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:31:22 +0800 Subject: [PATCH 038/177] chore: move entries in git-ignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5d05699c..b528d6d1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ Gemfile.lock .jekyll-cache .jekyll-metadata _site -_app # RubyGems *.gem @@ -26,3 +25,4 @@ package-lock.json # Misc _sass/dist assets/js/dist +_app From befc4ce9c5026f67f99bce66e223d056229f0bdb Mon Sep 17 00:00:00 2001 From: Julius Gamanyi <85777+juliusgb@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:21:29 +0200 Subject: [PATCH 039/177] feat(analytics): add fathom analytics (#1913) --- _config.yml | 2 ++ _includes/analytics/fathom.html | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 _includes/analytics/fathom.html diff --git a/_config.yml b/_config.yml index d862178c..fea93d3f 100644 --- a/_config.yml +++ b/_config.yml @@ -70,6 +70,8 @@ analytics: domain: # fill in your Matomo domain cloudflare: id: # fill in your Cloudflare Web Analytics token + fathom: + id: # fill in your Fathom Site ID # Page views settings pageviews: diff --git a/_includes/analytics/fathom.html b/_includes/analytics/fathom.html new file mode 100644 index 00000000..4b603d3a --- /dev/null +++ b/_includes/analytics/fathom.html @@ -0,0 +1,7 @@ + + + From 80bd7928a02c75c843a550bd377d11b574e8bfda Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 24 Aug 2024 22:27:35 +0800 Subject: [PATCH 040/177] feat(ui): improve block quote layout --- _sass/addon/commons.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index c4c68e78..5412b92f 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -80,9 +80,10 @@ img { } blockquote { - border-left: 5px solid var(--blockquote-border-color); + border-left: 0.125rem solid var(--blockquote-border-color); padding-left: 1rem; color: var(--blockquote-text-color); + margin-top: 0.5rem; > p:last-child { margin-bottom: 0; From 707a209424f3a82868935dd46591c318e700355c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:12:00 +0800 Subject: [PATCH 041/177] refactor: improve heading layout --- _sass/addon/commons.scss | 21 +++++++++++++++------ _sass/addon/module.scss | 11 ----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 5412b92f..2735eb87 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -42,20 +42,29 @@ body { @extend %heading; @if $i > 1 { - @extend %section; @extend %anchor; } @if $i < 5 { - $factor: 0.18rem; + $size-factor: 0.25rem; - @if $i == 1 { - $factor: 0.23rem; + @if $i > 1 { + $size-factor: 0.18rem; + + main & { + @if $i == 2 { + margin: 2.5rem 0 1.25rem; + } @else { + margin: 2rem 0 1rem; + } + } } - font-size: 1rem + (5 - $i) * $factor; + & { + font-size: 1rem + (5 - $i) * $size-factor; + } } @else { - font-size: 1rem; + font-size: 1.05rem; } } } diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index 9e85adc0..77fecca4 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -10,17 +10,6 @@ font-family: $font-family-heading; } -%section { - main & { - margin-top: 2.5rem; - margin-bottom: 1.25rem; - - &:focus { - outline: none; /* avoid outline in Safari */ - } - } -} - %anchor { .anchor { font-size: 80%; From 64c7262245e878534971a2e3a2630b614daf72f3 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:12:28 +0800 Subject: [PATCH 042/177] feat(ui): set `` font to 'Lato' --- _sass/addon/commons.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 2735eb87..c6aa02fe 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -124,7 +124,7 @@ blockquote { } kbd { - font-family: inherit; + font-family: Lato, sans-serif; display: inline-block; vertical-align: middle; line-height: 1.3rem; From 8cfd7214943806925342613d9107473de53f6524 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:25:29 +0800 Subject: [PATCH 043/177] build(deps-dev): bump the dev-deps --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 7d4835f3..a73fee71 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,10 @@ "bootstrap": "^5.3.3" }, "devDependencies": { - "@babel/core": "^7.24.7", - "@babel/plugin-transform-class-properties": "^7.24.7", - "@babel/preset-env": "^7.24.7", - "@commitlint/cli": "^19.3.0", + "@babel/core": "^7.25.2", + "@babel/plugin-transform-class-properties": "^7.25.4", + "@babel/preset-env": "^7.25.4", + "@commitlint/cli": "^19.4.0", "@commitlint/config-conventional": "^19.2.2", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-node-resolve": "^15.2.3", @@ -42,11 +42,11 @@ "@semantic-release/git": "^10.0.1", "concurrently": "^8.2.2", "conventional-changelog-conventionalcommits": "^8.0.0", - "husky": "^9.0.11", + "husky": "^9.1.5", "purgecss": "^6.0.0", - "rollup": "^4.18.0", - "semantic-release": "^24.0.0", - "stylelint": "^16.6.1", + "rollup": "^4.21.0", + "semantic-release": "^24.1.0", + "stylelint": "^16.8.2", "stylelint-config-standard-scss": "^13.1.0" }, "prettier": { From 5f4dab1745059929b04d7e998e8dbccd2a741b9c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 01:18:34 +0800 Subject: [PATCH 044/177] build: upgrade dependencies --- _data/origin/basic.yml | 6 +++--- _data/origin/cors.yml | 16 ++++++++-------- assets/lib | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/_data/origin/basic.yml b/_data/origin/basic.yml index 9027e6e4..2d529822 100644 --- a/_data/origin/basic.yml +++ b/_data/origin/basic.yml @@ -20,9 +20,9 @@ mermaid: dayjs: js: common: /assets/lib/dayjs/dayjs.min.js - locale: /assets/lib/dayjs/locale/en.min.js - relativeTime: /assets/lib/dayjs/plugin/relativeTime.min.js - localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.min.js + locale: /assets/lib/dayjs/locale/en.js + relativeTime: /assets/lib/dayjs/plugin/relativeTime.js + localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.js glightbox: css: /assets/lib/glightbox/glightbox.min.css diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index 18806665..aff32f71 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -20,24 +20,24 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour # Libraries toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.29.20/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.29.20/dist/tocbot.min.js fontawesome: - css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css + css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/all.min.css search: js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js mermaid: - js: https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js + js: https://cdn.jsdelivr.net/npm/mermaid@11.0.2/dist/mermaid.min.js dayjs: js: - common: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/dayjs.min.js - locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/locale/:LOCALE.min.js - relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/relativeTime.min.js - localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/localizedFormat.min.js + common: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/dayjs.min.js + locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/locale/:LOCALE.js + relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/relativeTime.js + localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/localizedFormat.js glightbox: css: https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/css/glightbox.min.css diff --git a/assets/lib b/assets/lib index b9c58cf4..8d23eb0c 160000 --- a/assets/lib +++ b/assets/lib @@ -1 +1 @@ -Subproject commit b9c58cf485a7dcbc833e698d67dd1850bdc93eb3 +Subproject commit 8d23eb0c91f38ff0162be118bb9c9517f8675cd6 From 31e19c6d0ff0e4c11dfbf39caf0f49ad83f4074e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:17:38 +0800 Subject: [PATCH 045/177] refactor(ui): standardize the border radius (#1920) Impact: - Increase the border radius of inline code and `` tags - Variable `$base-radius` renamed to `$radius-lg` --- _sass/addon/commons.scss | 2 +- _sass/addon/module.scss | 2 +- _sass/addon/syntax.scss | 6 +++--- _sass/addon/variables.scss | 3 ++- _sass/layout/categories.scss | 2 +- _sass/layout/home.scss | 4 ++-- _sass/layout/post.scss | 4 ++-- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index c6aa02fe..465cb085 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -134,7 +134,7 @@ kbd { padding-top: 0.1rem; color: var(--kbd-text-color); background-color: var(--kbd-bg-color); - border-radius: 0.25rem; + border-radius: $radius-sm; border: solid 1px var(--kbd-wrap-color); box-shadow: inset 0 -2px 0 var(--kbd-wrap-color); } diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index 77fecca4..42db4e2d 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -81,7 +81,7 @@ } %rounded { - border-radius: $base-radius; + border-radius: $radius-lg; } %img-caption { diff --git a/_sass/addon/syntax.scss b/_sass/addon/syntax.scss index b0efd202..6bd7b406 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/addon/syntax.scss @@ -102,9 +102,9 @@ code { &.highlighter-rouge { font-size: $code-font-size; - padding: 3px 6px; + padding: 3px 5px; word-break: break-word; - border-radius: 4px; + border-radius: $radius-sm; background-color: var(--inline-code-bg); } @@ -261,7 +261,7 @@ div { .content > & { @include ml-mr(0); - border-radius: $base-radius; + border-radius: $radius-lg; } .code-header { diff --git a/_sass/addon/variables.scss b/_sass/addon/variables.scss index 8924a00b..1d51cb14 100644 --- a/_sass/addon/variables.scss +++ b/_sass/addon/variables.scss @@ -16,7 +16,8 @@ $search-max-width: 200px !default; $footer-height: 5rem !default; $footer-height-large: 6rem !default; /* screen width: < 850px */ $main-content-max-width: 1250px !default; -$base-radius: 0.625rem !default; +$radius-sm: 6px !default; +$radius-lg: 10px !default; $back2top-size: 2.75rem !default; /* syntax highlight */ diff --git a/_sass/layout/categories.scss b/_sass/layout/categories.scss index 330d3d35..f12b9633 100644 --- a/_sass/layout/categories.scss +++ b/_sass/layout/categories.scss @@ -16,7 +16,7 @@ } .card-header { - $radius: calc($base-radius - 1px); + $radius: calc($radius-lg - 1px); padding: 0.75rem; border-radius: $radius; diff --git a/_sass/layout/home.scss b/_sass/layout/home.scss index 7f9fd2e8..0d95d7ba 100644 --- a/_sass/layout/home.scss +++ b/_sass/layout/home.scss @@ -20,7 +20,7 @@ background: none; %img-radius { - border-radius: $base-radius $base-radius 0 0; + border-radius: $radius-lg $radius-lg 0 0; } .preview-img { @@ -131,7 +131,7 @@ /* Tablet */ @media all and (min-width: 768px) { %img-radius { - border-radius: 0 $base-radius $base-radius 0; + border-radius: 0 $radius-lg $radius-lg 0; } #post-list { diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index 112541db..815db933 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -173,12 +173,12 @@ header { } &:first-child { - border-radius: $base-radius 0 0 $base-radius; + border-radius: $radius-lg 0 0 $radius-lg; left: 0.5px; } &:last-child { - border-radius: 0 $base-radius $base-radius 0; + border-radius: 0 $radius-lg $radius-lg 0; right: 0.5px; } } From 604e01eb3670c380a4c610552c02a607d12552f8 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 26 Aug 2024 00:49:05 +0800 Subject: [PATCH 046/177] chore(deps): correct `Tocbot` version number --- _data/origin/cors.yml | 4 ++-- assets/lib | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index aff32f71..afdb3d9e 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -20,8 +20,8 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour # Libraries toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.29.20/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.29.20/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.js fontawesome: css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/all.min.css diff --git a/assets/lib b/assets/lib index 8d23eb0c..a231bc7e 160000 --- a/assets/lib +++ b/assets/lib @@ -1 +1 @@ -Subproject commit 8d23eb0c91f38ff0162be118bb9c9517f8675cd6 +Subproject commit a231bc7e2c67198e604950cb2be9147a0b2020c0 From fc3d1012584e70db572f72894c427ecef20cdfa0 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:49:48 +0800 Subject: [PATCH 047/177] build: improve the JS build for PWA (#1923) --- .gitignore | 1 - _config.yml | 3 --- jekyll-theme-chirpy.gemspec | 2 +- rollup.config.js | 44 +++++++++++++++++++++---------------- tools/init.sh | 2 +- tools/release.sh | 3 +-- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index b528d6d1..0082d900 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,3 @@ package-lock.json # Misc _sass/dist assets/js/dist -_app diff --git a/_config.yml b/_config.yml index fea93d3f..7a9b11a3 100644 --- a/_config.yml +++ b/_config.yml @@ -170,9 +170,6 @@ collections: tabs: output: true sort_by: order - app: - output: true - permalink: /:name defaults: - scope: diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index a1b97cc2..76ebe673 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").select { |f| - f.match(%r!^((_(includes|layouts|sass|app|(data\/(locales|origin)))|assets)\/|README|LICENSE)!i) + f.match(%r!^((_(includes|layouts|sass|(data\/(locales|origin)))|assets)\/|README|LICENSE)!i) } spec.metadata = { diff --git a/rollup.config.js b/rollup.config.js index 94507b92..22016b04 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,35 +6,40 @@ import fs from 'fs'; import pkg from './package.json'; const SRC_DEFAULT = '_javascript'; -const DIST_DEFAULT = 'assets/js/dist'; - const SRC_PWA = `${SRC_DEFAULT}/pwa`; -const DIST_PWA = '_app'; +const DIST = 'assets/js/dist'; const banner = `/*! * ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage} */`; +const frontmatter = `---\npermalink: /:basename\n---\n`; + const isProd = process.env.BUILD === 'production'; -function cleanup(...directories) { - for (const dir of directories) { - fs.rm(dir, { recursive: true, force: true }, (err) => { - if (err) { - console.error(`Failed to remove directory ${dir}: ${err}`); - } - }); - } +function cleanup() { + fs.rmSync(DIST, { recursive: true, force: true }); + console.log(`> Directory "${DIST}" has been cleaned.`); } -function build(filename, opts = {}) { - const src = opts.src || SRC_DEFAULT; - const dist = opts.dist || DIST_DEFAULT; +function insertFrontmatter() { + return { + name: 'insert-frontmatter', + generateBundle(_, bundle) { + for (const chunkOrAsset of Object.values(bundle)) { + if (chunkOrAsset.type === 'chunk') { + chunkOrAsset.code = frontmatter + chunkOrAsset.code; + } + } + } + }; +} +function build(filename, { src = SRC_DEFAULT, jekyll = false } = {}) { return { input: `${src}/${filename}.js`, output: { - file: `${dist}/${filename}.min.js`, + file: `${DIST}/${filename}.min.js`, format: 'iife', name: 'Chirpy', banner, @@ -51,12 +56,13 @@ function build(filename, opts = {}) { }), nodeResolve(), yaml(), - isProd && terser() + isProd && terser(), + jekyll && insertFrontmatter() ] }; } -cleanup(DIST_DEFAULT, DIST_PWA); +cleanup(); export default [ build('commons'), @@ -65,6 +71,6 @@ export default [ build('page'), build('post'), build('misc'), - build('app', { src: SRC_PWA, dist: DIST_PWA }), - build('sw', { src: SRC_PWA, dist: DIST_PWA }) + build('app', { src: SRC_PWA, jekyll: true }), + build('sw', { src: SRC_PWA, jekyll: true }) ]; diff --git a/tools/init.sh b/tools/init.sh index 603e5175..2ad72ab9 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -92,7 +92,7 @@ init_files() { npm i && npm run build # track the CSS/JS output - _sedi "/.*\/dist$/d;/^_app$/d" .gitignore + _sedi "/.*\/dist$/d" .gitignore } commit() { diff --git a/tools/release.sh b/tools/release.sh index e505f1a2..522c892c 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -17,7 +17,6 @@ CONFIG="_config.yml" CSS_DIST="_sass/dist" JS_DIST="assets/js/dist" -PWA_DIST="_app" FILES=( "$GEM_SPEC" @@ -118,7 +117,7 @@ build_gem() { npm run build # add CSS/JS distribution files to gem package - git add "$CSS_DIST" "$JS_DIST" "$PWA_DIST" -f + git add "$CSS_DIST" "$JS_DIST" -f echo -e "\n> gem build $GEM_SPEC\n" gem build "$GEM_SPEC" From 8b7dba71e34531bfa38d6a3b2d1118a83bbf959a Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:18:52 +0800 Subject: [PATCH 048/177] docs: update tutorial and readme Change Dev Containers logo in README: Simple Icons has removed all Microsoft icons due to copyright restrictions, see --- README.md | 8 ++-- _posts/2019-08-09-getting-started.md | 67 ++++++++++++++++------------ 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 32210f53..7e57b2a5 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=visualstudiocode)][open-container]  - [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=tomato)][gem]  - [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license]  [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]  - [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy] + [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy]  + [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy?color=goldenrod)][license]  + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=orange)][gem]  + [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=linuxcontainers)][open-container] [**Live Demo** →][demo] diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 6cbd4e69..3b41a3ca 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -11,33 +11,35 @@ pin: true media_subpath: '/posts/20180809' --- -## Creating a site repository +## Creating a Site Repository -There are two methods to create a site repository for **Chirpy**: +When creating your site repository, you have two options depending on your needs: -- [**Using the starter**](#option-1-using-the-starter) — This approach simplifies upgrades and isolates unnecessary project files, enabling you to concentrate on your content. It's ideal for those who want a hassle-free setup focused primarily on writing. -- [**Forking the theme**](#option-2-forking-the-theme) — This method allows for customization and development but presents challenges during upgrades. It is not recommended to use this approach unless you are familiar with Jekyll and plan to modify this project. +### Option 1. Using the Starter (Recommended) -### Option 1: using the starter +This approach simplifies upgrades, isolates unnecessary files, and is perfect for users who want to focus on writing with minimal configuration. 1. Sign in to GitHub and navigate to the [**starter**][starter]. 2. Click the Use this template button and then select Create a new repository. +3. Name the new repository `.github.io`, replacing `username` with your lowercase GitHub username. -### Option 2: forking the theme +### Option 2. Forking the Theme -Sign in to GitHub and [fork the theme](https://github.com/cotes2020/jekyll-theme-chirpy/fork). +This approach is convenient for modifying features or UI design, but presents challenges during upgrades. So don't try this unless you are familiar with Jekyll and plan to heavily modify this theme. -## Name your new repository +1. Sign in to GitHub. +2. [Fork the theme repository](https://github.com/cotes2020/jekyll-theme-chirpy/fork). +3. Name the new repository `.github.io`, replacing `username` with your lowercase GitHub username. -Rename your repository to `.github.io`. The `username` represents your lowercase GitHub username. +## Setting up the Environment -## Setting up the environment +Once your repository is created, it's time to set up your development environment. There are two primary methods: -The easiest way to set up the runtime environment, especially on Windows, is by using [Dev Containers](#setting-up-in-dev-containers). This method installs all packages within a Docker container, isolating them from the host machine and ensuring no interference with existing settings. +### Using Dev Containers (Recommended for Windows) -For Unix-like systems, besides using Dev Containers, you can also [natively set up](#setting-up-natively) the runtime environment to achieve optimal performance. +Dev Containers offer an isolated environment using Docker, which prevents conflicts with your system and ensures all dependencies are managed within the container. -### Setting up in Dev Containers +**Steps**: 1. Install Docker: - On Windows/macOS, install [Docker Desktop][docker-desktop]. @@ -45,27 +47,34 @@ For Unix-like systems, besides using Dev Containers, you can also [natively set 2. Install [VS Code][vscode] and the [Dev Containers extension][dev-containers]. 3. Clone your repository: - For Docker Desktop: Start VS Code and [clone your repo in a container volume][dc-clone-in-vol]. - - For Docker Engine: Clone your repo to the local disk, then launch VS Code and [open your repo in the container][dc-open-in-container]. -4. Wait a few minutes for Dev Containers to finish installing. + - For Docker Engine: Clone your repo locally, then [open it in a container][dc-open-in-container] via VS Code. +4. Wait for the Dev Containers setup to complete. -### Setting up natively +### Setting up Natively (Recommended for Unix-like OS) -1. Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of the basic environment. Ensure that [Git](https://git-scm.com/) is also installed. -2. Clone your repository to a local disk. -3. If your site is created by forking the theme, install [Node.js][nodejs] and run `bash tools/init.sh` in the root directory. This will initialize the repository files and create a commit to save the changes. -4. Install the dependencies by running `bundle`. +For Unix-like systems, you can set up the environment natively for optimal performance, though you can also use Dev Containers as an alternative. -### Start the local server +**Steps**: + +1. Follow the [Jekyll installation guide](https://jekyllrb.com/docs/installation/) to install Jekyll and ensure [Git](https://git-scm.com/) is installed. +2. Clone your repository to your local machine. +3. If you forked the theme, install [Node.js][nodejs] and run `bash tools/init.sh` in the root directory to initialize the repository. +4. Run command `bundle` in the root of your repository to install the dependencies. + +## Usage + +### Start the Jekyll Server To run the site locally, use the following command: -```console +```terminal $ bundle exec jekyll s ``` -After a few seconds, the local server will be available at . +> If you are using Dev Containers, you must run that command in the **VS Code** Terminal. +{: .prompt-info } -## Usage +After a few seconds, the local server will be available at . ### Configuration @@ -76,17 +85,17 @@ Update the variables in `_config.yml`{: .filepath} as needed. Some typical optio - `timezone` - `lang` -### Social contact options +### Social Contact Options Social contact options are displayed at the bottom of the sidebar. You can enable or disable specific contacts in the `_data/contact.yml`{: .filepath} file. -### Customizing the stylesheet +### Customizing the Stylesheet To customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} file to the same path in your Jekyll site, and add your custom styles at the end of the file. Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main SASS file `_sass/main.scss`{: .filepath} to the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign your new values there. -### Customizing static assets +### Customizing Static Assets Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on the network conditions in the region where your website is published. @@ -98,7 +107,7 @@ Before deploying, check the `_config.yml`{: .filepath} file and ensure the `url` Now you can choose _ONE_ of the following methods to deploy your Jekyll site. -### Deploy using GitHub Actions +### Deploy Using Github Actions Prepare the following: @@ -119,7 +128,7 @@ Next, configure the _Pages_ service: You can now visit the URL provided by GitHub to access your site. -### Manual build and deployment +### Manual Build and Deployment For self-hosted servers, you will need to build the site on your local machine and then upload the site files to the server. From a784f0a0f907797104cc5e3b5256151ad4055645 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 27 Aug 2024 07:28:55 +0000 Subject: [PATCH 049/177] chore(release): 7.1.0 ## [7.1.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.0.1...v7.1.0) (2024-08-27) ### Features * add Bluesky social links ([#1759](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1759)) ([0102aba](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0102abae062be24ec289fb7facb11950aca79e3f)) * add Reddit social option ([#1836](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1836)) ([8673e13](https://github.com/cotes2020/jekyll-theme-chirpy/commit/8673e1335f0771eac364d0a2866f27476d61a58b)) * add Threads social links ([#1837](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1837)) ([e3a78b6](https://github.com/cotes2020/jekyll-theme-chirpy/commit/e3a78b6243f7056105d72185bb6e94b436834e5b)) * **analytics:** add fathom analytics ([#1913](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1913)) ([befc4ce](https://github.com/cotes2020/jekyll-theme-chirpy/commit/befc4ce9c5026f67f99bce66e223d056229f0bdb)) * **dev:** add vscode tasks ([#1843](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1843)) ([e4db1a1](https://github.com/cotes2020/jekyll-theme-chirpy/commit/e4db1a176f3f69f676cbc0bf27b1d5a657ece05e)) * **dev:** support vscode dev-container ([#1781](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1781)) ([1e3d4a6](https://github.com/cotes2020/jekyll-theme-chirpy/commit/1e3d4a6323ba3eed06a57f8bf1b2edefd890b127)) * **ui:** improve block quote layout ([80bd792](https://github.com/cotes2020/jekyll-theme-chirpy/commit/80bd7928a02c75c843a550bd377d11b574e8bfda)) * **ui:** improve visibility of inline code ([#1831](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1831)) ([c876731](https://github.com/cotes2020/jekyll-theme-chirpy/commit/c876731901784a72ef9d2e9e2936df65ddff5f61)) * **ui:** make `info-prompt` icon looks like the letter "i" ([#1835](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1835)) ([a07a57e](https://github.com/cotes2020/jekyll-theme-chirpy/commit/a07a57ec922249d3a22da56fbcb30d83eadef728)) * **ui:** set `` font to 'Lato' ([64c7262](https://github.com/cotes2020/jekyll-theme-chirpy/commit/64c7262245e878534971a2e3a2630b614daf72f3)) ### Bug Fixes * adapt the giscus localization parameter ([#1810](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1810)) ([0709854](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0709854dc8f6099d38c2578967a02f73b4be0dc8)) * avoid caching pageviews data ([#1849](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1849)) ([979f86c](https://github.com/cotes2020/jekyll-theme-chirpy/commit/979f86cf64e1fcace4231fb070c7e6398fd4e5ec)) * remove extra dual-mode images from lightbox ([#1883](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1883)) ([5c5910f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5c5910f1fc661ec3dce203ac961c7f64f1991895)) --- docs/CHANGELOG.md | 21 +++++++++++++++++++++ jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index abe0a178..5d58c621 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [7.1.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.0.1...v7.1.0) (2024-08-27) + +### Features + +* add Bluesky social links ([#1759](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1759)) ([0102aba](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0102abae062be24ec289fb7facb11950aca79e3f)) +* add Reddit social option ([#1836](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1836)) ([8673e13](https://github.com/cotes2020/jekyll-theme-chirpy/commit/8673e1335f0771eac364d0a2866f27476d61a58b)) +* add Threads social links ([#1837](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1837)) ([e3a78b6](https://github.com/cotes2020/jekyll-theme-chirpy/commit/e3a78b6243f7056105d72185bb6e94b436834e5b)) +* **analytics:** add fathom analytics ([#1913](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1913)) ([befc4ce](https://github.com/cotes2020/jekyll-theme-chirpy/commit/befc4ce9c5026f67f99bce66e223d056229f0bdb)) +* **dev:** add vscode tasks ([#1843](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1843)) ([e4db1a1](https://github.com/cotes2020/jekyll-theme-chirpy/commit/e4db1a176f3f69f676cbc0bf27b1d5a657ece05e)) +* **dev:** support vscode dev-container ([#1781](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1781)) ([1e3d4a6](https://github.com/cotes2020/jekyll-theme-chirpy/commit/1e3d4a6323ba3eed06a57f8bf1b2edefd890b127)) +* **ui:** improve block quote layout ([80bd792](https://github.com/cotes2020/jekyll-theme-chirpy/commit/80bd7928a02c75c843a550bd377d11b574e8bfda)) +* **ui:** improve visibility of inline code ([#1831](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1831)) ([c876731](https://github.com/cotes2020/jekyll-theme-chirpy/commit/c876731901784a72ef9d2e9e2936df65ddff5f61)) +* **ui:** make `info-prompt` icon looks like the letter "i" ([#1835](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1835)) ([a07a57e](https://github.com/cotes2020/jekyll-theme-chirpy/commit/a07a57ec922249d3a22da56fbcb30d83eadef728)) +* **ui:** set `` font to 'Lato' ([64c7262](https://github.com/cotes2020/jekyll-theme-chirpy/commit/64c7262245e878534971a2e3a2630b614daf72f3)) + +### Bug Fixes + +* adapt the giscus localization parameter ([#1810](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1810)) ([0709854](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0709854dc8f6099d38c2578967a02f73b4be0dc8)) +* avoid caching pageviews data ([#1849](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1849)) ([979f86c](https://github.com/cotes2020/jekyll-theme-chirpy/commit/979f86cf64e1fcace4231fb070c7e6398fd4e5ec)) +* remove extra dual-mode images from lightbox ([#1883](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1883)) ([5c5910f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5c5910f1fc661ec3dce203ac961c7f64f1991895)) + ## [7.0.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.0.0...v7.0.1) (2024-05-18) ### Bug Fixes diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 76ebe673..046e8eb3 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-theme-chirpy" - spec.version = "7.0.1" + spec.version = "7.1.0" spec.authors = ["Cotes Chung"] spec.email = ["cotes.chung@gmail.com"] diff --git a/package.json b/package.json index a73fee71..0dbc382a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jekyll-theme-chirpy", - "version": "7.0.1", + "version": "7.1.0", "description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.", "repository": { "type": "git", From 367262e74d1005bddf1328bb2b3a2b9e152c0086 Mon Sep 17 00:00:00 2001 From: denis-games <105583649+denis-games@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:38:46 +0200 Subject: [PATCH 050/177] fix(i18n): correct fr-FR translations (#1949) Co-authored-by: Denis Jean --- _data/locales/fr-FR.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_data/locales/fr-FR.yml b/_data/locales/fr-FR.yml index 3f3c9a0c..dce83c9f 100644 --- a/_data/locales/fr-FR.yml +++ b/_data/locales/fr-FR.yml @@ -14,7 +14,7 @@ tabs: categories: Catégories tags: Tags archives: Archives - about: A propos de + about: À propos # the text displayed in the search bar & search results search: @@ -32,12 +32,12 @@ copyright: license: template: Cet article est sous licence :LICENSE_NAME par l'auteur. name: CC BY 4.0 - link: https://creativecommons.org/licenses/by/4.0/ + link: https://creativecommons.org/licenses/by/4.0/deed.fr # Displayed in the footer brief: Certains droits réservés. verbose: >- - Sauf mention contraire, les articles de ce site sont publiés sous licence + Sauf mention contraire, les articles de ce site sont publiés sous la licence Creative Commons Attribution 4.0 International (CC BY 4.0) par l'auteur. meta: Propulsé par :PLATFORM avec le thème :THEME From 3ab3b844d2ac475c92d5f84afc0259abab9fcbcd Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:41:08 +0800 Subject: [PATCH 051/177] refactor: replace deprecated meta element Replace `apple-mobile-web-app-capable` with `mobile-web-app-capable` --- _includes/head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/head.html b/_includes/head.html index fd260c0e..af3acdb5 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -2,7 +2,7 @@ - + Date: Wed, 18 Sep 2024 22:32:26 +0800 Subject: [PATCH 052/177] fix(pwa): site baseurl not passed to `app.js` (#1955) --- _includes/js-selector.html | 5 ++++- _javascript/pwa/app.js | 12 ++++++++---- _javascript/pwa/sw.js | 4 +--- package.json | 1 - rollup.config.js | 4 +--- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/_includes/js-selector.html b/_includes/js-selector.html index 99651076..4d77d06b 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -92,7 +92,10 @@ {% if jekyll.environment == 'production' %} {% if site.pwa.enabled %} - + {% endif %} diff --git a/_javascript/pwa/app.js b/_javascript/pwa/app.js index c71036a5..3c0ded23 100644 --- a/_javascript/pwa/app.js +++ b/_javascript/pwa/app.js @@ -1,15 +1,19 @@ -import { pwa, baseurl } from '../../_config.yml'; import Toast from 'bootstrap/js/src/toast'; if ('serviceWorker' in navigator) { - if (pwa.enabled) { - const swUrl = `${baseurl}/sw.min.js`; + // Get Jekyll config from URL parameters + const src = new URL(document.currentScript.src); + const register = src.searchParams.get('register'); + const baseUrl = src.searchParams.get('baseurl'); + + if (register) { + const swUrl = `${baseUrl}/sw.min.js`; const notification = document.getElementById('notification'); const btnRefresh = notification.querySelector('.toast-body>button'); const popupWindow = Toast.getOrCreateInstance(notification); navigator.serviceWorker.register(swUrl).then((registration) => { - // In case the user ignores the notification + // Restore the update window that was last manually closed by the user if (registration.waiting) { popupWindow.show(); } diff --git a/_javascript/pwa/sw.js b/_javascript/pwa/sw.js index 94b64bf7..ff9125dd 100644 --- a/_javascript/pwa/sw.js +++ b/_javascript/pwa/sw.js @@ -1,6 +1,4 @@ -import { baseurl } from '../../_config.yml'; - -importScripts(`${baseurl}/assets/js/data/swconf.js`); +importScripts('./assets/js/data/swconf.js'); const purge = swconf.purge; const interceptor = swconf.interceptor; diff --git a/package.json b/package.json index 0dbc382a..bab1a2f6 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-yaml": "^4.1.2", "@semantic-release/changelog": "^6.0.3", "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", diff --git a/rollup.config.js b/rollup.config.js index 22016b04..19ba4da0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,7 +1,6 @@ import babel from '@rollup/plugin-babel'; import terser from '@rollup/plugin-terser'; import { nodeResolve } from '@rollup/plugin-node-resolve'; -import yaml from '@rollup/plugin-yaml'; import fs from 'fs'; import pkg from './package.json'; @@ -43,7 +42,7 @@ function build(filename, { src = SRC_DEFAULT, jekyll = false } = {}) { format: 'iife', name: 'Chirpy', banner, - sourcemap: !isProd + sourcemap: !isProd && !jekyll }, watch: { include: `${src}/**` @@ -55,7 +54,6 @@ function build(filename, { src = SRC_DEFAULT, jekyll = false } = {}) { plugins: ['@babel/plugin-transform-class-properties'] }), nodeResolve(), - yaml(), isProd && terser(), jekyll && insertFrontmatter() ] From fac6116af1d9836df5220f63c09fdf3d36910795 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:41:28 +0800 Subject: [PATCH 053/177] build(dev-deps): bump 7 dependencies versions --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index bab1a2f6..18713522 100644 --- a/package.json +++ b/package.json @@ -31,21 +31,21 @@ "@babel/core": "^7.25.2", "@babel/plugin-transform-class-properties": "^7.25.4", "@babel/preset-env": "^7.25.4", - "@commitlint/cli": "^19.4.0", - "@commitlint/config-conventional": "^19.2.2", + "@commitlint/cli": "^19.5.0", + "@commitlint/config-conventional": "^19.5.0", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-terser": "^0.4.4", "@semantic-release/changelog": "^6.0.3", "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", - "concurrently": "^8.2.2", + "concurrently": "^9.0.1", "conventional-changelog-conventionalcommits": "^8.0.0", - "husky": "^9.1.5", + "husky": "^9.1.6", "purgecss": "^6.0.0", - "rollup": "^4.21.0", - "semantic-release": "^24.1.0", - "stylelint": "^16.8.2", + "rollup": "^4.21.3", + "semantic-release": "^24.1.1", + "stylelint": "^16.9.0", "stylelint-config-standard-scss": "^13.1.0" }, "prettier": { From fd0df8320f7e4e2849c27f1be0f1232bf46a61bb Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 23 Sep 2024 11:56:31 +0000 Subject: [PATCH 054/177] chore(release): 7.1.1 ## [7.1.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.1.0...v7.1.1) (2024-09-23) ### Bug Fixes * **i18n:** correct fr-FR translations ([#1949](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1949)) ([367262e](https://github.com/cotes2020/jekyll-theme-chirpy/commit/367262e74d1005bddf1328bb2b3a2b9e152c0086)) * **pwa:** site baseurl not passed to `app.js` ([#1955](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1955)) ([5a63244](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5a63244721d21b1ad3a0ae83420723a2f0379e8b)) --- docs/CHANGELOG.md | 7 +++++++ jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5d58c621..3c59cef1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [7.1.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.1.0...v7.1.1) (2024-09-23) + +### Bug Fixes + +* **i18n:** correct fr-FR translations ([#1949](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1949)) ([367262e](https://github.com/cotes2020/jekyll-theme-chirpy/commit/367262e74d1005bddf1328bb2b3a2b9e152c0086)) +* **pwa:** site baseurl not passed to `app.js` ([#1955](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1955)) ([5a63244](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5a63244721d21b1ad3a0ae83420723a2f0379e8b)) + ## [7.1.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.0.1...v7.1.0) (2024-08-27) ### Features diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 046e8eb3..9de7dd04 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-theme-chirpy" - spec.version = "7.1.0" + spec.version = "7.1.1" spec.authors = ["Cotes Chung"] spec.email = ["cotes.chung@gmail.com"] diff --git a/package.json b/package.json index 18713522..f93e76b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jekyll-theme-chirpy", - "version": "7.1.0", + "version": "7.1.1", "description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.", "repository": { "type": "git", From e6b87d28111457cbc2f497866b71d8a2d00e35bc Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Tue, 24 Sep 2024 04:21:34 +0400 Subject: [PATCH 055/177] chore: remove `h1` element from site title (#1960) --- _includes/sidebar.html | 4 +--- _sass/addon/commons.scss | 12 +++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/_includes/sidebar.html b/_includes/sidebar.html index 4f0bb8ca..569585f6 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -11,9 +11,7 @@ {%- endif -%} -

- {{ site.title }} -

+ {{ site.title }}

{{ site.tagline }}

diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 465cb085..e2a0e615 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -738,6 +738,9 @@ $btn-mb: 0.5rem; } .site-title { + @extend %clickable-transition; + @extend %sidebar-link-hover; + font-family: inherit; font-weight: 900; font-size: 1.75rem; @@ -745,13 +748,8 @@ $btn-mb: 0.5rem; letter-spacing: 0.25px; margin-top: 1.25rem; margin-bottom: 0.5rem; - - a { - @extend %clickable-transition; - @extend %sidebar-link-hover; - - color: var(--site-title-color); - } + width: fit-content; + color: var(--site-title-color); } .site-subtitle { From 93f616b25d7ed6c4f090c50c8663f8c1f59947f4 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 26 Sep 2024 22:30:56 +0800 Subject: [PATCH 056/177] fix: pagination error when pinned posts exceed the page size (#1965) --- _layouts/home.html | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/_layouts/home.html b/_layouts/home.html index e44efe8f..451e391c 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -5,38 +5,45 @@ {% include lang.html %} -{% assign pinned = site.posts | where: 'pin', 'true' %} -{% assign default = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %} +{% assign all_pinned = site.posts | where: 'pin', 'true' %} +{% assign all_normal = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %} {% assign posts = '' | split: '' %} - + -{% assign offset = paginator.page | minus: 1 | times: paginator.per_page %} -{% assign pinned_num = pinned.size | minus: offset %} +{% assign visible_start = paginator.page | minus: 1 | times: paginator.per_page %} +{% assign visible_end = visible_start | plus: paginator.per_page %} -{% if pinned_num > 0 %} - {% for i in (offset..pinned.size) limit: pinned_num %} - {% assign posts = posts | push: pinned[i] %} +{% if all_pinned.size > visible_start %} + {% if all_pinned.size > visible_end %} + {% assign pinned_size = paginator.per_page %} + {% else %} + {% assign pinned_size = all_pinned.size | minus: visible_start %} + {% endif %} + + {% for i in (visible_start..all_pinned.size) limit: pinned_size %} + {% assign posts = posts | push: all_pinned[i] %} {% endfor %} {% else %} - {% assign pinned_num = 0 %} + {% assign pinned_size = 0 %} {% endif %} - + -{% assign default_beg = offset | minus: pinned.size %} +{% assign normal_size = paginator.posts | size | minus: pinned_size %} -{% if default_beg < 0 %} - {% assign default_beg = 0 %} -{% endif %} +{% if normal_size > 0 %} + {% if pinned_size > 0 %} + {% assign normal_start = 0 %} + {% else %} + {% assign normal_start = visible_start | minus: all_pinned.size %} + {% endif %} -{% assign default_num = paginator.posts | size | minus: pinned_num %} -{% assign default_end = default_beg | plus: default_num | minus: 1 %} + {% assign normal_end = normal_start | plus: normal_size | minus: 1 %} -{% if default_num > 0 %} - {% for i in (default_beg..default_end) %} - {% assign posts = posts | push: default[i] %} + {% for i in (normal_start..normal_end) %} + {% assign posts = posts | push: all_normal[i] %} {% endfor %} {% endif %} From 740bd84c51cbb929438ea538ddc942f97d1c1431 Mon Sep 17 00:00:00 2001 From: Bence Boros <39780892+borosbence@users.noreply.github.com> Date: Tue, 1 Oct 2024 17:19:39 +0200 Subject: [PATCH 057/177] chore(i18n): update hungarian translation (#1976) --- _data/locales/hu-HU.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/_data/locales/hu-HU.yml b/_data/locales/hu-HU.yml index 53d88e96..be3a31b7 100644 --- a/_data/locales/hu-HU.yml +++ b/_data/locales/hu-HU.yml @@ -14,24 +14,23 @@ tabs: categories: Kategóriák tags: Címkék archives: Archívum - about: Rólam + about: Bemutatkozás # the text displayed in the search bar & search results search: hint: keresés cancel: Mégse - no_results: Oops! Nincs találat a keresésre. + no_results: Hoppá! Nincs találat a keresésre. panel: lastmod: Legutóbb frissítve trending_tags: Népszerű Címkék toc: Tartalom - links: Blog linkek copyright: # Shown at the bottom of the post license: - template: A bejegyzés :LICENSE_NAME licenccel rendelkezik. + template: A bejegyzést a szerző :LICENSE_NAME licenc alatt engedélyezte. name: CC BY 4.0 link: https://creativecommons.org/licenses/by/4.0/ @@ -42,7 +41,7 @@ copyright: Creative Commons Attribution 4.0 International (CC BY 4.0) licenccel rendelkeznek, hacsak másképp nincs jelezve. -meta: Készítve :PLATFORM motorral :THEME témával +meta: Készítve :THEME témával a :PLATFORM platformra. not_found: statement: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat. @@ -73,7 +72,21 @@ post: title: Link másolása succeed: Link sikeresen másolva! +# Date time format. +# See: , +df: + post: + strftime: "%Y. %B. %e." + dayjs: "YYYY. MMMM D." + archives: + strftime: "%B" + dayjs: "MMM" + # categories page categories: - category_measure: kategória - post_measure: bejegyzés + category_measure: + singular: kategória + plural: kategória + post_measure: + singular: bejegyzés + plural: bejegyzés From 8a064a5e5a95cd22aa654f7c80da09d107262508 Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Fri, 11 Oct 2024 18:32:10 +0400 Subject: [PATCH 058/177] feat: show toc on mobile screens (#1964) --- _includes/toc-status.html | 10 + _includes/toc.html | 9 +- _javascript/modules/components/toc.js | 41 ++-- .../modules/components/toc/toc-desktop.js | 22 ++ .../modules/components/toc/toc-mobile.js | 117 ++++++++++ _javascript/modules/plugins.js | 2 +- _javascript/post.js | 7 +- _layouts/post.html | 28 ++- _sass/addon/commons.scss | 4 +- _sass/addon/module.scss | 7 + _sass/colors/typography-dark.scss | 2 +- _sass/colors/typography-light.scss | 2 +- _sass/layout/post.scss | 209 ++++++++++++++++++ 13 files changed, 430 insertions(+), 30 deletions(-) create mode 100644 _includes/toc-status.html create mode 100644 _javascript/modules/components/toc/toc-desktop.js create mode 100644 _javascript/modules/components/toc/toc-mobile.js diff --git a/_includes/toc-status.html b/_includes/toc-status.html new file mode 100644 index 00000000..4b71caee --- /dev/null +++ b/_includes/toc-status.html @@ -0,0 +1,10 @@ +{% comment %} + Determine TOC state and return it through variable "enable_toc" +{% endcomment %} + +{% assign enable_toc = false %} +{% if site.toc and page.toc %} + {% if page.content contains ' +

{{- site.data.locales[include.lang].panel.toc -}}

diff --git a/_javascript/modules/components/toc.js b/_javascript/modules/components/toc.js index 56ce26fa..765336ac 100644 --- a/_javascript/modules/components/toc.js +++ b/_javascript/modules/components/toc.js @@ -1,15 +1,30 @@ -export function toc() { - if (document.querySelector('main h2, main h3')) { - // see: https://github.com/tscanlin/tocbot#usage - tocbot.init({ - tocSelector: '#toc', - contentSelector: '.content', - ignoreSelector: '[data-toc-skip]', - headingSelector: 'h2, h3, h4', - orderedList: false, - scrollSmooth: false - }); - - document.getElementById('toc-wrapper').classList.remove('d-none'); +import { TocMobile as mobile } from './toc/toc-mobile'; +import { TocDesktop as desktop } from './toc/toc-desktop'; + +const desktopMode = matchMedia('(min-width: 1200px)'); + +function refresh(e) { + if (e.matches) { + mobile.hidePopup(); + desktop.refresh(); + } else { + mobile.refresh(); } } + +function init() { + if (document.querySelector('main>article[data-toc="true"]') === null) { + return; + } + + // Avoid create multiple instances of Tocbot. Ref: + if (desktopMode.matches) { + desktop.init(); + } else { + mobile.init(); + } + + desktopMode.onchange = refresh; +} + +export { init as initToc }; diff --git a/_javascript/modules/components/toc/toc-desktop.js b/_javascript/modules/components/toc/toc-desktop.js new file mode 100644 index 00000000..5021a72a --- /dev/null +++ b/_javascript/modules/components/toc/toc-desktop.js @@ -0,0 +1,22 @@ +export class TocDesktop { + /* Tocbot options Ref: https://github.com/tscanlin/tocbot#usage */ + static options = { + tocSelector: '#toc', + contentSelector: '.content', + ignoreSelector: '[data-toc-skip]', + headingSelector: 'h2, h3, h4', + orderedList: false, + scrollSmooth: false, + headingsOffset: 16 * 2 // 2rem + }; + + static refresh() { + tocbot.refresh(this.options); + } + + static init() { + if (document.getElementById('toc-wrapper')) { + tocbot.init(this.options); + } + } +} diff --git a/_javascript/modules/components/toc/toc-mobile.js b/_javascript/modules/components/toc/toc-mobile.js new file mode 100644 index 00000000..48b372df --- /dev/null +++ b/_javascript/modules/components/toc/toc-mobile.js @@ -0,0 +1,117 @@ +/** + * TOC button, topbar and popup for mobile devices + */ + +const $tocBar = document.getElementById('toc-bar'); +const $soloTrigger = document.getElementById('toc-solo-trigger'); +const $triggers = document.getElementsByClassName('toc-trigger'); +const $popup = document.getElementById('toc-popup'); +const $btnClose = document.getElementById('toc-popup-close'); + +const SCROLL_LOCK = 'overflow-hidden'; +const CLOSING = 'closing'; + +export class TocMobile { + static invisible = true; + static barHeight = 16 * 3; // 3rem + + static options = { + tocSelector: '#toc-popup-content', + contentSelector: '.content', + ignoreSelector: '[data-toc-skip]', + headingSelector: 'h2, h3, h4', + orderedList: false, + scrollSmooth: false, + collapseDepth: 4, + headingsOffset: this.barHeight + }; + + static initBar() { + const observer = new IntersectionObserver( + (entries) => { + entries.forEach((entry) => { + $tocBar.classList.toggle('invisible', entry.isIntersecting); + }); + }, + { rootMargin: `-${this.barHeight}px 0px 0px 0px` } + ); + + observer.observe($soloTrigger); + this.invisible = false; + } + + static listenAnchors() { + const $anchors = document.getElementsByClassName('toc-link'); + [...$anchors].forEach((anchor) => { + anchor.onclick = this.hidePopup; + }); + } + + static refresh() { + if (this.invisible) { + this.initComponents(); + } + tocbot.refresh(this.options); + this.listenAnchors(); + } + + static showPopup() { + TocMobile.lockScroll(true); + $popup.showModal(); + const activeItem = $popup.querySelector('li.is-active-li'); + activeItem.scrollIntoView({ block: 'center' }); + } + + static hidePopup() { + if (!$popup.open) { + return; + } + + $popup.toggleAttribute(CLOSING); + + $popup.addEventListener( + 'animationend', + () => { + $popup.toggleAttribute(CLOSING); + $popup.close(); + }, + { once: true } + ); + + TocMobile.lockScroll(false); + } + + static lockScroll(enable) { + document.documentElement.classList.toggle(SCROLL_LOCK, enable); + document.body.classList.toggle(SCROLL_LOCK, enable); + } + + static clickBackdrop(event) { + const rect = event.target.getBoundingClientRect(); + if ( + event.clientX < rect.left || + event.clientX > rect.right || + event.clientY < rect.top || + event.clientY > rect.bottom + ) { + TocMobile.hidePopup(); + } + } + + static initComponents() { + this.initBar(); + + [...$triggers].forEach((trigger) => { + trigger.onclick = this.showPopup; + }); + + $popup.onclick = this.clickBackdrop; + $btnClose.onclick = $popup.oncancel = this.hidePopup; + } + + static init() { + tocbot.init(this.options); + this.listenAnchors(); + this.initComponents(); + } +} diff --git a/_javascript/modules/plugins.js b/_javascript/modules/plugins.js index fb892e25..cc95c1bc 100644 --- a/_javascript/modules/plugins.js +++ b/_javascript/modules/plugins.js @@ -3,4 +3,4 @@ export { initClipboard } from './components/clipboard'; export { loadImg } from './components/img-loading'; export { imgPopup } from './components/img-popup'; export { initLocaleDatetime } from './components/locale-datetime'; -export { toc } from './components/toc'; +export { initToc } from './components/toc'; diff --git a/_javascript/post.js b/_javascript/post.js index 9340f05e..1c616ecd 100644 --- a/_javascript/post.js +++ b/_javascript/post.js @@ -1,14 +1,15 @@ -import { basic, initSidebar, initTopbar } from './modules/layouts'; +import { basic, initTopbar, initSidebar } from './modules/layouts'; + import { loadImg, imgPopup, initLocaleDatetime, initClipboard, - toc + initToc } from './modules/plugins'; loadImg(); -toc(); +initToc(); imgPopup(); initSidebar(); initLocaleDatetime(); diff --git a/_layouts/post.html b/_layouts/post.html index f17ceea8..bcc133f8 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -11,7 +11,9 @@ {% include lang.html %} -
+{% include toc-status.html %} + +

{{ page.title }}

{% if page.description %} @@ -95,6 +97,30 @@

{{ page.title }}

+ {% if enable_toc %} + + + + + +
+
{{- page.title -}}
+ +
+
+
+ {% endif %} +
{{ content }}
diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index e2a0e615..e332f213 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -908,9 +908,7 @@ $btn-mb: 0.5rem; } #topbar { - button i { - color: #999999; - } + @extend %btn-color; #breadcrumb { font-size: 1rem; diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index 42db4e2d..34ac67b9 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -8,6 +8,7 @@ color: var(--heading-color); font-weight: 400; font-family: $font-family-heading; + scroll-margin-top: 3.5rem; } %anchor { @@ -134,6 +135,12 @@ } } +%btn-color { + button i { + color: #999999; + } +} + /* ---------- scss mixin --------- */ @mixin mt-mb($value) { diff --git a/_sass/colors/typography-dark.scss b/_sass/colors/typography-dark.scss index 12427ec4..664c9365 100644 --- a/_sass/colors/typography-dark.scss +++ b/_sass/colors/typography-dark.scss @@ -22,7 +22,6 @@ --btn-border-color: #2e2f31; --btn-backtotop-color: var(--text-color); --btn-backtotop-border-color: #212122; - --btn-box-shadow: var(--main-bg); --card-header-bg: #292929; --checkbox-color: rgb(118, 120, 121); --checkbox-checked-color: var(--link-color); @@ -60,6 +59,7 @@ /* Posts */ --toc-highlight: rgb(116, 178, 243); + --toc-popup-border-color: #373737; --tag-hover: rgb(43, 56, 62); --tb-odd-bg: #252526; /* odd rows of the posts' table */ --tb-even-bg: rgb(31, 31, 34); /* even rows of the posts' table */ diff --git a/_sass/colors/typography-light.scss b/_sass/colors/typography-light.scss index 78000746..b6fc5618 100644 --- a/_sass/colors/typography-light.scss +++ b/_sass/colors/typography-light.scss @@ -22,7 +22,6 @@ --btn-border-color: #e9ecef; --btn-backtotop-color: #686868; --btn-backtotop-border-color: #f1f1f1; - --btn-box-shadow: #eaeaea; --checkbox-color: #c5c5c5; --checkbox-checked-color: #07a8f7; --img-bg: radial-gradient( @@ -63,6 +62,7 @@ /* Posts */ --toc-highlight: #0550ae; + --toc-popup-border-color: lightgray; --btn-share-color: gray; --btn-share-hover-color: #0d6efd; --card-bg: white; diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index 815db933..be727006 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -228,6 +228,7 @@ header { } } +/* TOC panel */ #toc-wrapper { border-left: 1px solid rgba(158, 158, 158, 0.17); position: -webkit-sticky; @@ -290,6 +291,201 @@ header { } } +/* --- TOC button, bar and popup in mobile/tablet --- */ + +#toc-bar { + position: -webkit-sticky; + position: sticky; + top: 0; + z-index: 1; + margin: 0 -1rem; + height: $topbar-height; + background: var(--main-bg); + border-bottom: 1px solid var(--main-border-color); + transition: all 0.2s ease-in-out; + + @extend %btn-color; + + .label { + @extend %heading; + + margin-left: 0.25rem; + padding: 0 0.75rem; + color: inherit; + } + + &.invisible { + top: -$topbar-height; + transition: none; + } +} + +#toc-solo-trigger { + color: var(--text-muted-color); + border-color: var(--btn-border-color); + border-radius: $radius-lg; + + .label { + font-size: 1rem; + font-family: $font-family-heading; + } + + &:hover { + box-shadow: none; + background: none; + } +} + +@mixin slide-in { + from { + opacity: 0.7; + transform: translateY(-$topbar-height); + } + + to { + opacity: 1; + transform: translateY(0); + } +} + +@mixin slide-out { + 0% { + transform: translateY(0); + opacity: 1; + } + + 100% { + transform: translateY(-$topbar-height); + opacity: 0; + } +} + +@-webkit-keyframes slide-in { + @include slide-in; +} + +@keyframes slide-in { + @include slide-in; +} + +@-webkit-keyframes slide-out { + @include slide-out; +} + +@keyframes slide-out { + @include slide-out; +} + +#toc-popup { + $slide-in: slide-in 0.3s ease-out; + $slide-out: slide-out 0.3s ease-out; + $curtain-height: 2rem; + + border-color: var(--toc-popup-border-color); + border-width: 1px; + border-radius: $radius-lg; + color: var(--text-color); + background: var(--main-bg); + margin-top: $topbar-height; + min-width: 20rem; + font-size: 1.05rem; + + @media all and (min-width: 576px) { + max-width: 32rem; + } + + &[open] { + -webkit-animation: $slide-in; + animation: $slide-in; + } + + &[closing] { + -webkit-animation: $slide-out; + animation: $slide-out; + } + + @media all and (min-width: 850px) { + left: $sidebar-width; + } + + .header { + @extend %btn-color; + + position: -webkit-sticky; + position: sticky; + top: 0; + background-color: inherit; + border-bottom: 1px solid var(--main-border-color); + + .label { + font-family: $font-family-heading; + } + } + + button:focus-visible { + box-shadow: none; + } + + ul { + list-style-type: none; + padding-left: 0; + + li { + ul, + & + li { + margin-top: 0.25rem; + } + + a { + display: flex; + line-height: 1.5; + padding: 0.375rem 0; + padding-right: 1.125rem; + + &.toc-link::before { + display: none; + } + } + } + } + + @for $i from 2 through 4 { + .node-name--H#{$i} { + padding-left: 1.125rem * ($i - 1); + } + } + + .is-active-link { + color: var(--toc-highlight) !important; + font-weight: 600; + } + + &::-webkit-backdrop { + -webkit-backdrop-filter: blur(5px); + backdrop-filter: blur(5px); + } + + &::backdrop { + -webkit-backdrop-filter: blur(5px); + backdrop-filter: blur(5px); + } + + &::after { + display: flex; + content: ''; + position: relative; + background: linear-gradient(transparent, var(--main-bg) 70%); + height: $curtain-height; + } + + #toc-popup-content { + overflow: auto; + max-height: calc(100vh - 4 * $topbar-height); + font-family: $font-family-heading; + margin-bottom: -$curtain-height; + } +} + /* --- Related Posts --- */ #related-posts { @@ -368,3 +564,16 @@ header { margin-right: -0.5rem; } } + +@media all and (min-width: 1200px) { + h2, + h3, + h4 { + scroll-margin-top: 2rem; + } + + #toc-bar, + #toc-solo-trigger { + display: none !important; + } +} From 03e302cbf68cc502a2b6bef0726186a0b3ef321c Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Sun, 13 Oct 2024 21:16:25 +0400 Subject: [PATCH 059/177] chore: close toc-popup gracefully with Esc key (#1990) --- _javascript/modules/components/toc/toc-mobile.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_javascript/modules/components/toc/toc-mobile.js b/_javascript/modules/components/toc/toc-mobile.js index 48b372df..8d717dd0 100644 --- a/_javascript/modules/components/toc/toc-mobile.js +++ b/_javascript/modules/components/toc/toc-mobile.js @@ -62,7 +62,11 @@ export class TocMobile { activeItem.scrollIntoView({ block: 'center' }); } - static hidePopup() { + static hidePopup(event) { + if (event?.type === 'cancel') { + event.preventDefault(); + } + if (!$popup.open) { return; } From 6f461132c00c7f7d557e0b865530bb256c1fe5be Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 19 Oct 2024 21:13:21 +0800 Subject: [PATCH 060/177] refactor: improve toc popup module --- _javascript/modules/components/toc.js | 5 +- .../modules/components/toc/toc-mobile.js | 48 ++++++++++--------- _layouts/post.html | 6 +-- _sass/layout/post.scss | 24 ++++++---- 4 files changed, 49 insertions(+), 34 deletions(-) diff --git a/_javascript/modules/components/toc.js b/_javascript/modules/components/toc.js index 765336ac..e9086eed 100644 --- a/_javascript/modules/components/toc.js +++ b/_javascript/modules/components/toc.js @@ -5,7 +5,10 @@ const desktopMode = matchMedia('(min-width: 1200px)'); function refresh(e) { if (e.matches) { - mobile.hidePopup(); + if (mobile.popupOpened) { + mobile.hidePopup(); + } + desktop.refresh(); } else { mobile.refresh(); diff --git a/_javascript/modules/components/toc/toc-mobile.js b/_javascript/modules/components/toc/toc-mobile.js index 8d717dd0..20e24a73 100644 --- a/_javascript/modules/components/toc/toc-mobile.js +++ b/_javascript/modules/components/toc/toc-mobile.js @@ -12,8 +12,8 @@ const SCROLL_LOCK = 'overflow-hidden'; const CLOSING = 'closing'; export class TocMobile { - static invisible = true; - static barHeight = 16 * 3; // 3rem + static #invisible = true; + static #barHeight = 16 * 3; // 3rem static options = { tocSelector: '#toc-popup-content', @@ -23,7 +23,7 @@ export class TocMobile { orderedList: false, scrollSmooth: false, collapseDepth: 4, - headingsOffset: this.barHeight + headingsOffset: this.#barHeight }; static initBar() { @@ -33,44 +33,40 @@ export class TocMobile { $tocBar.classList.toggle('invisible', entry.isIntersecting); }); }, - { rootMargin: `-${this.barHeight}px 0px 0px 0px` } + { rootMargin: `-${this.#barHeight}px 0px 0px 0px` } ); observer.observe($soloTrigger); - this.invisible = false; + this.#invisible = false; } static listenAnchors() { const $anchors = document.getElementsByClassName('toc-link'); [...$anchors].forEach((anchor) => { - anchor.onclick = this.hidePopup; + anchor.onclick = () => this.hidePopup(); }); } static refresh() { - if (this.invisible) { + if (this.#invisible) { this.initComponents(); } tocbot.refresh(this.options); this.listenAnchors(); } + static get popupOpened() { + return $popup.open; + } + static showPopup() { - TocMobile.lockScroll(true); + this.lockScroll(true); $popup.showModal(); const activeItem = $popup.querySelector('li.is-active-li'); activeItem.scrollIntoView({ block: 'center' }); } - static hidePopup(event) { - if (event?.type === 'cancel') { - event.preventDefault(); - } - - if (!$popup.open) { - return; - } - + static hidePopup() { $popup.toggleAttribute(CLOSING); $popup.addEventListener( @@ -82,7 +78,7 @@ export class TocMobile { { once: true } ); - TocMobile.lockScroll(false); + this.lockScroll(false); } static lockScroll(enable) { @@ -91,6 +87,10 @@ export class TocMobile { } static clickBackdrop(event) { + if ($popup.hasAttribute(CLOSING)) { + return; + } + const rect = event.target.getBoundingClientRect(); if ( event.clientX < rect.left || @@ -98,7 +98,7 @@ export class TocMobile { event.clientY < rect.top || event.clientY > rect.bottom ) { - TocMobile.hidePopup(); + this.hidePopup(); } } @@ -106,11 +106,15 @@ export class TocMobile { this.initBar(); [...$triggers].forEach((trigger) => { - trigger.onclick = this.showPopup; + trigger.onclick = () => this.showPopup(); }); - $popup.onclick = this.clickBackdrop; - $btnClose.onclick = $popup.oncancel = this.hidePopup; + $popup.onclick = (e) => this.clickBackdrop(e); + $btnClose.onclick = () => this.hidePopup(); + $popup.oncancel = (e) => { + e.preventDefault(); + this.hidePopup(); + }; } static init() { diff --git a/_layouts/post.html b/_layouts/post.html index bcc133f8..6a2deff7 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -100,7 +100,7 @@

{{ page.title }}

{% if enable_toc %} @@ -113,8 +113,8 @@

{{ page.title }}

{{- page.title -}}
-
diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index be727006..01021f3f 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -380,12 +380,13 @@ header { $slide-in: slide-in 0.3s ease-out; $slide-out: slide-out 0.3s ease-out; $curtain-height: 2rem; + $backdrop: blur(5px); border-color: var(--toc-popup-border-color); border-width: 1px; border-radius: $radius-lg; color: var(--text-color); - background: var(--main-bg); + background: var(--card-bg); margin-top: $topbar-height; min-width: 20rem; font-size: 1.05rem; @@ -422,8 +423,15 @@ header { } } - button:focus-visible { - box-shadow: none; + button { + > i { + font-size: 1.25rem; + vertical-align: middle; + } + + &:focus-visible { + box-shadow: none; + } } ul { @@ -461,20 +469,20 @@ header { } &::-webkit-backdrop { - -webkit-backdrop-filter: blur(5px); - backdrop-filter: blur(5px); + -webkit-backdrop-filter: $backdrop; + backdrop-filter: $backdrop; } &::backdrop { - -webkit-backdrop-filter: blur(5px); - backdrop-filter: blur(5px); + -webkit-backdrop-filter: $backdrop; + backdrop-filter: $backdrop; } &::after { display: flex; content: ''; position: relative; - background: linear-gradient(transparent, var(--main-bg) 70%); + background: linear-gradient(transparent, var(--card-bg) 70%); height: $curtain-height; } From c1bd9eb9eece4cf3b7e76d750bcc4108aec63361 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:47:54 +0800 Subject: [PATCH 061/177] refactor: reduce duplicate scss --- _sass/addon/commons.scss | 22 ++++++++++------------ _sass/addon/module.scss | 21 ++++++++++++++++++--- _sass/layout/archives.scss | 5 ++--- _sass/layout/category-tag.scss | 4 +--- _sass/layout/home.scss | 5 ++--- _sass/layout/post.scss | 26 ++++++++++++-------------- 6 files changed, 45 insertions(+), 38 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index e332f213..2bf99b85 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -251,8 +251,8 @@ i { > p { margin-left: 0.25em; - margin-top: 0; - margin-bottom: 0; + + @include mt-mb(0); } } } @@ -769,8 +769,8 @@ $btn-mb: 0.5rem; li.nav-item { opacity: 0.9; width: 100%; - padding-left: 1.5rem; - padding-right: 1.5rem; + + @include pl-pr(1.5rem); a.nav-link { @include pt-pb(0.6rem); @@ -1043,7 +1043,7 @@ search { a { font-size: 1.4rem; - line-height: 2.5rem; + line-height: 1.5rem; &:hover { @extend %link-hover; @@ -1069,8 +1069,9 @@ search { } > p { - overflow: hidden; - text-overflow: ellipsis; + @extend %text-ellipsis; + + white-space: break-spaces; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; @@ -1086,10 +1087,7 @@ search { color: var(--topbar-text-color); text-align: center; width: 70%; - overflow: hidden; - text-overflow: ellipsis; word-break: keep-all; - white-space: nowrap; } #mask { @@ -1492,8 +1490,8 @@ search { #main-wrapper > .container { max-width: $main-content-max-width; - padding-left: 1.75rem !important; - padding-right: 1.75rem !important; + + @include pl-pr(1.75rem, true); } main.col-12, diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index 34ac67b9..1dfb735f 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -112,6 +112,16 @@ -webkit-box-orient: vertical; } +@mixin text-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +%text-ellipsis { + @include text-ellipsis; +} + %text-highlight { color: var(--text-muted-highlight-color); font-weight: 600; @@ -158,9 +168,14 @@ padding-bottom: $val; } -@mixin pl-pr($val) { - padding-left: $val; - padding-right: $val; +@mixin pl-pr($val, $important: false) { + @if $important { + padding-left: $val !important; + padding-right: $val !important; + } @else { + padding-left: $val; + padding-right: $val; + } } @mixin placeholder { diff --git a/_sass/layout/archives.scss b/_sass/layout/archives.scss index 3a2e86b1..fd1979b8 100644 --- a/_sass/layout/archives.scss +++ b/_sass/layout/archives.scss @@ -58,9 +58,8 @@ li { font-size: 1.1rem; line-height: 3rem; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + + @extend %text-ellipsis; &:nth-child(odd) { background-color: var(--main-bg, #ffffff); diff --git a/_sass/layout/category-tag.scss b/_sass/layout/category-tag.scss index 9e43a911..fe7d99ce 100644 --- a/_sass/layout/category-tag.scss +++ b/_sass/layout/category-tag.scss @@ -63,9 +63,7 @@ } > a { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + @include text-ellipsis; } } } diff --git a/_sass/layout/home.scss b/_sass/layout/home.scss index 0d95d7ba..7fff3ba1 100644 --- a/_sass/layout/home.scss +++ b/_sass/layout/home.scss @@ -74,9 +74,8 @@ > div:first-child { display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + + @extend %text-ellipsis; } } } diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index 01021f3f..b66e906c 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -1,6 +1,6 @@ -/* - Post-specific style -*/ +/** + * Post-specific styles + */ %btn-post-nav { width: 50%; @@ -97,7 +97,7 @@ header { &:hover { i { - @extend %btn-share-hovor; + @extend %btn-share-hover; } } } @@ -258,9 +258,8 @@ header { .toc-link { display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + + @extend %text-ellipsis; &:hover { color: var(--toc-highlight); @@ -509,10 +508,11 @@ header { } p { + @extend %text-ellipsis; + font-size: 0.9rem; margin-bottom: 0.5rem; - overflow: hidden; - text-overflow: ellipsis; + white-space: break-spaces; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; @@ -534,7 +534,7 @@ header { max-width: 100%; } -%btn-share-hovor { +%btn-share-hover { color: var(--btn-share-hover-color) !important; } @@ -566,10 +566,8 @@ header { /* Hide SideBar and TOC */ @media all and (max-width: 849px) { .post-navigation { - padding-left: 0; - padding-right: 0; - margin-left: -0.5rem; - margin-right: -0.5rem; + @include pl-pr(0); + @include ml-mr(-0.5rem); } } From d4f7f39ece2d8feaca963b8bfba331268b28811e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:42:07 +0800 Subject: [PATCH 062/177] refactor: simplify sidebar animation --- _javascript/modules/components/sidebar.js | 23 +++++++++-------------- _layouts/default.html | 2 +- _sass/addon/commons.scss | 10 ---------- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/_javascript/modules/components/sidebar.js b/_javascript/modules/components/sidebar.js index 6b562d84..aed759ed 100644 --- a/_javascript/modules/components/sidebar.js +++ b/_javascript/modules/components/sidebar.js @@ -2,26 +2,21 @@ * Expand or close the sidebar in mobile screens. */ -const ATTR_DISPLAY = 'sidebar-display'; +const $sidebar = document.getElementById('sidebar'); +const $trigger = document.getElementById('sidebar-trigger'); +const $mask = document.getElementById('mask'); class SidebarUtil { - static isExpanded = false; + static #isExpanded = false; static toggle() { - if (SidebarUtil.isExpanded === false) { - document.body.setAttribute(ATTR_DISPLAY, ''); - } else { - document.body.removeAttribute(ATTR_DISPLAY); - } - - SidebarUtil.isExpanded = !SidebarUtil.isExpanded; + this.#isExpanded = !this.#isExpanded; + document.body.toggleAttribute('sidebar-display', this.#isExpanded); + $sidebar.classList.toggle('z-2', this.#isExpanded); + $mask.classList.toggle('d-none', !this.#isExpanded); } } export function sidebarExpand() { - document - .getElementById('sidebar-trigger') - .addEventListener('click', SidebarUtil.toggle); - - document.getElementById('mask').addEventListener('click', SidebarUtil.toggle); + $trigger.onclick = $mask.onclick = () => SidebarUtil.toggle(); } diff --git a/_layouts/default.html b/_layouts/default.html index ea438fe7..1590ef62 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -68,7 +68,7 @@ -
+
{% if site.pwa.enabled %} {% include_cached notification.html lang=lang %} diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 2bf99b85..5e8aceaa 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -688,7 +688,6 @@ $btn-mb: 0.5rem; height: 100%; overflow-y: auto; width: $sidebar-width; - z-index: 99; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border-color); @@ -1091,16 +1090,7 @@ search { } #mask { - display: none; - position: fixed; inset: 0 0 0 0; - height: 100%; - width: 100%; - z-index: 1; - - @at-root [#{$sidebar-display}] & { - display: block !important; - } } /* --- basic wrappers --- */ From 74ed06321c1730dc788af3306b80a0f1739510d4 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 25 Oct 2024 19:48:11 +0800 Subject: [PATCH 063/177] ci: block invalid pull requests (#2010) --- .github/workflows/pr-filter.yml | 22 ++++++++++++++ .github/workflows/scripts/pr-filter.js | 40 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/pr-filter.yml create mode 100644 .github/workflows/scripts/pr-filter.js diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml new file mode 100644 index 00000000..b6bcd00a --- /dev/null +++ b/.github/workflows/pr-filter.yml @@ -0,0 +1,22 @@ +name: Block Invalid PR + +on: + pull_request_target: + types: [opened, reopened, edited] + +jobs: + check-template: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Check PR Content + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const script = require('.github/workflows/scripts/pr-filter.js'); + await script({ github, context }); diff --git a/.github/workflows/scripts/pr-filter.js b/.github/workflows/scripts/pr-filter.js new file mode 100644 index 00000000..e7206301 --- /dev/null +++ b/.github/workflows/scripts/pr-filter.js @@ -0,0 +1,40 @@ +function noTypes(markdown) { + if (/## Type of change/.test(markdown) && /- \[x\]/i.test(markdown)) { + return false; + } + return true; +} + +function noDescription(markdown) { + return ( + /## Description/.test(markdown) === false || + /## Description\s*\n\s*## \w+/.test(markdown) || + /## Description\s*\n\s*$/.test(markdown) + ); +} + +module.exports = async ({ github, context }) => { + const pr = context.payload.pull_request; + + if (pr.labels.length > 0) { + // Skip if the PR is already labeled (typically created by a deps-bot.) + return; + } + + const body = pr.body === null ? '' : pr.body.trim(); + const markdown = body.replace(//g, ''); + + if (body === '' || noTypes(markdown) || noDescription(markdown)) { + await github.rest.pulls.update({ + ...context.repo, + pull_number: pr.number, + state: 'closed' + }); + + await github.rest.issues.createComment({ + ...context.repo, + issue_number: pr.number, + body: "Oops, it seems you've submitted an invalid pull request. No worries, we'll close it for you." + }); + } +}; From c7f967529c294f9622f142470406f2be43ea4d35 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:58:07 +0800 Subject: [PATCH 064/177] ci: skip test for invalid PRs (#2013) --- .github/workflows/ci.yml | 7 +++++- .github/workflows/commitlint.yml | 3 ++- .github/workflows/pr-filter.yml | 17 +++++++++++--- .github/workflows/scripts/pr-filter.js | 31 ++++++++++++-------------- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50a158b1..f909b7e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,5 @@ name: "CI" + on: push: branches: @@ -11,7 +12,7 @@ on: - "docs/**" - "README.md" - "LICENSE" - pull_request: + workflow_call: jobs: build: @@ -43,3 +44,7 @@ jobs: - name: Test Site run: bash tools/test.sh + + check-commit: + needs: build + uses: ./.github/workflows/commitlint.yml diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index c9c48c33..ac8726f3 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,5 +1,6 @@ name: Lint Commit Messages -on: pull_request + +on: workflow_call jobs: commitlint: diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml index b6bcd00a..fe393a29 100644 --- a/.github/workflows/pr-filter.yml +++ b/.github/workflows/pr-filter.yml @@ -1,22 +1,33 @@ -name: Block Invalid PR +name: PR Filter on: pull_request_target: - types: [opened, reopened, edited] + types: [opened, reopened] jobs: check-template: runs-on: ubuntu-latest permissions: pull-requests: write + steps: - name: Checkout Code uses: actions/checkout@v4 - name: Check PR Content + id: intercept uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string script: | const script = require('.github/workflows/scripts/pr-filter.js'); - await script({ github, context }); + return await script({ github, context }); + + - name: Abort due to invalid PR + if: ${{ steps.intercept.outputs.result != 'true' }} + run: exit 1 + + test: + needs: check-template + uses: ./.github/workflows/ci.yml diff --git a/.github/workflows/scripts/pr-filter.js b/.github/workflows/scripts/pr-filter.js index e7206301..f4190ddf 100644 --- a/.github/workflows/scripts/pr-filter.js +++ b/.github/workflows/scripts/pr-filter.js @@ -1,30 +1,25 @@ -function noTypes(markdown) { - if (/## Type of change/.test(markdown) && /- \[x\]/i.test(markdown)) { - return false; - } - return true; +function hasTypes(markdown) { + return /## Type of change/.test(markdown) && /-\s*\[x\]/i.test(markdown); } -function noDescription(markdown) { +function hasDescription(markdown) { return ( - /## Description/.test(markdown) === false || - /## Description\s*\n\s*## \w+/.test(markdown) || - /## Description\s*\n\s*$/.test(markdown) + /## Description/.test(markdown) && + !/## Description\s*\n\s*(##|\s*$)/.test(markdown) ); } module.exports = async ({ github, context }) => { const pr = context.payload.pull_request; - - if (pr.labels.length > 0) { - // Skip if the PR is already labeled (typically created by a deps-bot.) - return; - } - const body = pr.body === null ? '' : pr.body.trim(); const markdown = body.replace(//g, ''); + const action = context.payload.action; + + const isValid = + pr.labels.length > 0 || // PR create by Dependabot would have labels + (markdown !== '' && hasTypes(markdown) && hasDescription(markdown)); - if (body === '' || noTypes(markdown) || noDescription(markdown)) { + if (!isValid) { await github.rest.pulls.update({ ...context.repo, pull_number: pr.number, @@ -34,7 +29,9 @@ module.exports = async ({ github, context }) => { await github.rest.issues.createComment({ ...context.repo, issue_number: pr.number, - body: "Oops, it seems you've submitted an invalid pull request. No worries, we'll close it for you." + body: `Oops, it seems you've ${action} an invalid pull request. No worries, we'll close it for you.` }); } + + return isValid; }; From 4ef3cd8efc90518cc56b4e92306f81aa36feee70 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 29 Oct 2024 22:56:32 +0800 Subject: [PATCH 065/177] ci: improve workflow triggers (#2017) - Unchain commit-lint and CI - Even if a commit does not meet the CI path filter, it still needs to lint the commit message. - Unchain PR filter and CI - The CI workflow needs to be triggered when the commits in a pull request are modified. - Allow manual publishing - Sometimes `semantic-release` will error out due to commit messages referencing discussions, but this does not affect the final RubyGems/GitHub Release. In such cases, manual triggering of the publish process is needed to complete the remaining publishing steps. --- .github/workflows/cd.yml | 7 +++---- .github/workflows/ci.yml | 25 ++++++++++++++----------- .github/workflows/commitlint.yml | 7 ++++++- .github/workflows/pr-filter.yml | 11 +---------- .github/workflows/publish.yml | 1 + .github/workflows/scripts/pr-filter.js | 10 +++++----- .github/workflows/style-lint.yml | 6 ++++-- 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 4f2da0e3..c665f755 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -2,13 +2,12 @@ name: CD on: push: - branches: - - production - tags-ignore: - - "**" + branches: [production] + tags-ignore: ["**"] jobs: release: + if: ${{ ! startsWith(github.event.head_commit.message, 'chore(release)') }} permissions: contents: write issues: write diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f909b7e6..31b87863 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,25 @@ -name: "CI" +name: CI on: push: branches: - - "master" - - "hotfix/**" + - master + - "hotfix/*" paths-ignore: - ".github/**" - "!.github/workflows/ci.yml" - - ".gitignore" + - .gitignore - "docs/**" - - "README.md" - - "LICENSE" - workflow_call: + - README.md + - LICENSE + pull_request: + paths-ignore: + - ".github/**" + - "!.github/workflows/ci.yml" + - .gitignore + - "docs/**" + - README.md + - LICENSE jobs: build: @@ -44,7 +51,3 @@ jobs: - name: Test Site run: bash tools/test.sh - - check-commit: - needs: build - uses: ./.github/workflows/commitlint.yml diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index ac8726f3..58f1a3ff 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,6 +1,11 @@ name: Lint Commit Messages -on: workflow_call +on: + push: + branches: + - master + - "hotfix/*" + pull_request: jobs: commitlint: diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml index fe393a29..42e1d640 100644 --- a/.github/workflows/pr-filter.yml +++ b/.github/workflows/pr-filter.yml @@ -19,15 +19,6 @@ jobs: uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} - result-encoding: string script: | const script = require('.github/workflows/scripts/pr-filter.js'); - return await script({ github, context }); - - - name: Abort due to invalid PR - if: ${{ steps.intercept.outputs.result != 'true' }} - run: exit 1 - - test: - needs: check-template - uses: ./.github/workflows/ci.yml + await script({ github, context, core }); diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 99114ea3..b0f9713f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,6 +10,7 @@ on: required: true BUILDER: required: true + workflow_dispatch: jobs: launch: diff --git a/.github/workflows/scripts/pr-filter.js b/.github/workflows/scripts/pr-filter.js index f4190ddf..97242016 100644 --- a/.github/workflows/scripts/pr-filter.js +++ b/.github/workflows/scripts/pr-filter.js @@ -1,5 +1,5 @@ function hasTypes(markdown) { - return /## Type of change/.test(markdown) && /-\s*\[x\]/i.test(markdown); + return /## Type of change/.test(markdown) && /-\s\[x\]/i.test(markdown); } function hasDescription(markdown) { @@ -9,9 +9,9 @@ function hasDescription(markdown) { ); } -module.exports = async ({ github, context }) => { +module.exports = async ({ github, context, core }) => { const pr = context.payload.pull_request; - const body = pr.body === null ? '' : pr.body.trim(); + const body = pr.body === null ? '' : pr.body; const markdown = body.replace(//g, ''); const action = context.payload.action; @@ -31,7 +31,7 @@ module.exports = async ({ github, context }) => { issue_number: pr.number, body: `Oops, it seems you've ${action} an invalid pull request. No worries, we'll close it for you.` }); - } - return isValid; + core.setFailed('PR content does not meet template requirements.'); + } }; diff --git a/.github/workflows/style-lint.yml b/.github/workflows/style-lint.yml index f84f3bcc..5cb38a7a 100644 --- a/.github/workflows/style-lint.yml +++ b/.github/workflows/style-lint.yml @@ -1,8 +1,10 @@ -name: "Style Lint" +name: Style Lint on: push: - branches: ["master", "hotfix/**"] + branches: + - master + - "hotfix/*" paths: ["_sass/**/*.scss"] pull_request: paths: ["_sass/**/*.scss"] From 86b13c917f8f9477b10766fb621cbe987c025203 Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Fri, 1 Nov 2024 14:39:03 +0400 Subject: [PATCH 066/177] chore: improve feed interoperability (#2024) --- assets/feed.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/feed.xml b/assets/feed.xml index 0ab20e3b..d2aad4db 100644 --- a/assets/feed.xml +++ b/assets/feed.xml @@ -34,7 +34,7 @@ permalink: /feed.xml {{ post.date | date_to_xmlschema }} {% endif %} {{ post_absolute_url }} - + {{ post.author | default: site.social.name }} From 42dea8ee2986ee609ca6f2643a03bd29bd5456a3 Mon Sep 17 00:00:00 2001 From: Supreeth Mysore Venkatesh Date: Sun, 3 Nov 2024 17:45:59 +0100 Subject: [PATCH 067/177] build(deps): update `wdm` gem version for compatibility (#2028) --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 66f9337d..e5415748 100644 --- a/Gemfile +++ b/Gemfile @@ -11,4 +11,4 @@ platforms :mingw, :x64_mingw, :mswin, :jruby do gem "tzinfo-data" end -gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] +gem "wdm", "~> 0.2.0", :platforms => [:mingw, :x64_mingw, :mswin] From 2f844978aac587a8631c16d6907f24a8af6035a3 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 8 Nov 2024 22:15:31 +0800 Subject: [PATCH 068/177] chore: change stale label to `inactive` --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index bcf425ae..4f6e91cb 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -9,7 +9,7 @@ permissions: pull-requests: write env: - STALE_LABEL: stale + STALE_LABEL: inactive EXEMPT_LABELS: "pending,planning,in progress" MESSAGE: > This conversation has been automatically marked as stale because it has not had recent activity. From d51345e29754ba92a0c2fd6534bbd248ff298331 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 8 Nov 2024 22:35:18 +0800 Subject: [PATCH 069/177] ci: reduce unnecessary pr-filter runs (#2033) - Checking the repository of the PR is more effective than checking the label to identify bot-initiated PRs - This change also allows more flexible PR body definitions for developers with write access to the repository --- .github/workflows/pr-filter.yml | 1 + .github/workflows/scripts/pr-filter.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml index 42e1d640..8e9a18b7 100644 --- a/.github/workflows/pr-filter.yml +++ b/.github/workflows/pr-filter.yml @@ -6,6 +6,7 @@ on: jobs: check-template: + if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name runs-on: ubuntu-latest permissions: pull-requests: write diff --git a/.github/workflows/scripts/pr-filter.js b/.github/workflows/scripts/pr-filter.js index 97242016..03f50dc5 100644 --- a/.github/workflows/scripts/pr-filter.js +++ b/.github/workflows/scripts/pr-filter.js @@ -16,8 +16,7 @@ module.exports = async ({ github, context, core }) => { const action = context.payload.action; const isValid = - pr.labels.length > 0 || // PR create by Dependabot would have labels - (markdown !== '' && hasTypes(markdown) && hasDescription(markdown)); + markdown !== '' && hasTypes(markdown) && hasDescription(markdown); if (!isValid) { await github.rest.pulls.update({ From 65f960c31a734b5306a8b919040c3aae9b783efd Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 16 Nov 2024 22:49:55 +0800 Subject: [PATCH 070/177] perf: speed up page rendering and jekyll build process (#2034) - Ensure inline scripts execute after the DOM has fully loaded. - Use Rollup to bundle the theme-mode and Mermaid scripts, reducing the number of Jekyll include snippets. --- _includes/analytics/cloudflare.html | 1 - _includes/analytics/fathom.html | 5 +- _includes/analytics/google.html | 2 +- _includes/analytics/matomo.html | 13 +- _includes/{comments.html => comment.html} | 0 _includes/comments/disqus.html | 65 +++++---- _includes/comments/giscus.html | 44 ++---- _includes/comments/utterances.html | 63 ++++---- _includes/head.html | 25 +++- _includes/js-selector.html | 29 +--- _includes/jsdelivr-combine.html | 8 +- _includes/mermaid.html | 62 -------- _includes/mode-toggle.html | 116 --------------- _includes/search-loader.html | 42 +++--- _javascript/categories.js | 2 +- _javascript/home.js | 2 +- _javascript/misc.js | 2 +- .../modules/{plugins.js => components.js} | 4 + _javascript/modules/components/img-popup.js | 16 +-- _javascript/modules/components/mermaid.js | 60 ++++++++ _javascript/modules/components/mode-toggle.js | 15 ++ .../modules/components/mode-watcher.js | 14 -- _javascript/modules/components/sidebar.js | 22 --- _javascript/modules/layouts/basic.js | 4 +- _javascript/modules/layouts/sidebar.js | 20 ++- _javascript/modules/theme.js | 135 ++++++++++++++++++ _javascript/page.js | 8 +- _javascript/post.js | 6 +- _layouts/default.html | 8 +- _layouts/post.html | 3 +- _sass/layout/post.scss | 1 + package.json | 1 + rollup.config.js | 19 ++- 33 files changed, 410 insertions(+), 407 deletions(-) rename _includes/{comments.html => comment.html} (100%) delete mode 100644 _includes/mermaid.html delete mode 100644 _includes/mode-toggle.html rename _javascript/modules/{plugins.js => components.js} (60%) create mode 100644 _javascript/modules/components/mermaid.js create mode 100644 _javascript/modules/components/mode-toggle.js delete mode 100644 _javascript/modules/components/mode-watcher.js delete mode 100644 _javascript/modules/components/sidebar.js create mode 100644 _javascript/modules/theme.js diff --git a/_includes/analytics/cloudflare.html b/_includes/analytics/cloudflare.html index 1eeb1a92..9faa11ee 100644 --- a/_includes/analytics/cloudflare.html +++ b/_includes/analytics/cloudflare.html @@ -4,4 +4,3 @@ src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "{{ site.analytics.cloudflare.id }}"}' > - diff --git a/_includes/analytics/fathom.html b/_includes/analytics/fathom.html index 4b603d3a..216bb140 100644 --- a/_includes/analytics/fathom.html +++ b/_includes/analytics/fathom.html @@ -2,6 +2,5 @@ - + defer +> diff --git a/_includes/analytics/google.html b/_includes/analytics/google.html index d0aac651..dfe4828c 100644 --- a/_includes/analytics/google.html +++ b/_includes/analytics/google.html @@ -1,7 +1,7 @@ - diff --git a/_includes/comments.html b/_includes/comment.html similarity index 100% rename from _includes/comments.html rename to _includes/comment.html diff --git a/_includes/comments/disqus.html b/_includes/comments/disqus.html index 2b889a4e..fd12a3c7 100644 --- a/_includes/comments/disqus.html +++ b/_includes/comments/disqus.html @@ -1,38 +1,25 @@ - - -
-

Comments powered by Disqus.

-
- - diff --git a/_includes/comments/giscus.html b/_includes/comments/giscus.html index f9becfe9..80584720 100644 --- a/_includes/comments/giscus.html +++ b/_includes/comments/giscus.html @@ -1,21 +1,8 @@ - - - diff --git a/_includes/head.html b/_includes/head.html index af3acdb5..310f52eb 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -97,11 +97,32 @@ {% endif %} - + {% unless site.theme_mode %} - {% include mode-toggle.html %} + {% endunless %} + {% include js-selector.html lang=lang %} + + {% if jekyll.environment == 'production' %} + + {% if site.pwa.enabled %} + + {% endif %} + + + {% for analytics in site.analytics %} + {% capture str %}{{ analytics }}{% endcapture %} + {% assign platform = str | split: '{' | first %} + {% if site.analytics[platform].id and site.analytics[platform].id != empty %} + {% include analytics/{{ platform }}.html %} + {% endif %} + {% endfor %} + {% endif %} + {% include metadata-hook.html %} diff --git a/_includes/js-selector.html b/_includes/js-selector.html index 4d77d06b..fd4acca8 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -62,12 +62,12 @@ {% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %} - + {% if page.math %} - - + + {% endif %} @@ -84,26 +84,3 @@ {% endcase %} {% endif %} {% endif %} - -{% if page.mermaid %} - {% include mermaid.html %} -{% endif %} - -{% if jekyll.environment == 'production' %} - - {% if site.pwa.enabled %} - - {% endif %} - - - {% for analytics in site.analytics %} - {% capture str %}{{ analytics }}{% endcapture %} - {% assign type = str | split: '{' | first %} - {% if site.analytics[type].id and site.analytics[type].id != empty %} - {% include analytics/{{ type }}.html %} - {% endif %} - {% endfor %} -{% endif %} diff --git a/_includes/jsdelivr-combine.html b/_includes/jsdelivr-combine.html index cffa6995..0611213b 100644 --- a/_includes/jsdelivr-combine.html +++ b/_includes/jsdelivr-combine.html @@ -1,6 +1,6 @@ {% assign urls = include.urls | split: ',' %} -{% assign combined_urls = nil %} +{% assign combined_urls = null %} {% assign domain = 'https://cdn.jsdelivr.net/' %} @@ -15,12 +15,12 @@ {% endif %} {% elsif url contains '//' %} - + {% else %} - + {% endif %} {% endfor %} {% if combined_urls %} - + {% endif %} diff --git a/_includes/mermaid.html b/_includes/mermaid.html deleted file mode 100644 index a3a83edb..00000000 --- a/_includes/mermaid.html +++ /dev/null @@ -1,62 +0,0 @@ - - diff --git a/_includes/mode-toggle.html b/_includes/mode-toggle.html deleted file mode 100644 index 113ec375..00000000 --- a/_includes/mode-toggle.html +++ /dev/null @@ -1,116 +0,0 @@ - - - diff --git a/_includes/search-loader.html b/_includes/search-loader.html index 2582580a..7fd065d8 100644 --- a/_includes/search-loader.html +++ b/_includes/search-loader.html @@ -19,29 +19,31 @@

{title}

{% capture not_found %}

{{ site.data.locales[include.lang].search.no_results }}

{% endcapture %} diff --git a/_javascript/categories.js b/_javascript/categories.js index 15d82513..ce87d671 100644 --- a/_javascript/categories.js +++ b/_javascript/categories.js @@ -1,5 +1,5 @@ import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { categoryCollapse } from './modules/plugins'; +import { categoryCollapse } from './modules/components'; basic(); initSidebar(); diff --git a/_javascript/home.js b/_javascript/home.js index ef22cb97..7f628a17 100644 --- a/_javascript/home.js +++ b/_javascript/home.js @@ -1,5 +1,5 @@ import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { initLocaleDatetime, loadImg } from './modules/plugins'; +import { initLocaleDatetime, loadImg } from './modules/components'; loadImg(); initLocaleDatetime(); diff --git a/_javascript/misc.js b/_javascript/misc.js index 52b40438..37130da1 100644 --- a/_javascript/misc.js +++ b/_javascript/misc.js @@ -1,5 +1,5 @@ import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { initLocaleDatetime } from './modules/plugins'; +import { initLocaleDatetime } from './modules/components'; initSidebar(); initTopbar(); diff --git a/_javascript/modules/plugins.js b/_javascript/modules/components.js similarity index 60% rename from _javascript/modules/plugins.js rename to _javascript/modules/components.js index cc95c1bc..95791a69 100644 --- a/_javascript/modules/plugins.js +++ b/_javascript/modules/components.js @@ -4,3 +4,7 @@ export { loadImg } from './components/img-loading'; export { imgPopup } from './components/img-popup'; export { initLocaleDatetime } from './components/locale-datetime'; export { initToc } from './components/toc'; +export { loadMermaid } from './components/mermaid'; +export { modeWatcher } from './components/mode-toggle'; +export { back2top } from './components/back-to-top'; +export { loadTooptip } from './components/tooltip-loader'; diff --git a/_javascript/modules/components/img-popup.js b/_javascript/modules/components/img-popup.js index ac120435..420a2265 100644 --- a/_javascript/modules/components/img-popup.js +++ b/_javascript/modules/components/img-popup.js @@ -4,7 +4,6 @@ * Dependencies: https://github.com/biati-digital/glightbox */ -const html = document.documentElement; const lightImages = '.popup:not(.dark)'; const darkImages = '.popup:not(.light)'; let selector = lightImages; @@ -33,26 +32,17 @@ export function imgPopup() { document.querySelector('.popup.dark') === null ); - if ( - (html.hasAttribute('data-mode') && - html.getAttribute('data-mode') === 'dark') || - (!html.hasAttribute('data-mode') && - window.matchMedia('(prefers-color-scheme: dark)').matches) - ) { + if (Theme.visualState === Theme.DARK) { selector = darkImages; } let current = GLightbox({ selector: `${selector}` }); - if (hasDualImages && document.getElementById('mode-toggle')) { + if (hasDualImages && Theme.switchable) { let reverse = null; window.addEventListener('message', (event) => { - if ( - event.source === window && - event.data && - event.data.direction === ModeToggle.ID - ) { + if (event.source === window && event.data && event.data.id === Theme.ID) { updateImages(current, reverse); } }); diff --git a/_javascript/modules/components/mermaid.js b/_javascript/modules/components/mermaid.js new file mode 100644 index 00000000..2b4759f4 --- /dev/null +++ b/_javascript/modules/components/mermaid.js @@ -0,0 +1,60 @@ +/** + * Mermaid-js loader + */ + +const MERMAID = 'mermaid'; +const themeMapper = Theme.getThemeMapper('default', 'dark'); + +function refreshTheme(event) { + if (event.source === window && event.data && event.data.id === Theme.ID) { + // Re-render the SVG › + const mermaidList = document.getElementsByClassName(MERMAID); + + [...mermaidList].forEach((elem) => { + const svgCode = elem.previousSibling.children.item(0).innerHTML; + elem.textContent = svgCode; + elem.removeAttribute('data-processed'); + }); + + const newTheme = themeMapper[Theme.visualState]; + + mermaid.initialize({ theme: newTheme }); + mermaid.init(null, `.${MERMAID}`); + } +} + +function setNode(elem) { + const svgCode = elem.textContent; + const backup = elem.parentElement; + backup.classList.add('d-none'); + // Create mermaid node + const mermaid = document.createElement('pre'); + mermaid.classList.add(MERMAID); + const text = document.createTextNode(svgCode); + mermaid.appendChild(text); + backup.after(mermaid); +} + +export function loadMermaid() { + if ( + typeof mermaid === 'undefined' || + typeof mermaid.initialize !== 'function' + ) { + return; + } + + const initTheme = themeMapper[Theme.visualState]; + + let mermaidConf = { + theme: initTheme + }; + + const basicList = document.getElementsByClassName('language-mermaid'); + [...basicList].forEach(setNode); + + mermaid.initialize(mermaidConf); + + if (Theme.switchable) { + window.addEventListener('message', refreshTheme); + } +} diff --git a/_javascript/modules/components/mode-toggle.js b/_javascript/modules/components/mode-toggle.js new file mode 100644 index 00000000..455ff0a0 --- /dev/null +++ b/_javascript/modules/components/mode-toggle.js @@ -0,0 +1,15 @@ +/** + * Add listener for theme mode toggle + */ + +const $toggle = document.getElementById('mode-toggle'); + +export function modeWatcher() { + if (!$toggle) { + return; + } + + $toggle.addEventListener('click', () => { + Theme.flip(); + }); +} diff --git a/_javascript/modules/components/mode-watcher.js b/_javascript/modules/components/mode-watcher.js deleted file mode 100644 index 9eecd096..00000000 --- a/_javascript/modules/components/mode-watcher.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Add listener for theme mode toggle - */ -const toggle = document.getElementById('mode-toggle'); - -export function modeWatcher() { - if (!toggle) { - return; - } - - toggle.addEventListener('click', () => { - modeToggle.flipMode(); - }); -} diff --git a/_javascript/modules/components/sidebar.js b/_javascript/modules/components/sidebar.js deleted file mode 100644 index aed759ed..00000000 --- a/_javascript/modules/components/sidebar.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Expand or close the sidebar in mobile screens. - */ - -const $sidebar = document.getElementById('sidebar'); -const $trigger = document.getElementById('sidebar-trigger'); -const $mask = document.getElementById('mask'); - -class SidebarUtil { - static #isExpanded = false; - - static toggle() { - this.#isExpanded = !this.#isExpanded; - document.body.toggleAttribute('sidebar-display', this.#isExpanded); - $sidebar.classList.toggle('z-2', this.#isExpanded); - $mask.classList.toggle('d-none', !this.#isExpanded); - } -} - -export function sidebarExpand() { - $trigger.onclick = $mask.onclick = () => SidebarUtil.toggle(); -} diff --git a/_javascript/modules/layouts/basic.js b/_javascript/modules/layouts/basic.js index fb36a8b8..b8eddf61 100644 --- a/_javascript/modules/layouts/basic.js +++ b/_javascript/modules/layouts/basic.js @@ -1,7 +1,7 @@ -import { back2top } from '../components/back-to-top'; -import { loadTooptip } from '../components/tooltip-loader'; +import { back2top, loadTooptip, modeWatcher } from '../components'; export function basic() { + modeWatcher(); back2top(); loadTooptip(); } diff --git a/_javascript/modules/layouts/sidebar.js b/_javascript/modules/layouts/sidebar.js index 8795693c..bbf5e7da 100644 --- a/_javascript/modules/layouts/sidebar.js +++ b/_javascript/modules/layouts/sidebar.js @@ -1,7 +1,19 @@ -import { modeWatcher } from '../components/mode-watcher'; -import { sidebarExpand } from '../components/sidebar'; +const ATTR_DISPLAY = 'sidebar-display'; +const $sidebar = document.getElementById('sidebar'); +const $trigger = document.getElementById('sidebar-trigger'); +const $mask = document.getElementById('mask'); + +class SidebarUtil { + static #isExpanded = false; + + static toggle() { + this.#isExpanded = !this.#isExpanded; + document.body.toggleAttribute(ATTR_DISPLAY, this.#isExpanded); + $sidebar.classList.toggle('z-2', this.#isExpanded); + $mask.classList.toggle('d-none', !this.#isExpanded); + } +} export function initSidebar() { - modeWatcher(); - sidebarExpand(); + $trigger.onclick = $mask.onclick = () => SidebarUtil.toggle(); } diff --git a/_javascript/modules/theme.js b/_javascript/modules/theme.js new file mode 100644 index 00000000..f9ebf202 --- /dev/null +++ b/_javascript/modules/theme.js @@ -0,0 +1,135 @@ +/** + * Theme management class + * + * To reduce flickering during page load, this script should be loaded synchronously. + */ +class Theme { + static #modeKey = 'mode'; + static #modeAttr = 'data-mode'; + static #darkMedia = window.matchMedia('(prefers-color-scheme: dark)'); + static switchable = !document.documentElement.hasAttribute(this.#modeAttr); + + static get DARK() { + return 'dark'; + } + + static get LIGHT() { + return 'light'; + } + + /** + * @returns {string} Theme mode identifier + */ + static get ID() { + return 'theme-mode'; + } + + /** + * Gets the current visual state of the theme. + * + * @returns {string} The current visual state, either the mode if it exists, + * or the system dark mode state ('dark' or 'light'). + */ + static get visualState() { + if (this.#hasMode) { + return this.#mode; + } else { + return this.#sysDark ? this.DARK : this.LIGHT; + } + } + + static get #mode() { + return sessionStorage.getItem(this.#modeKey); + } + + static get #isDarkMode() { + return this.#mode === this.DARK; + } + + static get #hasMode() { + return this.#mode !== null; + } + + static get #sysDark() { + return this.#darkMedia.matches; + } + + /** + * Maps theme modes to provided values + * @param {string} light Value for light mode + * @param {string} dark Value for dark mode + * @returns {Object} Mapped values + */ + static getThemeMapper(light, dark) { + return { + [this.LIGHT]: light, + [this.DARK]: dark + }; + } + + /** + * Initializes the theme based on system preferences or stored mode + */ + static init() { + if (!this.switchable) { + return; + } + + this.#darkMedia.addEventListener('change', () => { + const lastMode = this.#mode; + this.#clearMode(); + + if (lastMode !== this.visualState) { + this.#notify(); + } + }); + + if (!this.#hasMode) { + return; + } + + if (this.#isDarkMode) { + this.#setDark(); + } else { + this.#setLight(); + } + } + + /** + * Flips the current theme mode + */ + static flip() { + if (this.#hasMode) { + this.#clearMode(); + } else { + this.#sysDark ? this.#setLight() : this.#setDark(); + } + this.#notify(); + } + + static #setDark() { + document.documentElement.setAttribute(this.#modeAttr, this.DARK); + sessionStorage.setItem(this.#modeKey, this.DARK); + } + + static #setLight() { + document.documentElement.setAttribute(this.#modeAttr, this.LIGHT); + sessionStorage.setItem(this.#modeKey, this.LIGHT); + } + + static #clearMode() { + document.documentElement.removeAttribute(this.#modeAttr); + sessionStorage.removeItem(this.#modeKey); + } + + /** + * Notifies other plugins that the theme mode has changed + */ + static #notify() { + window.postMessage({ id: this.ID }, '*'); + } +} + +Theme.init(); + +export default Theme; diff --git a/_javascript/page.js b/_javascript/page.js index 76e8ce97..4b03b790 100644 --- a/_javascript/page.js +++ b/_javascript/page.js @@ -1,9 +1,15 @@ import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { loadImg, imgPopup, initClipboard } from './modules/plugins'; +import { + loadImg, + imgPopup, + initClipboard, + loadMermaid +} from './modules/components'; loadImg(); imgPopup(); initSidebar(); initTopbar(); initClipboard(); +loadMermaid(); basic(); diff --git a/_javascript/post.js b/_javascript/post.js index 1c616ecd..dc472b42 100644 --- a/_javascript/post.js +++ b/_javascript/post.js @@ -5,8 +5,9 @@ import { imgPopup, initLocaleDatetime, initClipboard, - initToc -} from './modules/plugins'; + initToc, + loadMermaid +} from './modules/components'; loadImg(); initToc(); @@ -15,4 +16,5 @@ initSidebar(); initLocaleDatetime(); initClipboard(); initTopbar(); +loadMermaid(); basic(); diff --git a/_layouts/default.html b/_layouts/default.html index 1590ef62..c83c561c 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -74,8 +74,12 @@ {% include_cached notification.html lang=lang %} {% endif %} - - {% include js-selector.html lang=lang %} + + + {% for _include in layout.script_includes %} + {% assign _include_path = _include | append: '.html' %} + {% include {{ _include_path }} %} + {% endfor %} {% include_cached search-loader.html lang=lang %} diff --git a/_layouts/post.html b/_layouts/post.html index 6a2deff7..c8c21ef7 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -6,7 +6,8 @@ tail_includes: - related-posts - post-nav - - comments +script_includes: + - comment --- {% include lang.html %} diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index b66e906c..891479e6 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -532,6 +532,7 @@ header { .utterances { max-width: 100%; + min-height: 269px; } %btn-share-hover { diff --git a/package.json b/package.json index f93e76b3..34477845 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "devDependencies": { "@babel/core": "^7.25.2", "@babel/plugin-transform-class-properties": "^7.25.4", + "@babel/plugin-transform-private-methods": "^7.25.7", "@babel/preset-env": "^7.25.4", "@commitlint/cli": "^19.5.0", "@commitlint/config-conventional": "^19.5.0", diff --git a/rollup.config.js b/rollup.config.js index 19ba4da0..3a1ae29a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -34,24 +34,32 @@ function insertFrontmatter() { }; } -function build(filename, { src = SRC_DEFAULT, jekyll = false } = {}) { +function build( + filename, + { src = SRC_DEFAULT, jekyll = false, outputName = null } = {} +) { + const input = `${src}/${filename}.js`; + return { - input: `${src}/${filename}.js`, + input, output: { file: `${DIST}/${filename}.min.js`, format: 'iife', - name: 'Chirpy', + ...(outputName !== null && { name: outputName }), banner, sourcemap: !isProd && !jekyll }, watch: { - include: `${src}/**` + include: input }, plugins: [ babel({ babelHelpers: 'bundled', presets: ['@babel/env'], - plugins: ['@babel/plugin-transform-class-properties'] + plugins: [ + '@babel/plugin-transform-class-properties', + '@babel/plugin-transform-private-methods' + ] }), nodeResolve(), isProd && terser(), @@ -69,6 +77,7 @@ export default [ build('page'), build('post'), build('misc'), + build('theme', { src: `${SRC_DEFAULT}/modules`, outputName: 'Theme' }), build('app', { src: SRC_PWA, jekyll: true }), build('sw', { src: SRC_PWA, jekyll: true }) ]; From c69914effc1f222d2b31d2ed14d1efda90575c9f Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 24 Nov 2024 02:08:13 +0800 Subject: [PATCH 071/177] ci: avoid repeated runs of stylelint (#2057) --- .github/workflows/style-lint.yml | 25 ----------------------- .stylelintrc.json | 30 +++++++++++++++++++++++++++ package.json | 35 -------------------------------- 3 files changed, 30 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/style-lint.yml create mode 100644 .stylelintrc.json diff --git a/.github/workflows/style-lint.yml b/.github/workflows/style-lint.yml deleted file mode 100644 index 5cb38a7a..00000000 --- a/.github/workflows/style-lint.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Style Lint - -on: - push: - branches: - - master - - "hotfix/*" - paths: ["_sass/**/*.scss"] - pull_request: - paths: ["_sass/**/*.scss"] - -jobs: - stylelint: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: lts/* - - run: npm i - - run: npm test diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 00000000..57dd7d6e --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,30 @@ +{ + "extends": "stylelint-config-standard-scss", + "rules": { + "no-descending-specificity": null, + "shorthand-property-no-redundant-values": null, + "at-rule-no-vendor-prefix": null, + "property-no-vendor-prefix": null, + "selector-no-vendor-prefix": null, + "value-no-vendor-prefix": null, + "color-function-notation": "legacy", + "alpha-value-notation": "number", + "selector-not-notation": "simple", + "color-hex-length": "long", + "declaration-block-single-line-max-declarations": 3, + "scss/operator-no-newline-after": null, + "rule-empty-line-before": [ + "always", + { + "ignore": ["after-comment", "first-nested"] + } + ], + "value-keyword-case": [ + "lower", + { + "ignoreProperties": ["/^\\$/"] + } + ], + "media-feature-range-notation": "prefix" + } +} diff --git a/package.json b/package.json index 34477845..d6beea03 100644 --- a/package.json +++ b/package.json @@ -68,41 +68,6 @@ ] } }, - "stylelint": { - "extends": "stylelint-config-standard-scss", - "rules": { - "no-descending-specificity": null, - "shorthand-property-no-redundant-values": null, - "at-rule-no-vendor-prefix": null, - "property-no-vendor-prefix": null, - "selector-no-vendor-prefix": null, - "value-no-vendor-prefix": null, - "color-function-notation": "legacy", - "alpha-value-notation": "number", - "selector-not-notation": "simple", - "color-hex-length": "long", - "declaration-block-single-line-max-declarations": 3, - "scss/operator-no-newline-after": null, - "rule-empty-line-before": [ - "always", - { - "ignore": [ - "after-comment", - "first-nested" - ] - } - ], - "value-keyword-case": [ - "lower", - { - "ignoreProperties": [ - "/^\\$/" - ] - } - ], - "media-feature-range-notation": "prefix" - } - }, "release": { "branches": [ "production" From 35c794cf5896565430389f35c660b88a93cebb17 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 25 Nov 2024 00:05:28 +0800 Subject: [PATCH 072/177] perf: modular sass architecture (#2052) - Modularized the Sass architecture to enhance code maintainability and reduce the output file size - Replaced deprecated `@import` with `@use` / `@forward` --- .gitignore | 2 +- .stylelintrc.json | 1 + _includes/head.html | 2 +- _posts/2019-08-09-getting-started.md | 2 - _sass/abstracts/_breakpoints.scss | 73 + _sass/abstracts/_index.scss | 4 + _sass/abstracts/_mixins.scss | 80 + .../_placeholders.scss} | 83 +- .../_variables.scss} | 4 - _sass/addon/commons.scss | 1526 ----------------- _sass/base/_base.scss | 476 +++++ _sass/base/_index.scss | 4 + _sass/base/_reset.scss | 41 + .../{addon/syntax.scss => base/_syntax.scss} | 131 +- _sass/base/_typography.scss | 266 +++ _sass/colors/syntax-dark.scss | 164 -- _sass/colors/syntax-light.scss | 210 --- _sass/colors/typography-light.scss | 112 -- _sass/components/_buttons.scss | 51 + _sass/components/_index.scss | 2 + _sass/components/_popups.scss | 172 ++ _sass/layout/_footer.scss | 36 + _sass/layout/_index.scss | 4 + _sass/layout/_panel.scss | 66 + _sass/layout/_sidebar.scss | 258 +++ _sass/layout/_topbar.scss | 86 + _sass/main.bundle.scss | 4 +- _sass/main.scss | 17 +- .../archives.scss => pages/_archives.scss} | 23 +- .../_categories.scss} | 11 +- .../_category-tag.scss} | 29 +- _sass/{layout/home.scss => pages/_home.scss} | 119 +- _sass/pages/_index.scss | 7 + _sass/{layout/post.scss => pages/_post.scss} | 219 +-- _sass/pages/_search.scss | 184 ++ _sass/{layout/tags.scss => pages/_tags.scss} | 10 +- .../_dark.scss} | 168 +- _sass/themes/_light.scss | 313 ++++ _sass/variables-hook.scss | 3 - assets/css/jekyll-theme-chirpy.scss | 2 +- package.json | 2 +- purgecss.config.js | 23 - purgecss.js | 30 + tools/init.sh | 3 +- tools/release.sh | 2 +- 45 files changed, 2523 insertions(+), 2502 deletions(-) create mode 100644 _sass/abstracts/_breakpoints.scss create mode 100644 _sass/abstracts/_index.scss create mode 100644 _sass/abstracts/_mixins.scss rename _sass/{addon/module.scss => abstracts/_placeholders.scss} (59%) rename _sass/{addon/variables.scss => abstracts/_variables.scss} (96%) delete mode 100644 _sass/addon/commons.scss create mode 100644 _sass/base/_base.scss create mode 100644 _sass/base/_index.scss create mode 100644 _sass/base/_reset.scss rename _sass/{addon/syntax.scss => base/_syntax.scss} (74%) create mode 100644 _sass/base/_typography.scss delete mode 100644 _sass/colors/syntax-dark.scss delete mode 100644 _sass/colors/syntax-light.scss delete mode 100644 _sass/colors/typography-light.scss create mode 100644 _sass/components/_buttons.scss create mode 100644 _sass/components/_index.scss create mode 100644 _sass/components/_popups.scss create mode 100644 _sass/layout/_footer.scss create mode 100644 _sass/layout/_index.scss create mode 100644 _sass/layout/_panel.scss create mode 100644 _sass/layout/_sidebar.scss create mode 100644 _sass/layout/_topbar.scss rename _sass/{layout/archives.scss => pages/_archives.scss} (95%) rename _sass/{layout/categories.scss => pages/_categories.scss} (87%) rename _sass/{layout/category-tag.scss => pages/_category-tag.scss} (79%) rename _sass/{layout/home.scss => pages/_home.scss} (73%) create mode 100644 _sass/pages/_index.scss rename _sass/{layout/post.scss => pages/_post.scss} (67%) create mode 100644 _sass/pages/_search.scss rename _sass/{layout/tags.scss => pages/_tags.scss} (71%) rename _sass/{colors/typography-dark.scss => themes/_dark.scss} (62%) create mode 100644 _sass/themes/_light.scss delete mode 100644 _sass/variables-hook.scss delete mode 100644 purgecss.config.js create mode 100644 purgecss.js diff --git a/.gitignore b/.gitignore index 0082d900..7dd7cefd 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,5 @@ package-lock.json !.vscode/tasks.json # Misc -_sass/dist +_sass/vendors assets/js/dist diff --git a/.stylelintrc.json b/.stylelintrc.json index 57dd7d6e..b8902909 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,4 +1,5 @@ { + "ignoreFiles": ["_sass/vendors/**"], "extends": "stylelint-config-standard-scss", "rules": { "no-descending-specificity": null, diff --git a/_includes/head.html b/_includes/head.html index 310f52eb..011187c9 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -70,7 +70,7 @@ {% unless jekyll.environment == 'production' %} - + {% endunless %} diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 3b41a3ca..26811269 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -93,8 +93,6 @@ Social contact options are displayed at the bottom of the sidebar. You can enabl To customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} file to the same path in your Jekyll site, and add your custom styles at the end of the file. -Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main SASS file `_sass/main.scss`{: .filepath} to the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign your new values there. - ### Customizing Static Assets Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on the network conditions in the region where your website is published. diff --git a/_sass/abstracts/_breakpoints.scss b/_sass/abstracts/_breakpoints.scss new file mode 100644 index 00000000..e40cefee --- /dev/null +++ b/_sass/abstracts/_breakpoints.scss @@ -0,0 +1,73 @@ +@use 'sass:map'; + +$-breakpoints: ( + // 1 column + sm: 576px, + md: 768px, + // 2 columns + lg: 850px, + // 3 columns + xl: 1200px, + xxl: 1400px, + xxxl: 1650px +); + +@function get($breakpoint) { + @return map.get($-breakpoints, $breakpoint); +} + +/* Less than the given width */ +@mixin lt($width) { + @media all and (max-width: calc(#{$width} - 1px)) { + @content; + } +} + +/* Less than or equal to the given width */ +@mixin lte($width) { + @media all and (max-width: $width) { + @content; + } +} + +@mixin sm { + @media all and (min-width: get(sm)) { + @content; + } +} + +@mixin md { + @media all and (min-width: get(md)) { + @content; + } +} + +@mixin lg { + @media all and (min-width: get(lg)) { + @content; + } +} + +@mixin xl { + @media all and (min-width: get(xl)) { + @content; + } +} + +@mixin xxl { + @media all and (min-width: get(xxl)) { + @content; + } +} + +@mixin xxxl { + @media all and (min-width: get(xxxl)) { + @content; + } +} + +@mixin between($min, $max) { + @media all and (min-width: $min) and (max-width: $max) { + @content; + } +} diff --git a/_sass/abstracts/_index.scss b/_sass/abstracts/_index.scss new file mode 100644 index 00000000..6c9e21cf --- /dev/null +++ b/_sass/abstracts/_index.scss @@ -0,0 +1,4 @@ +@forward 'variables'; +@forward 'mixins'; +@forward 'placeholders'; +@forward 'breakpoints'; diff --git a/_sass/abstracts/_mixins.scss b/_sass/abstracts/_mixins.scss new file mode 100644 index 00000000..c5eeee3c --- /dev/null +++ b/_sass/abstracts/_mixins.scss @@ -0,0 +1,80 @@ +@mixin text-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +@mixin mt-mb($value) { + margin-top: $value; + margin-bottom: $value; +} + +@mixin ml-mr($value) { + margin-left: $value; + margin-right: $value; +} + +@mixin pt-pb($val) { + padding-top: $val; + padding-bottom: $val; +} + +@mixin pl-pr($val, $important: false) { + @if $important { + padding-left: $val !important; + padding-right: $val !important; + } @else { + padding-left: $val; + padding-right: $val; + } +} + +@mixin placeholder { + color: var(--text-muted-color) !important; +} + +@mixin placeholder-focus { + opacity: 0.6; +} + +@mixin label($font-size: 1rem, $font-weight: 600, $color: var(--label-color)) { + color: $color; + font-size: $font-size; + font-weight: $font-weight; +} + +@mixin align-center { + position: relative; + left: 50%; + transform: translateX(-50%); +} + +@mixin prompt($type, $fa-content, $fa-style: 'solid', $rotate: 0) { + &.prompt-#{$type} { + background-color: var(--prompt-#{$type}-bg); + + &::before { + content: $fa-content; + color: var(--prompt-#{$type}-icon-color); + font: var(--fa-font-#{$fa-style}); + + @if $rotate != 0 { + transform: rotate(#{$rotate}deg); + } + } + } +} + +@mixin slide($append: null) { + $basic: transform 0.4s ease; + + @if $append { + transition: $basic, $append; + } @else { + transition: $basic; + } +} + +@mixin max-w-100 { + max-width: 100%; +} diff --git a/_sass/addon/module.scss b/_sass/abstracts/_placeholders.scss similarity index 59% rename from _sass/addon/module.scss rename to _sass/abstracts/_placeholders.scss index 1dfb735f..e4c1bb06 100644 --- a/_sass/addon/module.scss +++ b/_sass/abstracts/_placeholders.scss @@ -1,13 +1,10 @@ -/* -* Mainly scss modules, only imported to `assets/css/main.scss` -*/ - -/* ---------- scss placeholder --------- */ +@use 'variables' as v; +@use 'mixins' as mx; %heading { color: var(--heading-color); font-weight: 400; - font-family: $font-family-heading; + font-family: v.$font-family-heading; scroll-margin-top: 3.5rem; } @@ -82,7 +79,7 @@ } %rounded { - border-radius: $radius-lg; + border-radius: v.$radius-lg; } %img-caption { @@ -112,14 +109,8 @@ -webkit-box-orient: vertical; } -@mixin text-ellipsis { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - %text-ellipsis { - @include text-ellipsis; + @include mx.text-ellipsis; } %text-highlight { @@ -151,65 +142,15 @@ } } -/* ---------- scss mixin --------- */ - -@mixin mt-mb($value) { - margin-top: $value; - margin-bottom: $value; +%code-snippet-bg { + background-color: var(--highlight-bg-color); } -@mixin ml-mr($value) { - margin-left: $value; - margin-right: $value; +%code-snippet-padding { + padding-left: 1rem; + padding-right: 1.5rem; } -@mixin pt-pb($val) { - padding-top: $val; - padding-bottom: $val; -} - -@mixin pl-pr($val, $important: false) { - @if $important { - padding-left: $val !important; - padding-right: $val !important; - } @else { - padding-left: $val; - padding-right: $val; - } -} - -@mixin placeholder { - color: var(--text-muted-color) !important; -} - -@mixin placeholder-focus { - opacity: 0.6; -} - -@mixin label($font-size: 1rem, $font-weight: 600, $color: var(--label-color)) { - color: $color; - font-size: $font-size; - font-weight: $font-weight; -} - -@mixin align-center { - position: relative; - left: 50%; - transform: translateX(-50%); -} - -@mixin prompt($type, $fa-content, $fa-style: 'solid', $rotate: 0) { - &.prompt-#{$type} { - background-color: var(--prompt-#{$type}-bg); - - &::before { - content: $fa-content; - color: var(--prompt-#{$type}-icon-color); - font: var(--fa-font-#{$fa-style}); - - @if $rotate != 0 { - transform: rotate(#{$rotate}deg); - } - } - } +%max-w-100 { + max-width: 100%; } diff --git a/_sass/addon/variables.scss b/_sass/abstracts/_variables.scss similarity index 96% rename from _sass/addon/variables.scss rename to _sass/abstracts/_variables.scss index 1d51cb14..0194e40b 100644 --- a/_sass/addon/variables.scss +++ b/_sass/abstracts/_variables.scss @@ -1,7 +1,3 @@ -/* - * The SCSS variables - */ - /* sidebar */ $sidebar-width: 260px !default; /* the basic width */ diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss deleted file mode 100644 index 5e8aceaa..00000000 --- a/_sass/addon/commons.scss +++ /dev/null @@ -1,1526 +0,0 @@ -/* The common styles */ - -html { - font-size: 16px; - - @media (prefers-color-scheme: light) { - &:not([data-mode]), - &[data-mode='light'] { - @include light-scheme; - } - - &[data-mode='dark'] { - @include dark-scheme; - } - } - - @media (prefers-color-scheme: dark) { - &:not([data-mode]), - &[data-mode='dark'] { - @include dark-scheme; - } - - &[data-mode='light'] { - @include light-scheme; - } - } -} - -body { - background: var(--main-bg); - padding: env(safe-area-inset-top) env(safe-area-inset-right) - env(safe-area-inset-bottom) env(safe-area-inset-left); - color: var(--text-color); - -webkit-font-smoothing: antialiased; - font-family: $font-family-base; -} - -/* --- Typography --- */ - -@for $i from 1 through 5 { - h#{$i} { - @extend %heading; - - @if $i > 1 { - @extend %anchor; - } - - @if $i < 5 { - $size-factor: 0.25rem; - - @if $i > 1 { - $size-factor: 0.18rem; - - main & { - @if $i == 2 { - margin: 2.5rem 0 1.25rem; - } @else { - margin: 2rem 0 1rem; - } - } - } - - & { - font-size: 1rem + (5 - $i) * $size-factor; - } - } @else { - font-size: 1.05rem; - } - } -} - -a { - @extend %link-color; - - text-decoration: none; -} - -img { - max-width: 100%; - height: auto; - transition: all 0.35s ease-in-out; - - .blur & { - $blur: 20px; - - -webkit-filter: blur($blur); - filter: blur($blur); - } -} - -blockquote { - border-left: 0.125rem solid var(--blockquote-border-color); - padding-left: 1rem; - color: var(--blockquote-text-color); - margin-top: 0.5rem; - - > p:last-child { - margin-bottom: 0; - } - - &[class^='prompt-'] { - border-left: 0; - position: relative; - padding: 1rem 1rem 1rem 3rem; - color: var(--prompt-text-color); - - @extend %rounded; - - &::before { - text-align: center; - width: 3rem; - position: absolute; - left: 0.25rem; - margin-top: 0.4rem; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - } - } - - @include prompt('tip', '\f0eb', $fa-style: 'regular'); - @include prompt('info', '\f06a', $rotate: 180); - @include prompt('warning', '\f06a'); - @include prompt('danger', '\f071'); -} - -kbd { - font-family: Lato, sans-serif; - display: inline-block; - vertical-align: middle; - line-height: 1.3rem; - min-width: 1.75rem; - text-align: center; - margin: 0 0.3rem; - padding-top: 0.1rem; - color: var(--kbd-text-color); - background-color: var(--kbd-bg-color); - border-radius: $radius-sm; - border: solid 1px var(--kbd-wrap-color); - box-shadow: inset 0 -2px 0 var(--kbd-wrap-color); -} - -hr { - border-color: var(--main-border-color); - opacity: 1; -} - -footer { - background-color: var(--main-bg); - height: $footer-height; - border-top: 1px solid var(--main-border-color); - - @extend %text-xs; - - a { - @extend %text-highlight; - - &:hover { - @extend %link-hover; - } - } - - em { - @extend %text-highlight; - } - - p { - text-align: center; - margin-bottom: 0; - } -} - -/* fontawesome icons */ -i { - &.far, - &.fas { - @extend %no-cursor; - } -} - -/* --- Panels --- */ - -.access { - top: 2rem; - transition: top 0.2s ease-in-out; - margin-top: 3rem; - margin-bottom: 4rem; - - &:only-child { - position: -webkit-sticky; - position: sticky; - } - - > section { - padding-left: 1rem; - border-left: 1px solid var(--main-border-color); - - &:not(:last-child) { - margin-bottom: 4rem; - } - } - - .content { - font-size: 0.9rem; - } -} - -#panel-wrapper { - /* the headings */ - .panel-heading { - font-family: inherit; - line-height: inherit; - - @include label(inherit); - } - - .post-tag { - line-height: 1.05rem; - font-size: 0.85rem; - border-radius: 0.8rem; - padding: 0.3rem 0.5rem; - margin: 0 0.35rem 0.5rem 0; - - &:hover { - transition: all 0.3s ease-in; - } - } -} - -#access-lastmod { - a { - color: inherit; - - &:hover { - @extend %link-hover; - } - - @extend %no-bottom-border; - } -} - -.footnotes > ol { - padding-left: 2rem; - margin-top: 0.5rem; - - > li { - &:not(:last-child) { - margin-bottom: 0.3rem; - } - - @extend %sup-fn-target; - - > p { - margin-left: 0.25em; - - @include mt-mb(0); - } - } -} - -.footnote { - @at-root a#{&} { - @include ml-mr(1px); - @include pl-pr(2px); - - border-bottom-style: none !important; - } -} - -sup { - @extend %sup-fn-target; -} - -.reversefootnote { - @at-root a#{&} { - font-size: 0.6rem; - line-height: 1; - position: relative; - bottom: 0.25em; - margin-left: 0.25em; - border-bottom-style: none !important; - } -} - -/* --- Begin of Markdown table style --- */ - -/* it will be created by Liquid */ -.table-wrapper { - overflow-x: auto; - margin-bottom: 1.5rem; - - > table { - min-width: 100%; - overflow-x: auto; - border-spacing: 0; - - thead { - border-bottom: solid 2px rgba(210, 215, 217, 0.75); - - th { - @extend %table-cell; - } - } - - tbody { - tr { - border-bottom: 1px solid var(--tb-border-color); - - &:nth-child(2n) { - background-color: var(--tb-even-bg); - } - - &:nth-child(2n + 1) { - background-color: var(--tb-odd-bg); - } - - td { - @extend %table-cell; - } - } - } /* tbody */ - } /* table */ -} - -/* --- post --- */ - -.preview-img { - aspect-ratio: 40 / 21; - width: 100%; - height: 100%; - overflow: hidden; - - @extend %rounded; - - &:not(.no-bg) { - background: var(--img-bg); - } - - img { - height: 100%; - -o-object-fit: cover; - object-fit: cover; - - @extend %rounded; - - @at-root #post-list & { - width: 100%; - } - } -} - -.post-preview { - @extend %rounded; - - border: 0; - background: var(--card-bg); - box-shadow: var(--card-shadow); - - &::before { - @extend %rounded; - - content: ''; - width: 100%; - height: 100%; - position: absolute; - background-color: var(--card-hovor-bg); - opacity: 0; - transition: opacity 0.35s ease-in-out; - } - - &:hover { - &::before { - opacity: 0.3; - } - } -} - -main { - line-height: 1.75; - - h1 { - margin-top: 2rem; - } - - p { - > a.popup { - &:not(.normal):not(.left):not(.right) { - @include align-center; - } - } - } - - .categories, - #tags, - #archives { - a:not(:hover) { - @extend %no-bottom-border; - } - } -} - -.post-meta { - @extend %text-sm; - - a { - &:not([class]):hover { - @extend %link-hover; - } - } - - em { - @extend %normal-font-style; - } -} - -.content { - font-size: 1.08rem; - margin-top: 2rem; - overflow-wrap: break-word; - - a { - &.popup { - @extend %no-cursor; - @extend %img-caption; - @include mt-mb(0.5rem); - - cursor: zoom-in; - } - - &:not(.img-link) { - @extend %link-underline; - - &:hover { - @extend %link-hover; - } - } - } - - ol, - ul { - &:not([class]), - &.task-list { - -webkit-padding-start: 1.75rem; - padding-inline-start: 1.75rem; - - li { - margin: 0.25rem 0; - padding-left: 0.25rem; - } - - ol, - ul { - -webkit-padding-start: 1.25rem; - padding-inline-start: 1.25rem; - margin: 0.5rem 0; - } - } - } - - ul.task-list { - -webkit-padding-start: 1.25rem; - padding-inline-start: 1.25rem; - - li { - list-style-type: none; - padding-left: 0; - - /* checkbox icon */ - > i { - width: 2rem; - margin-left: -1.25rem; - color: var(--checkbox-color); - - &.checked { - color: var(--checkbox-checked-color); - } - } - - ul { - -webkit-padding-start: 1.75rem; - padding-inline-start: 1.75rem; - } - } - - input[type='checkbox'] { - margin: 0 0.5rem 0.2rem -1.3rem; - vertical-align: middle; - } - } /* ul */ - - dl > dd { - margin-left: 1rem; - } - - ::marker { - color: var(--text-muted-color); - } -} /* .content */ - -.tag:hover { - @extend %tag-hover; -} - -.post-tag { - display: inline-block; - min-width: 2rem; - text-align: center; - border-radius: 0.5rem; - border: 1px solid var(--btn-border-color); - padding: 0 0.4rem; - color: var(--text-muted-color); - line-height: 1.3rem; - - &:not(:last-child) { - margin-right: 0.2rem; - } -} - -.rounded-10 { - border-radius: 10px !important; -} - -.img-link { - color: transparent; - display: inline-flex; -} - -.shimmer { - overflow: hidden; - position: relative; - background: var(--img-bg); - - &::before { - content: ''; - position: absolute; - background: var(--shimmer-bg); - height: 100%; - width: 100%; - -webkit-animation: shimmer 1.3s infinite; - animation: shimmer 1.3s infinite; - } - - @-webkit-keyframes shimmer { - 0% { - transform: translateX(-100%); - } - - 100% { - transform: translateX(100%); - } - } - - @keyframes shimmer { - 0% { - transform: translateX(-100%); - } - - 100% { - transform: translateX(100%); - } - } -} - -.embed-video { - width: 100%; - height: 100%; - margin-bottom: 1rem; - aspect-ratio: 16 / 9; - - @extend %rounded; - - &.twitch { - aspect-ratio: 310 / 189; - } - - &.file { - display: block; - width: auto; - height: auto; - max-width: 100%; - max-height: 100%; - margin: auto; - margin-bottom: 0; - } - - @extend %img-caption; -} - -.embed-audio { - width: 100%; - display: block; - - @extend %img-caption; -} - -/* --- buttons --- */ -.btn-lang { - border: 1px solid !important; - padding: 1px 3px; - border-radius: 3px; - color: var(--link-color); - - &:focus { - box-shadow: none; - } -} - -/* --- Effects classes --- */ - -.flex-grow-1 { - flex-grow: 1 !important; -} - -.btn-box-shadow { - box-shadow: var(--card-shadow); -} - -/* overwrite bootstrap muted */ -.text-muted { - color: var(--text-muted-color) !important; -} - -/* Overwrite bootstrap tooltip */ -.tooltip-inner { - font-size: 0.7rem; - max-width: 220px; - text-align: left; -} - -/* Overwrite bootstrap outline button */ -.btn.btn-outline-primary { - &:not(.disabled):hover { - border-color: #007bff !important; - } -} - -.disabled { - color: rgb(206, 196, 196); - pointer-events: auto; - cursor: not-allowed; -} - -.hide-border-bottom { - border-bottom: none !important; -} - -.input-focus { - box-shadow: none; - border-color: var(--input-focus-border-color) !important; - background: center !important; - transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out; -} - -.left { - float: left; - margin: 0.75rem 1rem 1rem 0; -} - -.right { - float: right; - margin: 0.75rem 0 1rem 1rem; -} - -/* --- Overriding --- */ - -/* mermaid */ -.mermaid { - text-align: center; -} - -/* MathJax */ -mjx-container { - overflow-y: hidden; - min-width: auto !important; -} - -/* --- sidebar layout --- */ - -$sidebar-display: 'sidebar-display'; -$btn-border-width: 3px; -$btn-mb: 0.5rem; - -#sidebar { - @include pl-pr(0); - - position: fixed; - top: 0; - left: 0; - height: 100%; - overflow-y: auto; - width: $sidebar-width; - background: var(--sidebar-bg); - border-right: 1px solid var(--sidebar-border-color); - - /* Hide scrollbar for IE, Edge and Firefox */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ - - /* Hide scrollbar for Chrome, Safari and Opera */ - &::-webkit-scrollbar { - display: none; - } - - %sidebar-link-hover { - &:hover { - color: var(--sidebar-active-color); - } - } - - a { - @extend %sidebar-links; - } - - #avatar { - display: block; - width: 7rem; - height: 7rem; - overflow: hidden; - box-shadow: var(--avatar-border-color) 0 0 0 2px; - transform: translateZ(0); /* fixed the zoom in Safari */ - - img { - transition: transform 0.5s; - - &:hover { - transform: scale(1.2); - } - } - } - - .profile-wrapper { - @include mt-mb(2.5rem); - @extend %clickable-transition; - - padding-left: 2.5rem; - padding-right: 1.25rem; - width: 100%; - } - - .site-title { - @extend %clickable-transition; - @extend %sidebar-link-hover; - - font-family: inherit; - font-weight: 900; - font-size: 1.75rem; - line-height: 1.2; - letter-spacing: 0.25px; - margin-top: 1.25rem; - margin-bottom: 0.5rem; - width: fit-content; - color: var(--site-title-color); - } - - .site-subtitle { - font-size: 95%; - color: var(--site-subtitle-color); - margin-top: 0.25rem; - word-spacing: 1px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - - ul { - margin-bottom: 2rem; - - li.nav-item { - opacity: 0.9; - width: 100%; - - @include pl-pr(1.5rem); - - a.nav-link { - @include pt-pb(0.6rem); - - display: flex; - align-items: center; - border-radius: 0.75rem; - font-weight: 600; - - &:hover { - background-color: var(--sidebar-hover-bg); - } - - i { - font-size: 95%; - opacity: 0.8; - margin-right: 1.5rem; - } - - span { - font-size: 90%; - letter-spacing: 0.2px; - } - } - - &.active { - .nav-link { - color: var(--sidebar-active-color); - background-color: var(--sidebar-hover-bg); - - span { - opacity: 1; - } - } - } - - &:not(:first-child) { - margin-top: 0.25rem; - } - } - } - - .sidebar-bottom { - padding-left: 2rem; - padding-right: 1rem; - margin-bottom: 1.5rem; - - $btn-size: 1.75rem; - - %button { - width: $btn-size; - height: $btn-size; - margin-bottom: $btn-mb; // multi line gap - border-radius: 50%; - color: var(--sidebar-btn-color); - background-color: var(--sidebar-btn-bg); - text-align: center; - display: flex; - align-items: center; - justify-content: center; - - &:not(:focus-visible) { - box-shadow: var(--sidebar-border-color) 0 0 0 1px; - } - - &:hover { - background-color: var(--sidebar-hover-bg); - } - } - - a { - @extend %button; - @extend %sidebar-link-hover; - @extend %clickable-transition; - - &:not(:last-child) { - margin-right: $sb-btn-gap; - } - } - - i { - line-height: $btn-size; - } - - #mode-toggle { - @extend %button; - @extend %sidebar-links; - @extend %sidebar-link-hover; - } - - .icon-border { - @extend %no-cursor; - @include ml-mr(calc(($sb-btn-gap - $btn-border-width) / 2)); - - background-color: var(--sidebar-btn-color); - content: ''; - width: $btn-border-width; - height: $btn-border-width; - border-radius: 50%; - margin-bottom: $btn-mb; - } - } /* .sidebar-bottom */ -} /* #sidebar */ - -@media (hover: hover) { - #sidebar ul > li:last-child::after { - transition: top 0.5s ease; - } - - .nav-link { - transition: background-color 0.3s ease-in-out; - } - - .post-preview { - transition: background-color 0.35s ease-in-out; - } -} - -#search-result-wrapper { - display: none; - height: 100%; - width: 100%; - overflow: auto; - - .content { - margin-top: 2rem; - } -} - -/* --- top-bar --- */ - -#topbar-wrapper { - height: $topbar-height; - background-color: var(--topbar-bg); -} - -#topbar { - @extend %btn-color; - - #breadcrumb { - font-size: 1rem; - color: var(--text-muted-color); - padding-left: 0.5rem; - - a:hover { - @extend %link-hover; - } - - span { - &:not(:last-child) { - &::after { - content: '›'; - padding: 0 0.3rem; - } - } - } - } -} /* #topbar */ - -::-webkit-input-placeholder { - @include placeholder; -} - -::-moz-placeholder { - @include placeholder; -} - -:-ms-input-placeholder { - @include placeholder; -} - -::-ms-input-placeholder { - @include placeholder; -} - -::placeholder { - @include placeholder; -} - -:focus::-webkit-input-placeholder { - @include placeholder-focus; -} - -:focus::-moz-placeholder { - @include placeholder-focus; -} - -:focus:-ms-input-placeholder { - @include placeholder-focus; -} - -:focus::-ms-input-placeholder { - @include placeholder-focus; -} - -:focus::placeholder { - @include placeholder-focus; -} - -search { - display: flex; - width: 100%; - border-radius: 1rem; - border: 1px solid var(--search-border-color); - background: var(--main-bg); - padding: 0 0.5rem; - - i { - z-index: 2; - font-size: 0.9rem; - color: var(--search-icon-color); - } -} - -#sidebar-trigger, -#search-trigger { - display: none; -} - -/* 'Cancel' link */ -#search-cancel { - color: var(--link-color); - display: none; - white-space: nowrap; - - @extend %cursor-pointer; -} - -#search-input { - background: center; - border: 0; - border-radius: 0; - padding: 0.18rem 0.3rem; - color: var(--text-color); - height: auto; - - &:focus { - box-shadow: none; - } -} - -#search-hints { - padding: 0 1rem; - - h4 { - margin-bottom: 1.5rem; - } - - .post-tag { - display: inline-block; - line-height: 1rem; - font-size: 1rem; - background: var(--search-tag-bg); - border: none; - padding: 0.5rem; - margin: 0 1.25rem 1rem 0; - - &::before { - content: '#'; - color: var(--text-muted-color); - padding-right: 0.2rem; - } - - @extend %link-color; - } -} - -#search-results { - padding-bottom: 3rem; - - a { - font-size: 1.4rem; - line-height: 1.5rem; - - &:hover { - @extend %link-hover; - } - - @extend %link-color; - @extend %no-bottom-border; - @extend %heading; - } - - > article { - width: 100%; - - &:not(:last-child) { - margin-bottom: 1rem; - } - - /* icons */ - i { - color: #818182; - margin-right: 0.15rem; - font-size: 80%; - } - - > p { - @extend %text-ellipsis; - - white-space: break-spaces; - display: -webkit-box; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - } - } -} /* #search-results */ - -#topbar-title { - display: none; - font-size: 1.1rem; - font-weight: 600; - font-family: sans-serif; - color: var(--topbar-text-color); - text-align: center; - width: 70%; - word-break: keep-all; -} - -#mask { - inset: 0 0 0 0; -} - -/* --- basic wrappers --- */ - -#main-wrapper { - position: relative; - - @include pl-pr(0); - - > .container { - min-height: 100vh; - } -} - -#topbar-wrapper.row, -#main-wrapper > .container > .row, -#search-result-wrapper > .row { - @include ml-mr(0); -} - -#tail-wrapper { - > :not(script) { - margin-top: 3rem; - } -} - -/* --- button back-to-top --- */ - -#back-to-top { - visibility: hidden; - opacity: 0; - z-index: 1; - cursor: pointer; - position: fixed; - right: 1rem; - bottom: calc($footer-height-large - $back2top-size / 2); - background: var(--button-bg); - color: var(--btn-backtotop-color); - padding: 0; - width: $back2top-size; - height: $back2top-size; - border-radius: 50%; - border: 1px solid var(--btn-backtotop-border-color); - transition: opacity 0.5s ease-in-out, transform 0.2s ease-out; - - &:hover { - transform: translate3d(0, -5px, 0); - -webkit-transform: translate3d(0, -5px, 0); - } - - i { - line-height: $back2top-size; - position: relative; - bottom: 2px; - } - - &.show { - opacity: 1; - visibility: visible; - } -} - -#notification { - @-webkit-keyframes popup { - from { - opacity: 0; - bottom: 0; - } - } - - @keyframes popup { - from { - opacity: 0; - bottom: 0; - } - } - - .toast-header { - background: none; - border-bottom: none; - color: inherit; - } - - .toast-body { - font-family: Lato, sans-serif; - line-height: 1.25rem; - - button { - font-size: 90%; - min-width: 4rem; - } - } - - &.toast { - &.show { - display: block; - min-width: 20rem; - border-radius: 0.5rem; - -webkit-backdrop-filter: blur(10px); - backdrop-filter: blur(10px); - background-color: rgba(255, 255, 255, 0.5); - color: #1b1b1eba; - position: fixed; - left: 50%; - bottom: 20%; - transform: translateX(-50%); - -webkit-animation: popup 0.8s; - animation: popup 0.8s; - } - } -} - -/* - Responsive Design: - - {sidebar, content, panel} >= 1200px screen width - {sidebar, content} >= 850px screen width - {content} <= 849px screen width - -*/ - -@media all and (max-width: 576px) { - main { - .content { - > blockquote[class^='prompt-'] { - @include ml-mr(-1rem); - - border-radius: 0; - max-width: none; - } - } - } - - #avatar { - width: 5rem; - height: 5rem; - } -} - -@media all and (max-width: 768px) { - %full-width { - max-width: 100%; - } - - #topbar { - @extend %full-width; - } - - #main-wrapper > .container { - @extend %full-width; - @include pl-pr(0); - } -} - -/* hide sidebar and panel */ -@media all and (max-width: 849px) { - @mixin slide($append: null) { - $basic: transform 0.4s ease; - - @if $append { - transition: $basic, $append; - } @else { - transition: $basic; - } - } - - footer { - @include slide; - - height: $footer-height-large; - padding: 1.5rem 0; - } - - [#{$sidebar-display}] { - #sidebar { - transform: translateX(0); - } - - #main-wrapper { - transform: translateX($sidebar-width); - } - - #back-to-top { - visibility: hidden; - } - } - - #sidebar { - @include slide; - - transform: translateX(-$sidebar-width); /* hide */ - -webkit-transform: translateX(-$sidebar-width); - } - - #main-wrapper { - @include slide; - } - - #topbar, - #main-wrapper > .container { - max-width: 100%; - } - - #search-result-wrapper { - width: 100%; - } - - #breadcrumb, - search { - display: none; - } - - #topbar-wrapper { - @include slide(top 0.2s ease); - - left: 0; - } - - main, - #panel-wrapper { - margin-top: 0; - } - - #topbar-title, - #sidebar-trigger, - #search-trigger { - display: block; - } - - #search-result-wrapper .content { - letter-spacing: 0; - } - - #tags { - justify-content: center !important; - } - - h1.dynamic-title { - display: none; - - ~ .content { - margin-top: 2.5rem; - } - } -} /* max-width: 849px */ - -/* Sidebar is visible */ -@media all and (min-width: 850px) { - /* Solved jumping scrollbar */ - html { - overflow-y: scroll; - } - - #main-wrapper { - margin-left: $sidebar-width; - } - - #sidebar { - .profile-wrapper { - margin-top: 3rem; - } - } - - #search-hints { - display: none; - } - - search { - max-width: $search-max-width; - } - - #search-result-wrapper { - max-width: $main-content-max-width; - justify-content: start !important; - } - - main { - h1 { - margin-top: 3rem; - } - } - - div.content .table-wrapper > table { - min-width: 70%; - } - - /* button 'back-to-Top' position */ - #back-to-top { - right: 5%; - bottom: calc($footer-height - $back2top-size / 2); - } - - #topbar-title { - text-align: left; - } -} - -/* Pad horizontal */ -@media all and (min-width: 992px) and (max-width: 1199px) { - #main-wrapper > .container .col-lg-11 { - flex: 0 0 96%; - max-width: 96%; - } -} - -/* Compact icons in sidebar & panel hidden */ -@media all and (min-width: 850px) and (max-width: 1199px) { - #search-results > div { - max-width: 700px; - } - - #breadcrumb { - width: 65%; - overflow: hidden; - text-overflow: ellipsis; - word-break: keep-all; - white-space: nowrap; - } -} - -/* panel hidden */ -@media all and (max-width: 1199px) { - #panel-wrapper { - display: none; - } - - #main-wrapper > .container > div.row { - justify-content: center !important; - } -} - -/* --- desktop mode, both sidebar and panel are visible --- */ - -@media all and (min-width: 1200px) { - search { - margin-right: 4rem; - } - - #search-input { - transition: all 0.3s ease-in-out; - } - - #search-results > article { - width: 45%; - - &:nth-child(odd) { - margin-right: 1.5rem; - } - - &:nth-child(even) { - margin-left: 1.5rem; - } - - &:last-child:nth-child(odd) { - position: relative; - right: 24.3%; - } - } - - .content { - font-size: 1.03rem; - } -} - -@media all and (min-width: 1400px) { - #back-to-top { - right: calc((100vw - $sidebar-width - 1140px) / 2 + 3rem); - } -} - -@media all and (min-width: 1650px) { - $icon-gap: 1rem; - - #main-wrapper { - margin-left: $sidebar-width-large; - } - - #topbar-wrapper { - left: $sidebar-width-large; - } - - search { - margin-right: calc( - $main-content-max-width / 4 - $search-max-width - 0.75rem - ); - } - - #main-wrapper > .container { - max-width: $main-content-max-width; - - @include pl-pr(1.75rem, true); - } - - main.col-12, - #tail-wrapper { - padding-right: 4.5rem !important; - } - - #back-to-top { - right: calc( - (100vw - $sidebar-width-large - $main-content-max-width) / 2 + 2rem - ); - } - - #sidebar { - width: $sidebar-width-large; - - .profile-wrapper { - margin-top: 3.5rem; - margin-bottom: 2.5rem; - padding-left: 3.5rem; - } - - ul { - li.nav-item { - @include pl-pr(2.75rem); - } - } - - .sidebar-bottom { - padding-left: 2.75rem; - margin-bottom: 1.75rem; - - a:not(:last-child) { - margin-right: $sb-btn-gap-lg; - } - - .icon-border { - @include ml-mr(calc(($sb-btn-gap-lg - $btn-border-width) / 2)); - } - } - } -} /* min-width: 1650px */ diff --git a/_sass/base/_base.scss b/_sass/base/_base.scss new file mode 100644 index 00000000..19f153bd --- /dev/null +++ b/_sass/base/_base.scss @@ -0,0 +1,476 @@ +@use '../abstracts/variables' as v; +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/mixins' as mx; +@use '../abstracts/placeholders'; +@use '../themes/light'; +@use '../themes/dark'; + +:root { + font-size: 16px; +} + +html { + @media (prefers-color-scheme: light) { + &:not([data-mode]), + &[data-mode='light'] { + @include light.styles; + } + + &[data-mode='dark'] { + @include dark.styles; + } + } + + @media (prefers-color-scheme: dark) { + &:not([data-mode]), + &[data-mode='dark'] { + @include dark.styles; + } + + &[data-mode='light'] { + @include light.styles; + } + } + + @include bp.lg { + overflow-y: scroll; + } +} + +body { + background: var(--main-bg); + padding: env(safe-area-inset-top) env(safe-area-inset-right) + env(safe-area-inset-bottom) env(safe-area-inset-left); + color: var(--text-color); + -webkit-font-smoothing: antialiased; + font-family: v.$font-family-base; +} + +h1.dynamic-title { + @include bp.lt(bp.get(lg)) { + display: none; + + ~ .content { + margin-top: 2.5rem; + } + } +} + +main { + &.col-12 { + @include bp.xxxl { + padding-right: 4.5rem !important; + } + } +} + +.preview-img { + aspect-ratio: 40 / 21; + width: 100%; + height: 100%; + overflow: hidden; + + @extend %rounded; + + &:not(.no-bg) { + background: var(--img-bg); + } + + img { + height: 100%; + -o-object-fit: cover; + object-fit: cover; + + @extend %rounded; + + @at-root #post-list & { + width: 100%; + } + } +} + +.post-preview { + @extend %rounded; + + border: 0; + background: var(--card-bg); + box-shadow: var(--card-shadow); + + &::before { + @extend %rounded; + + content: ''; + width: 100%; + height: 100%; + position: absolute; + background-color: var(--card-hovor-bg); + opacity: 0; + transition: opacity 0.35s ease-in-out; + } + + &:hover { + &::before { + opacity: 0.3; + } + } +} + +.post-meta { + @extend %text-sm; + + a { + &:not([class]):hover { + @extend %link-hover; + } + } + + em { + @extend %normal-font-style; + } +} + +.content { + font-size: 1.08rem; + margin-top: 2rem; + overflow-wrap: break-word; + + @include bp.xl { + font-size: 1.03rem; + } + + a { + &.popup { + @extend %no-cursor; + @extend %img-caption; + @include mx.mt-mb(0.5rem); + + cursor: zoom-in; + } + + &:not(.img-link) { + @extend %link-underline; + + &:hover { + @extend %link-hover; + } + } + } + + ol, + ul { + &:not([class]), + &.task-list { + -webkit-padding-start: 1.75rem; + padding-inline-start: 1.75rem; + + li { + margin: 0.25rem 0; + padding-left: 0.25rem; + } + + ol, + ul { + -webkit-padding-start: 1.25rem; + padding-inline-start: 1.25rem; + margin: 0.5rem 0; + } + } + } + + ul.task-list { + -webkit-padding-start: 1.25rem; + padding-inline-start: 1.25rem; + + li { + list-style-type: none; + padding-left: 0; + + /* checkbox icon */ + > i { + width: 2rem; + margin-left: -1.25rem; + color: var(--checkbox-color); + + &.checked { + color: var(--checkbox-checked-color); + } + } + + ul { + -webkit-padding-start: 1.75rem; + padding-inline-start: 1.75rem; + } + } + + input[type='checkbox'] { + margin: 0 0.5rem 0.2rem -1.3rem; + vertical-align: middle; + } + } /* ul */ + + dl > dd { + margin-left: 1rem; + } + + ::marker { + color: var(--text-muted-color); + } + + .table-wrapper > table { + @include bp.lg { + min-width: 70%; + } + } +} /* .content */ + +.tag:hover { + @extend %tag-hover; +} + +.post-tag { + display: inline-block; + min-width: 2rem; + text-align: center; + border-radius: 0.5rem; + border: 1px solid var(--btn-border-color); + padding: 0 0.4rem; + color: var(--text-muted-color); + line-height: 1.3rem; + + &:not(:last-child) { + margin-right: 0.2rem; + } +} + +.rounded-10 { + border-radius: 10px !important; +} + +.img-link { + color: transparent; + display: inline-flex; +} + +.shimmer { + overflow: hidden; + position: relative; + background: var(--img-bg); + + &::before { + content: ''; + position: absolute; + background: var(--shimmer-bg); + height: 100%; + width: 100%; + -webkit-animation: shimmer 1.3s infinite; + animation: shimmer 1.3s infinite; + } + + @-webkit-keyframes shimmer { + 0% { + transform: translateX(-100%); + } + + 100% { + transform: translateX(100%); + } + } + + @keyframes shimmer { + 0% { + transform: translateX(-100%); + } + + 100% { + transform: translateX(100%); + } + } +} + +.embed-video { + width: 100%; + height: 100%; + margin-bottom: 1rem; + aspect-ratio: 16 / 9; + + @extend %rounded; + + &.twitch { + aspect-ratio: 310 / 189; + } + + &.file { + display: block; + width: auto; + height: auto; + max-width: 100%; + max-height: 100%; + margin: auto; + margin-bottom: 0; + } + + @extend %img-caption; +} + +.embed-audio { + width: 100%; + display: block; + + @extend %img-caption; +} + +/* --- Effects classes --- */ + +.flex-grow-1 { + flex-grow: 1 !important; +} + +.btn-box-shadow { + box-shadow: var(--card-shadow); +} + +/* overwrite bootstrap muted */ +.text-muted { + color: var(--text-muted-color) !important; +} + +/* Overwrite bootstrap tooltip */ +.tooltip-inner { + font-size: 0.7rem; + max-width: 220px; + text-align: left; +} + +/* Overwrite bootstrap outline button */ +.btn.btn-outline-primary { + &:not(.disabled):hover { + border-color: #007bff !important; + } +} + +.disabled { + color: rgb(206, 196, 196); + pointer-events: auto; + cursor: not-allowed; +} + +.hide-border-bottom { + border-bottom: none !important; +} + +.input-focus { + box-shadow: none; + border-color: var(--input-focus-border-color) !important; + background: center !important; + transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out; +} + +.left { + float: left; + margin: 0.75rem 1rem 1rem 0; +} + +.right { + float: right; + margin: 0.75rem 0 1rem 1rem; +} + +/* --- Overriding --- */ + +/* mermaid */ +.mermaid { + text-align: center; +} + +/* MathJax */ +mjx-container { + overflow-y: hidden; + min-width: auto !important; +} + +@media (hover: hover) { + #sidebar ul > li:last-child::after { + transition: top 0.5s ease; + } + + .nav-link { + transition: background-color 0.3s ease-in-out; + } + + .post-preview { + transition: background-color 0.35s ease-in-out; + } +} + +#mask { + inset: 0 0 0 0; +} + +#main-wrapper { + position: relative; + + @include mx.pl-pr(0); + + @include bp.lt(bp.get(lg)) { + @include mx.slide; + } + + @include bp.lg { + margin-left: v.$sidebar-width; + } + + @include bp.xxxl { + margin-left: v.$sidebar-width-large; + } + + > .container { + min-height: 100vh; + + @include bp.lte(bp.get(md)) { + @include mx.max-w-100; + @include mx.pl-pr(0); + } + + @include bp.lt(bp.get(lg)) { + max-width: 100%; + } + + /* Pad horizontal */ + @include bp.between(992px, calc(#{bp.get(xl)} - 1px)) { + .col-lg-11 { + flex: 0 0 96%; + max-width: 96%; + } + } + + @include bp.lt(bp.get(xl)) { + > .row { + justify-content: center !important; + } + } + + @include bp.xxxl { + max-width: v.$main-content-max-width; + + @include mx.pl-pr(1.75rem, true); + } + } +} + +/* --- basic wrappers --- */ + +#topbar-wrapper.row, +#main-wrapper > .container > .row, +#search-result-wrapper > .row { + @include mx.ml-mr(0); +} + +#tail-wrapper { + @include bp.xxxl { + padding-right: 4.5rem !important; + } + + > :not(script) { + margin-top: 3rem; + } +} diff --git a/_sass/base/_index.scss b/_sass/base/_index.scss new file mode 100644 index 00000000..611d28ff --- /dev/null +++ b/_sass/base/_index.scss @@ -0,0 +1,4 @@ +@forward 'reset'; +@forward 'base'; +@forward 'typography'; +@forward 'syntax'; diff --git a/_sass/base/_reset.scss b/_sass/base/_reset.scss new file mode 100644 index 00000000..1e5a6294 --- /dev/null +++ b/_sass/base/_reset.scss @@ -0,0 +1,41 @@ +@use '../abstracts/mixins' as *; + +::-webkit-input-placeholder { + @include placeholder; +} + +::-moz-placeholder { + @include placeholder; +} + +:-ms-input-placeholder { + @include placeholder; +} + +::-ms-input-placeholder { + @include placeholder; +} + +::placeholder { + @include placeholder; +} + +:focus::-webkit-input-placeholder { + @include placeholder-focus; +} + +:focus::-moz-placeholder { + @include placeholder-focus; +} + +:focus:-ms-input-placeholder { + @include placeholder-focus; +} + +:focus::-ms-input-placeholder { + @include placeholder-focus; +} + +:focus::placeholder { + @include placeholder-focus; +} diff --git a/_sass/addon/syntax.scss b/_sass/base/_syntax.scss similarity index 74% rename from _sass/addon/syntax.scss rename to _sass/base/_syntax.scss index 6bd7b406..69924fc6 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/base/_syntax.scss @@ -1,44 +1,7 @@ -/* -* The syntax highlight. -*/ - -@import 'colors/syntax-light'; -@import 'colors/syntax-dark'; - -html { - @media (prefers-color-scheme: light) { - &:not([data-mode]), - &[data-mode='light'] { - @include light-syntax; - } - - &[data-mode='dark'] { - @include dark-syntax; - } - } - - @media (prefers-color-scheme: dark) { - &:not([data-mode]), - &[data-mode='dark'] { - @include dark-syntax; - } - - &[data-mode='light'] { - @include light-syntax; - } - } -} - -/* -- code snippets -- */ - -%code-snippet-bg { - background-color: var(--highlight-bg-color); -} - -%code-snippet-padding { - padding-left: 1rem; - padding-right: 1.5rem; -} +@use '../abstracts/variables' as v; +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/mixins' as mx; +@use '../abstracts/placeholders'; .highlighter-rouge { color: var(--highlighter-rouge-color); @@ -59,7 +22,7 @@ html { pre { margin-bottom: 0; - font-size: $code-font-size; + font-size: v.$code-font-size; line-height: 1.4rem; word-wrap: normal; /* Fixed Safari overflow-x */ } @@ -101,10 +64,10 @@ code { color: var(--code-color); &.highlighter-rouge { - font-size: $code-font-size; + font-size: v.$code-font-size; padding: 3px 5px; word-break: break-word; - border-radius: $radius-sm; + border-radius: v.$radius-sm; background-color: var(--inline-code-bg); } @@ -150,9 +113,42 @@ div[class^='language-'] { box-shadow: var(--language-border-color) 0 0 0 1px; .content > & { - @include ml-mr(-1rem); + @include mx.ml-mr(-1rem); border-radius: 0; + + @include bp.sm { + @include mx.ml-mr(0); + + border-radius: v.$radius-lg; + } + } + + .code-header { + @include bp.sm { + @include mx.ml-mr(0); + + $dot-margin: 1rem; + + &::before { + content: ''; + display: inline-block; + margin-left: $dot-margin; + width: v.$code-dot-size; + height: v.$code-dot-size; + border-radius: 50%; + background-color: var(--code-header-muted-color); + box-shadow: (v.$code-dot-size + v.$code-dot-gap) 0 0 + var(--code-header-muted-color), + (v.$code-dot-size + v.$code-dot-gap) * 2 0 0 + var(--code-header-muted-color); + } + + span { + // center the text of label + margin-left: calc(($dot-margin + v.$code-dot-size) / 2 * -1); + } + } } .highlight { @@ -184,18 +180,18 @@ div { display: flex; justify-content: space-between; align-items: center; - height: $code-header-height; + height: v.$code-header-height; margin-left: 0.75rem; margin-right: 0.25rem; /* the label block */ span { - line-height: $code-header-height; + line-height: v.$code-header-height; /* label icon */ i { font-size: 1rem; - width: $code-icon-width; + width: v.$code-icon-width; color: var(--code-header-icon-color); &.small { @@ -223,8 +219,8 @@ div { @extend %rounded; border: 1px solid transparent; - height: $code-header-height; - width: $code-header-height; + height: v.$code-header-height; + width: v.$code-header-height; padding: 0; background-color: inherit; @@ -255,38 +251,3 @@ div { } } } - -@media all and (min-width: 576px) { - div[class^='language-'] { - .content > & { - @include ml-mr(0); - - border-radius: $radius-lg; - } - - .code-header { - @include ml-mr(0); - - $dot-margin: 1rem; - - &::before { - content: ''; - display: inline-block; - margin-left: $dot-margin; - width: $code-dot-size; - height: $code-dot-size; - border-radius: 50%; - background-color: var(--code-header-muted-color); - box-shadow: ($code-dot-size + $code-dot-gap) 0 0 - var(--code-header-muted-color), - ($code-dot-size + $code-dot-gap) * 2 0 0 - var(--code-header-muted-color); - } - - span { - // center the text of label - margin-left: calc(($dot-margin + $code-dot-size) / 2 * -1); - } - } - } -} diff --git a/_sass/base/_typography.scss b/_sass/base/_typography.scss new file mode 100644 index 00000000..4cf39643 --- /dev/null +++ b/_sass/base/_typography.scss @@ -0,0 +1,266 @@ +@use '../abstracts/variables' as v; +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/mixins' as mx; +@use '../abstracts/placeholders'; + +@for $i from 1 through 5 { + h#{$i} { + @extend %heading; + + @if $i > 1 { + @extend %anchor; + } + + @if $i < 5 { + $size-factor: 0.25rem; + + @if $i > 1 { + $size-factor: 0.18rem; + + main & { + @if $i == 2 { + margin: 2.5rem 0 1.25rem; + } @else { + margin: 2rem 0 1rem; + } + } + } + + & { + font-size: 1rem + (5 - $i) * $size-factor; + } + } @else { + font-size: 1.05rem; + } + } +} + +a { + @extend %link-color; + + text-decoration: none; +} + +img { + max-width: 100%; + height: auto; + transition: all 0.35s ease-in-out; + + .blur & { + $blur: 20px; + + -webkit-filter: blur($blur); + filter: blur($blur); + } +} + +blockquote { + border-left: 0.125rem solid var(--blockquote-border-color); + padding-left: 1rem; + color: var(--blockquote-text-color); + margin-top: 0.5rem; + + > p:last-child { + margin-bottom: 0; + } + + &[class^='prompt-'] { + border-left: 0; + position: relative; + padding: 1rem 1rem 1rem 3rem; + color: var(--prompt-text-color); + + @extend %rounded; + + &::before { + text-align: center; + width: 3rem; + position: absolute; + left: 0.25rem; + margin-top: 0.4rem; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + } + } + + @include mx.prompt('tip', '\f0eb', $fa-style: 'regular'); + @include mx.prompt('info', '\f06a', $rotate: 180); + @include mx.prompt('warning', '\f06a'); + @include mx.prompt('danger', '\f071'); +} + +kbd { + font-family: Lato, sans-serif; + display: inline-block; + vertical-align: middle; + line-height: 1.3rem; + min-width: 1.75rem; + text-align: center; + margin: 0 0.3rem; + padding-top: 0.1rem; + color: var(--kbd-text-color); + background-color: var(--kbd-bg-color); + border-radius: v.$radius-sm; + border: solid 1px var(--kbd-wrap-color); + box-shadow: inset 0 -2px 0 var(--kbd-wrap-color); +} + +hr { + border-color: var(--main-border-color); + opacity: 1; +} + +footer { + background-color: var(--main-bg); + height: v.$footer-height; + border-top: 1px solid var(--main-border-color); + + @extend %text-xs; + + a { + @extend %text-highlight; + + &:hover { + @extend %link-hover; + } + } + + em { + @extend %text-highlight; + } + + p { + text-align: center; + margin-bottom: 0; + } +} + +/* fontawesome icons */ +i { + &.far, + &.fas { + @extend %no-cursor; + } +} + +sup { + @extend %sup-fn-target; +} + +main { + line-height: 1.75; + + h1 { + margin-top: 2rem; + + @include bp.lg { + margin-top: 3rem; + } + } + + p { + > a.popup { + &:not(.normal):not(.left):not(.right) { + @include mx.align-center; + } + } + } + + .categories, + #tags, + #archives { + a:not(:hover) { + @extend %no-bottom-border; + } + } + + @include bp.lte(bp.get(sm)) { + .content { + > blockquote[class^='prompt-'] { + @include mx.ml-mr(-1rem); + + border-radius: 0; + max-width: none; + } + } + } +} + +.footnotes > ol { + padding-left: 2rem; + margin-top: 0.5rem; + + > li { + &:not(:last-child) { + margin-bottom: 0.3rem; + } + + @extend %sup-fn-target; + + > p { + margin-left: 0.25em; + + @include mx.mt-mb(0); + } + } +} + +.footnote { + @at-root a#{&} { + @include mx.ml-mr(1px); + @include mx.pl-pr(2px); + + border-bottom-style: none !important; + } +} + +.reversefootnote { + @at-root a#{&} { + font-size: 0.6rem; + line-height: 1; + position: relative; + bottom: 0.25em; + margin-left: 0.25em; + border-bottom-style: none !important; + } +} + +/* --- Begin of Markdown table style --- */ + +/* it will be created by Liquid */ +.table-wrapper { + overflow-x: auto; + margin-bottom: 1.5rem; + + > table { + min-width: 100%; + overflow-x: auto; + border-spacing: 0; + + thead { + border-bottom: solid 2px rgba(210, 215, 217, 0.75); + + th { + @extend %table-cell; + } + } + + tbody { + tr { + border-bottom: 1px solid var(--tb-border-color); + + &:nth-child(2n) { + background-color: var(--tb-even-bg); + } + + &:nth-child(2n + 1) { + background-color: var(--tb-odd-bg); + } + + td { + @extend %table-cell; + } + } + } /* tbody */ + } /* table */ +} diff --git a/_sass/colors/syntax-dark.scss b/_sass/colors/syntax-dark.scss deleted file mode 100644 index eb92204d..00000000 --- a/_sass/colors/syntax-dark.scss +++ /dev/null @@ -1,164 +0,0 @@ -/* - * The syntax dark mode styles. - */ - -@mixin dark-syntax { - --language-border-color: #2d2d2d; - --highlight-bg-color: #151515; - --highlighter-rouge-color: #c9def1; - --highlight-lineno-color: #808080; - --inline-code-bg: rgba(255, 255, 255, 0.05); - --code-color: #b0b0b0; - --code-header-text-color: #6a6a6a; - --code-header-muted-color: #353535; - --code-header-icon-color: #565656; - --clipboard-checked-color: #2bcc2b; - --filepath-text-color: #cacaca; - - .highlight .gp { - color: #87939d; - } - - /* --- Syntax highlight theme from `rougify style base16.dark` --- */ - - .highlight table td { - padding: 5px; - } - - .highlight table pre { - margin: 0; - } - - .highlight, - .highlight .w { - color: #d0d0d0; - background-color: #151515; - } - - .highlight .err { - color: #151515; - background-color: #ac4142; - } - - .highlight .c, - .highlight .ch, - .highlight .cd, - .highlight .cm, - .highlight .cpf, - .highlight .c1, - .highlight .cs { - color: #848484; - } - - .highlight .cp { - color: #f4bf75; - } - - .highlight .nt { - color: #f4bf75; - } - - .highlight .o, - .highlight .ow { - color: #d0d0d0; - } - - .highlight .p, - .highlight .pi { - color: #d0d0d0; - } - - .highlight .gi { - color: #90a959; - } - - .highlight .gd { - color: #f08a8b; - background-color: #320000; - } - - .highlight .gh { - color: #6a9fb5; - background-color: #151515; - font-weight: bold; - } - - .highlight .k, - .highlight .kn, - .highlight .kp, - .highlight .kr, - .highlight .kv { - color: #aa759f; - } - - .highlight .kc { - color: #d28445; - } - - .highlight .kt { - color: #d28445; - } - - .highlight .kd { - color: #d28445; - } - - .highlight .s, - .highlight .sb, - .highlight .sc, - .highlight .dl, - .highlight .sd, - .highlight .s2, - .highlight .sh, - .highlight .sx, - .highlight .s1 { - color: #90a959; - } - - .highlight .sa { - color: #aa759f; - } - - .highlight .sr { - color: #75b5aa; - } - - .highlight .si { - color: #b76d45; - } - - .highlight .se { - color: #b76d45; - } - - .highlight .nn { - color: #f4bf75; - } - - .highlight .nc { - color: #f4bf75; - } - - .highlight .no { - color: #f4bf75; - } - - .highlight .na { - color: #6a9fb5; - } - - .highlight .m, - .highlight .mb, - .highlight .mf, - .highlight .mh, - .highlight .mi, - .highlight .il, - .highlight .mo, - .highlight .mx { - color: #90a959; - } - - .highlight .ss { - color: #90a959; - } -} diff --git a/_sass/colors/syntax-light.scss b/_sass/colors/syntax-light.scss deleted file mode 100644 index 76aa6691..00000000 --- a/_sass/colors/syntax-light.scss +++ /dev/null @@ -1,210 +0,0 @@ -/* - * The syntax light mode code snippet colors. - */ - -@mixin light-syntax { - /* --- custom light colors --- */ - --language-border-color: #ececec; - --highlight-bg-color: #f6f8fa; - --highlighter-rouge-color: #3f596f; - --highlight-lineno-color: #9e9e9e; - --inline-code-bg: rgba(25, 25, 28, 0.05); - --code-color: #3a3a3a; - --code-header-text-color: #a3a3a3; - --code-header-muted-color: #e5e5e5; - --code-header-icon-color: #c9c8c8; - --clipboard-checked-color: #43c743; - - /* --- Syntax highlight theme from `rougify style github` --- */ - - .highlight table td { - padding: 5px; - } - - .highlight table pre { - margin: 0; - } - - .highlight, - .highlight .w { - color: #24292f; - background-color: #f6f8fa; - } - - .highlight .k, - .highlight .kd, - .highlight .kn, - .highlight .kp, - .highlight .kr, - .highlight .kt, - .highlight .kv { - color: #cf222e; - } - - .highlight .gr { - color: #f6f8fa; - } - - .highlight .gd { - color: #82071e; - background-color: #ffebe9; - } - - .highlight .nb { - color: #953800; - } - - .highlight .nc { - color: #953800; - } - - .highlight .no { - color: #953800; - } - - .highlight .nn { - color: #953800; - } - - .highlight .sr { - color: #116329; - } - - .highlight .na { - color: #116329; - } - - .highlight .nt { - color: #116329; - } - - .highlight .gi { - color: #116329; - background-color: #dafbe1; - } - - .highlight .kc { - color: #0550ae; - } - - .highlight .l, - .highlight .ld, - .highlight .m, - .highlight .mb, - .highlight .mf, - .highlight .mh, - .highlight .mi, - .highlight .il, - .highlight .mo, - .highlight .mx { - color: #0550ae; - } - - .highlight .sb { - color: #0550ae; - } - - .highlight .bp { - color: #0550ae; - } - - .highlight .ne { - color: #0550ae; - } - - .highlight .nl { - color: #0550ae; - } - - .highlight .py { - color: #0550ae; - } - - .highlight .nv, - .highlight .vc, - .highlight .vg, - .highlight .vi, - .highlight .vm { - color: #0550ae; - } - - .highlight .o, - .highlight .ow { - color: #0550ae; - } - - .highlight .gh { - color: #0550ae; - font-weight: bold; - } - - .highlight .gu { - color: #0550ae; - font-weight: bold; - } - - .highlight .s, - .highlight .sa, - .highlight .sc, - .highlight .dl, - .highlight .sd, - .highlight .s2, - .highlight .se, - .highlight .sh, - .highlight .sx, - .highlight .s1, - .highlight .ss { - color: #0a3069; - } - - .highlight .nd { - color: #8250df; - } - - .highlight .nf, - .highlight .fm { - color: #8250df; - } - - .highlight .err { - color: #f6f8fa; - background-color: #82071e; - } - - .highlight .c, - .highlight .ch, - .highlight .cd, - .highlight .cm, - .highlight .cp, - .highlight .cpf, - .highlight .c1, - .highlight .cs { - color: #68717a; - } - - .highlight .gl { - color: #68717a; - } - - .highlight .gt { - color: #68717a; - } - - .highlight .ni { - color: #24292f; - } - - .highlight .si { - color: #24292f; - } - - .highlight .ge { - color: #24292f; - font-style: italic; - } - - .highlight .gs { - color: #24292f; - font-weight: bold; - } -} /* light-syntax */ diff --git a/_sass/colors/typography-light.scss b/_sass/colors/typography-light.scss deleted file mode 100644 index b6fc5618..00000000 --- a/_sass/colors/typography-light.scss +++ /dev/null @@ -1,112 +0,0 @@ -/* - * The syntax light mode typography colors - */ - -@mixin light-scheme { - /* Framework color */ - --main-bg: white; - --mask-bg: #c1c3c5; - --main-border-color: #f3f3f3; - - /* Common color */ - --text-color: #34343c; - --text-muted-color: #757575; - --text-muted-highlight-color: inherit; - --heading-color: #2a2a2a; - --label-color: #585858; - --blockquote-border-color: #eeeeee; - --blockquote-text-color: #757575; - --link-color: #0056b2; - --link-underline-color: #dee2e6; - --button-bg: #ffffff; - --btn-border-color: #e9ecef; - --btn-backtotop-color: #686868; - --btn-backtotop-border-color: #f1f1f1; - --checkbox-color: #c5c5c5; - --checkbox-checked-color: #07a8f7; - --img-bg: radial-gradient( - circle, - rgb(255, 255, 255) 0%, - rgb(239, 239, 239) 100% - ); - --shimmer-bg: linear-gradient( - 90deg, - rgba(250, 250, 250, 0) 0%, - rgba(232, 230, 230, 1) 50%, - rgba(250, 250, 250, 0) 100% - ); - - /* Sidebar */ - --site-title-color: rgb(113, 113, 113); - --site-subtitle-color: #717171; - --sidebar-bg: #f6f8fa; - --sidebar-border-color: #efefef; - --sidebar-muted-color: #545454; - --sidebar-active-color: #1d1d1d; - --sidebar-hover-bg: rgb(223, 233, 241, 0.64); - --sidebar-btn-bg: white; - --sidebar-btn-color: #8e8e8e; - --avatar-border-color: white; - - /* Topbar */ - --topbar-bg: rgb(255, 255, 255, 0.7); - --topbar-text-color: rgb(78, 78, 78); - --search-border-color: rgb(240, 240, 240); - --search-icon-color: #c2c6cc; - --input-focus-border-color: #b8b8b8; - - /* Home page */ - --post-list-text-color: dimgray; - --btn-patinator-text-color: #555555; - --btn-paginator-hover-color: var(--sidebar-bg); - - /* Posts */ - --toc-highlight: #0550ae; - --toc-popup-border-color: lightgray; - --btn-share-color: gray; - --btn-share-hover-color: #0d6efd; - --card-bg: white; - --card-hovor-bg: #e2e2e2; - --card-shadow: rgb(104, 104, 104, 0.05) 0 2px 6px 0, - rgba(211, 209, 209, 0.15) 0 0 0 1px; - --footnote-target-bg: lightcyan; - --tb-odd-bg: #fbfcfd; - --tb-border-color: #eaeaea; - --dash-color: silver; - --kbd-wrap-color: #bdbdbd; - --kbd-text-color: var(--text-color); - --kbd-bg-color: white; - --prompt-text-color: rgb(46, 46, 46, 0.77); - --prompt-tip-bg: rgb(123, 247, 144, 0.2); - --prompt-tip-icon-color: #03b303; - --prompt-info-bg: #e1f5fe; - --prompt-info-icon-color: #0070cb; - --prompt-warning-bg: rgb(255, 243, 205); - --prompt-warning-icon-color: #ef9c03; - --prompt-danger-bg: rgb(248, 215, 218, 0.56); - --prompt-danger-icon-color: #df3c30; - - /* Tags */ - --tag-border: #dee2e6; - --tag-shadow: var(--btn-border-color); - --tag-hover: rgb(222, 226, 230); - --search-tag-bg: #f8f9fa; - - /* Categories */ - --categories-border: rgba(0, 0, 0, 0.125); - --categories-hover-bg: var(--btn-border-color); - --categories-icon-hover-color: darkslategray; - - /* Archive */ - --timeline-color: rgba(0, 0, 0, 0.075); - --timeline-node-bg: #c2c6cc; - --timeline-year-dot-color: #ffffff; - - [class^='prompt-'] { - --link-underline-color: rgb(219, 216, 216); - } - - .dark { - display: none; - } -} /* light-scheme */ diff --git a/_sass/components/_buttons.scss b/_sass/components/_buttons.scss new file mode 100644 index 00000000..bd7363e5 --- /dev/null +++ b/_sass/components/_buttons.scss @@ -0,0 +1,51 @@ +@use '../abstracts/variables' as v; +@use '../abstracts/breakpoints' as bp; + +#back-to-top { + visibility: hidden; + opacity: 0; + z-index: 1; + cursor: pointer; + position: fixed; + right: 1rem; + bottom: calc(v.$footer-height-large - v.$back2top-size / 2); + background: var(--button-bg); + color: var(--btn-backtotop-color); + padding: 0; + width: v.$back2top-size; + height: v.$back2top-size; + border-radius: 50%; + border: 1px solid var(--btn-backtotop-border-color); + transition: opacity 0.5s ease-in-out, transform 0.2s ease-out; + + @include bp.lg { + right: 5%; + bottom: calc(v.$footer-height - v.$back2top-size / 2); + } + + @include bp.xxl { + right: calc((100vw - v.$sidebar-width - 1140px) / 2 + 3rem); + } + + @include bp.xxxl { + right: calc( + (100vw - v.$sidebar-width-large - v.$main-content-max-width) / 2 + 2rem + ); + } + + &:hover { + transform: translate3d(0, -5px, 0); + -webkit-transform: translate3d(0, -5px, 0); + } + + i { + line-height: v.$back2top-size; + position: relative; + bottom: 2px; + } + + &.show { + opacity: 1; + visibility: visible; + } +} diff --git a/_sass/components/_index.scss b/_sass/components/_index.scss new file mode 100644 index 00000000..ffbb9083 --- /dev/null +++ b/_sass/components/_index.scss @@ -0,0 +1,2 @@ +@forward 'buttons'; +@forward 'popups'; diff --git a/_sass/components/_popups.scss b/_sass/components/_popups.scss new file mode 100644 index 00000000..ca3e2fc6 --- /dev/null +++ b/_sass/components/_popups.scss @@ -0,0 +1,172 @@ +@use '../abstracts/variables' as v; +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/placeholders'; + +/* PWA update popup */ +#notification { + @-webkit-keyframes popup { + from { + opacity: 0; + bottom: 0; + } + } + + @keyframes popup { + from { + opacity: 0; + bottom: 0; + } + } + + .toast-header { + background: none; + border-bottom: none; + color: inherit; + } + + .toast-body { + font-family: Lato, sans-serif; + line-height: 1.25rem; + + button { + font-size: 90%; + min-width: 4rem; + } + } + + &.toast { + &.show { + display: block; + min-width: 20rem; + border-radius: 0.5rem; + -webkit-backdrop-filter: blur(10px); + backdrop-filter: blur(10px); + background-color: rgba(255, 255, 255, 0.5); + color: #1b1b1eba; + position: fixed; + left: 50%; + bottom: 20%; + transform: translateX(-50%); + -webkit-animation: popup 0.8s; + animation: popup 0.8s; + } + } +} + +#toc-popup { + $slide-in: slide-in 0.3s ease-out; + $slide-out: slide-out 0.3s ease-out; + $curtain-height: 2rem; + $backdrop: blur(5px); + + border-color: var(--toc-popup-border-color); + border-width: 1px; + border-radius: v.$radius-lg; + color: var(--text-color); + background: var(--card-bg); + margin-top: v.$topbar-height; + min-width: 20rem; + font-size: 1.05rem; + + @include bp.sm { + max-width: 32rem; + } + + &[open] { + -webkit-animation: $slide-in; + animation: $slide-in; + } + + &[closing] { + -webkit-animation: $slide-out; + animation: $slide-out; + } + + @include bp.lg { + left: v.$sidebar-width; + } + + .header { + @extend %btn-color; + + position: -webkit-sticky; + position: sticky; + top: 0; + background-color: inherit; + border-bottom: 1px solid var(--main-border-color); + + .label { + font-family: v.$font-family-heading; + } + } + + button { + > i { + font-size: 1.25rem; + vertical-align: middle; + } + + &:focus-visible { + box-shadow: none; + } + } + + ul { + list-style-type: none; + padding-left: 0; + + li { + ul, + & + li { + margin-top: 0.25rem; + } + + a { + display: flex; + line-height: 1.5; + padding: 0.375rem 0; + padding-right: 1.125rem; + + &.toc-link::before { + display: none; + } + } + } + } + + @for $i from 2 through 4 { + .node-name--H#{$i} { + padding-left: 1.125rem * ($i - 1); + } + } + + .is-active-link { + color: var(--toc-highlight) !important; + font-weight: 600; + } + + &::-webkit-backdrop { + -webkit-backdrop-filter: $backdrop; + backdrop-filter: $backdrop; + } + + &::backdrop { + -webkit-backdrop-filter: $backdrop; + backdrop-filter: $backdrop; + } + + &::after { + display: flex; + content: ''; + position: relative; + background: linear-gradient(transparent, var(--card-bg) 70%); + height: $curtain-height; + } + + #toc-popup-content { + overflow: auto; + max-height: calc(100vh - 4 * v.$topbar-height); + font-family: v.$font-family-heading; + margin-bottom: -$curtain-height; + } +} diff --git a/_sass/layout/_footer.scss b/_sass/layout/_footer.scss new file mode 100644 index 00000000..fd49ea04 --- /dev/null +++ b/_sass/layout/_footer.scss @@ -0,0 +1,36 @@ +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/variables' as v; +@use '../abstracts/mixins' as mx; +@use '../abstracts/placeholders'; + +footer { + background-color: var(--main-bg); + height: v.$footer-height; + border-top: 1px solid var(--main-border-color); + + @extend %text-xs; + + @include bp.lt(bp.get(lg)) { + @include mx.slide; + + height: v.$footer-height-large; + padding: 1.5rem 0; + } + + a { + @extend %text-highlight; + + &:hover { + @extend %link-hover; + } + } + + em { + @extend %text-highlight; + } + + p { + text-align: center; + margin-bottom: 0; + } +} diff --git a/_sass/layout/_index.scss b/_sass/layout/_index.scss new file mode 100644 index 00000000..fa75daf9 --- /dev/null +++ b/_sass/layout/_index.scss @@ -0,0 +1,4 @@ +@forward 'sidebar'; +@forward 'topbar'; +@forward 'panel'; +@forward 'footer'; diff --git a/_sass/layout/_panel.scss b/_sass/layout/_panel.scss new file mode 100644 index 00000000..bb5c2bc1 --- /dev/null +++ b/_sass/layout/_panel.scss @@ -0,0 +1,66 @@ +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/mixins' as mx; +@use '../abstracts/placeholders'; + +.access { + top: 2rem; + transition: top 0.2s ease-in-out; + margin-top: 3rem; + margin-bottom: 4rem; + + &:only-child { + position: -webkit-sticky; + position: sticky; + } + + > section { + padding-left: 1rem; + border-left: 1px solid var(--main-border-color); + + &:not(:last-child) { + margin-bottom: 4rem; + } + } + + .content { + font-size: 0.9rem; + } +} + +#panel-wrapper { + /* the headings */ + .panel-heading { + font-family: inherit; + line-height: inherit; + + @include mx.label(inherit); + } + + .post-tag { + line-height: 1.05rem; + font-size: 0.85rem; + border-radius: 0.8rem; + padding: 0.3rem 0.5rem; + margin: 0 0.35rem 0.5rem 0; + + &:hover { + transition: all 0.3s ease-in; + } + } + + @include bp.lt(bp.get(xl)) { + display: none; + } +} + +#access-lastmod { + a { + color: inherit; + + &:hover { + @extend %link-hover; + } + + @extend %no-bottom-border; + } +} diff --git a/_sass/layout/_sidebar.scss b/_sass/layout/_sidebar.scss new file mode 100644 index 00000000..eaad470c --- /dev/null +++ b/_sass/layout/_sidebar.scss @@ -0,0 +1,258 @@ +@use '../abstracts/variables' as v; +@use '../abstracts/mixins' as mx; +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/placeholders'; + +$btn-border-width: 3px; +$btn-mb: 0.5rem; +$sidebar-display: 'sidebar-display'; /* the attribute for sidebar display */ + +#sidebar { + @include mx.pl-pr(0); + + position: fixed; + top: 0; + left: 0; + height: 100%; + overflow-y: auto; + width: v.$sidebar-width; + background: var(--sidebar-bg); + border-right: 1px solid var(--sidebar-border-color); + + /* Hide scrollbar for IE, Edge and Firefox */ + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ + + /* Hide scrollbar for Chrome, Safari and Opera */ + &::-webkit-scrollbar { + display: none; + } + + @include bp.lt(bp.get(lg)) { + @include mx.slide; + + transform: translateX(-#{v.$sidebar-width}); /* hide */ + -webkit-transform: translateX(-#{v.$sidebar-width}); + + [#{$sidebar-display}] & { + transform: translateX(0); + } + } + + @include bp.xxxl { + width: v.$sidebar-width-large; + } + + %sidebar-link-hover { + &:hover { + color: var(--sidebar-active-color); + } + } + + a { + @extend %sidebar-links; + } + + #avatar { + display: block; + width: 6.5rem; + height: 6.5rem; + overflow: hidden; + box-shadow: var(--avatar-border-color) 0 0 0 2px; + transform: translateZ(0); /* fixed the zoom in Safari */ + + @include bp.sm { + width: 7rem; + height: 7rem; + } + + img { + transition: transform 0.5s; + + &:hover { + transform: scale(1.2); + } + } + } + + .profile-wrapper { + @include mx.mt-mb(2.5rem); + @extend %clickable-transition; + + padding-left: 2.5rem; + padding-right: 1.25rem; + width: 100%; + + @include bp.lg { + margin-top: 3rem; + } + + @include bp.xxxl { + margin-top: 3.5rem; + margin-bottom: 2.5rem; + padding-left: 3.5rem; + } + } + + .site-title { + @extend %clickable-transition; + @extend %sidebar-link-hover; + + font-family: inherit; + font-weight: 900; + font-size: 1.75rem; + line-height: 1.2; + letter-spacing: 0.25px; + margin-top: 1.25rem; + margin-bottom: 0.5rem; + width: fit-content; + color: var(--site-title-color); + } + + .site-subtitle { + font-size: 95%; + color: var(--site-subtitle-color); + margin-top: 0.25rem; + word-spacing: 1px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + + ul { + margin-bottom: 2rem; + + li.nav-item { + opacity: 0.9; + width: 100%; + + @include mx.pl-pr(1.5rem); + + @include bp.xxxl { + @include mx.pl-pr(2.75rem); + } + + a.nav-link { + @include mx.pt-pb(0.6rem); + + display: flex; + align-items: center; + border-radius: 0.75rem; + font-weight: 600; + + &:hover { + background-color: var(--sidebar-hover-bg); + } + + i { + font-size: 95%; + opacity: 0.8; + margin-right: 1.5rem; + } + + span { + font-size: 90%; + letter-spacing: 0.2px; + } + } + + &.active { + .nav-link { + color: var(--sidebar-active-color); + background-color: var(--sidebar-hover-bg); + + span { + opacity: 1; + } + } + } + + &:not(:first-child) { + margin-top: 0.25rem; + } + } + } + + .sidebar-bottom { + padding-left: 2rem; + padding-right: 1rem; + margin-bottom: 1.5rem; + + @include bp.xxxl { + padding-left: 2.75rem; + margin-bottom: 1.75rem; + } + + $btn-size: 1.75rem; + + %button { + width: $btn-size; + height: $btn-size; + margin-bottom: $btn-mb; // multi line gap + border-radius: 50%; + color: var(--sidebar-btn-color); + background-color: var(--sidebar-btn-bg); + text-align: center; + display: flex; + align-items: center; + justify-content: center; + + &:not(:focus-visible) { + box-shadow: var(--sidebar-border-color) 0 0 0 1px; + } + + &:hover { + background-color: var(--sidebar-hover-bg); + } + } + + a { + @extend %button; + @extend %sidebar-link-hover; + @extend %clickable-transition; + + &:not(:last-child) { + margin-right: v.$sb-btn-gap; + + @include bp.xxxl { + margin-right: v.$sb-btn-gap-lg; + } + } + } + + i { + line-height: $btn-size; + } + + #mode-toggle { + @extend %button; + @extend %sidebar-links; + @extend %sidebar-link-hover; + } + + .icon-border { + @extend %no-cursor; + @include mx.ml-mr(calc((v.$sb-btn-gap - $btn-border-width) / 2)); + + background-color: var(--sidebar-btn-color); + content: ''; + width: $btn-border-width; + height: $btn-border-width; + border-radius: 50%; + margin-bottom: $btn-mb; + + @include bp.xxxl { + @include mx.ml-mr(calc((v.$sb-btn-gap-lg - $btn-border-width) / 2)); + } + } + } /* .sidebar-bottom */ +} /* #sidebar */ + +[#{$sidebar-display}] { + #main-wrapper { + @include bp.lt(bp.get(lg)) { + transform: translateX(v.$sidebar-width); + } + } +} diff --git a/_sass/layout/_topbar.scss b/_sass/layout/_topbar.scss new file mode 100644 index 00000000..eb0aea9b --- /dev/null +++ b/_sass/layout/_topbar.scss @@ -0,0 +1,86 @@ +@use '../abstracts/variables' as v; +@use '../abstracts/mixins' as mx; +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/placeholders'; + +#topbar-wrapper { + height: v.$topbar-height; + background-color: var(--topbar-bg); + + @include bp.lt(bp.get(lg)) { + @include mx.slide(top 0.2s ease); + + left: 0; + } +} + +#topbar { + @extend %btn-color; + + #breadcrumb { + font-size: 1rem; + color: var(--text-muted-color); + padding-left: 0.5rem; + + a:hover { + @extend %link-hover; + } + + span { + &:not(:last-child) { + &::after { + content: '›'; + padding: 0 0.3rem; + } + } + } + + @include bp.lt(bp.get(lg)) { + display: none; + } + + @include bp.between(bp.get(lg), calc(#{bp.get(xl)} - 1px)) { + width: 65%; + overflow: hidden; + text-overflow: ellipsis; + word-break: keep-all; + white-space: nowrap; + } + } + + @include bp.lte(bp.get(md)) { + @include mx.max-w-100; + } + + @include bp.lt(bp.get(lg)) { + max-width: 100%; + } +} + +#topbar-title { + display: none; + font-size: 1.1rem; + font-weight: 600; + font-family: sans-serif; + color: var(--topbar-text-color); + text-align: center; + width: 70%; + word-break: keep-all; + + @include bp.lt(bp.get(lg)) { + display: block; + } + + @include bp.lg { + text-align: left; + } +} + +#sidebar-trigger, +#search-trigger { + display: none; + + @include bp.lt(bp.get(lg)) { + display: block; + } +} diff --git a/_sass/main.bundle.scss b/_sass/main.bundle.scss index 52e893fe..5d84f938 100644 --- a/_sass/main.bundle.scss +++ b/_sass/main.bundle.scss @@ -1,2 +1,2 @@ -@import 'dist/bootstrap'; -@import 'main'; +@use 'vendors/bootstrap'; +@use 'main'; diff --git a/_sass/main.scss b/_sass/main.scss index 1c2311d5..3bbb70d6 100644 --- a/_sass/main.scss +++ b/_sass/main.scss @@ -1,13 +1,4 @@ -@import 'colors/typography-light'; -@import 'colors/typography-dark'; -@import 'addon/variables'; -@import 'variables-hook'; -@import 'addon/module'; -@import 'addon/syntax'; -@import 'addon/commons'; -@import 'layout/home'; -@import 'layout/post'; -@import 'layout/tags'; -@import 'layout/archives'; -@import 'layout/categories'; -@import 'layout/category-tag'; +@forward 'base'; +@forward 'components'; +@forward 'layout'; +@forward 'pages'; diff --git a/_sass/layout/archives.scss b/_sass/pages/_archives.scss similarity index 95% rename from _sass/layout/archives.scss rename to _sass/pages/_archives.scss index fd1979b8..86e77a89 100644 --- a/_sass/layout/archives.scss +++ b/_sass/pages/_archives.scss @@ -1,10 +1,17 @@ -/* - Style for Archives -*/ +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/placeholders'; #archives { letter-spacing: 0.03rem; + @include bp.lt(bp.get(sm)) { + margin-top: -1rem; + + ul { + letter-spacing: 0; + } + } + $timeline-width: 4px; %timeline { @@ -131,13 +138,3 @@ } } } /* #archives */ - -@media all and (max-width: 576px) { - #archives { - margin-top: -1rem; - - ul { - letter-spacing: 0; - } - } -} diff --git a/_sass/layout/categories.scss b/_sass/pages/_categories.scss similarity index 87% rename from _sass/layout/categories.scss rename to _sass/pages/_categories.scss index f12b9633..64a2df50 100644 --- a/_sass/layout/categories.scss +++ b/_sass/pages/_categories.scss @@ -1,8 +1,7 @@ -/* - Style for Tab Categories -*/ +@use '../abstracts/variables' as v; +@use '../abstracts/placeholders'; -%category-icon-color { +%-category-icon-color { color: gray; } @@ -16,7 +15,7 @@ } .card-header { - $radius: calc($radius-lg - 1px); + $radius: calc(v.$radius-lg - 1px); padding: 0.75rem; border-radius: $radius; @@ -29,7 +28,7 @@ } i { - @extend %category-icon-color; + @extend %-category-icon-color; font-size: 86%; /* fontawesome icons */ } diff --git a/_sass/layout/category-tag.scss b/_sass/pages/_category-tag.scss similarity index 79% rename from _sass/layout/category-tag.scss rename to _sass/pages/_category-tag.scss index fe7d99ce..0a827121 100644 --- a/_sass/layout/category-tag.scss +++ b/_sass/pages/_category-tag.scss @@ -1,6 +1,6 @@ -/* - Style for page Category and Tag -*/ +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/mixins' as mx; +@use '../abstracts/placeholders'; .dash { margin: 0 0.5rem 0.6rem 0.5rem; @@ -24,6 +24,10 @@ position: relative; top: 0.6rem; margin-right: 0.5rem; + + @include bp.lt(bp.get(sm)) { + margin: 0 0.5rem; + } } /* post's title */ @@ -31,6 +35,10 @@ @extend %no-bottom-border; font-size: 1.1rem; + + @include bp.lt(bp.get(sm)) { + @include mx.text-ellipsis; + } } } } @@ -53,18 +61,3 @@ margin-bottom: -1px; /* Avoid jumping */ } } - -@media all and (max-width: 576px) { - #page-category, - #page-tag { - ul > li { - &::before { - margin: 0 0.5rem; - } - - > a { - @include text-ellipsis; - } - } - } -} diff --git a/_sass/layout/home.scss b/_sass/pages/_home.scss similarity index 73% rename from _sass/layout/home.scss rename to _sass/pages/_home.scss index 7fff3ba1..7a4bbf9b 100644 --- a/_sass/layout/home.scss +++ b/_sass/pages/_home.scss @@ -1,10 +1,14 @@ -/* - Style for Homepage -*/ +@use '../abstracts/variables' as v; +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/placeholders'; #post-list { margin-top: 2rem; + @include bp.lg { + margin-top: 2.5rem; + } + .card-wrapper { &:hover { text-decoration: none; @@ -20,7 +24,11 @@ background: none; %img-radius { - border-radius: $radius-lg $radius-lg 0 0; + border-radius: v.$radius-lg v.$radius-lg 0 0; + + @include bp.md { + border-radius: 0 v.$radius-lg v.$radius-lg 0; + } } .preview-img { @@ -35,6 +43,10 @@ height: 100%; padding: 1rem; + @include bp.md { + padding: 1.75rem 1.75rem 1.25rem; + } + .card-title { @extend %text-clip; @@ -46,14 +58,20 @@ color: var(--text-muted-color) !important; } - .card-text.content { - @extend %muted; + .card-text { + @include bp.md { + display: inherit !important; + } - p { - @extend %text-clip; + &.content { + @extend %muted; - line-height: 1.5; - margin: 0; + p { + @extend %text-clip; + + line-height: 1.5; + margin: 0; + } } } @@ -63,6 +81,10 @@ i { &:not(:first-child) { margin-left: 1.5rem; + + @include bp.md { + margin-left: 1.75rem; + } } } @@ -87,11 +109,28 @@ font-family: Lato, sans-serif; justify-content: space-evenly; + @include bp.lg { + font-size: 0.85rem; + justify-content: center; + } + a:hover { text-decoration: none; } .page-item { + @include bp.lt(bp.get(lg)) { + &:not(:first-child):not(:last-child) { + display: none; + } + } + + @include bp.lg { + &:not(:last-child) { + margin-right: 0.7rem; + } + } + .page-link { color: var(--btn-patinator-text-color); padding: 0 0.6rem; @@ -125,64 +164,10 @@ } } } /* .page-item */ -} /* .pagination */ - -/* Tablet */ -@media all and (min-width: 768px) { - %img-radius { - border-radius: 0 $radius-lg $radius-lg 0; - } - - #post-list { - .card { - .card-body { - padding: 1.75rem 1.75rem 1.25rem 1.75rem; - .card-text { - display: inherit !important; - } - - .post-meta { - i { - &:not(:first-child) { - margin-left: 1.75rem; - } - } - } - } - } - } -} - -/* Hide SideBar and TOC */ -@media all and (max-width: 830px) { - .pagination { - .page-item { - &:not(:first-child):not(:last-child) { - display: none; - } - } - } -} - -/* Sidebar is visible */ -@media all and (min-width: 831px) { - #post-list { - margin-top: 2.5rem; - } - - .pagination { - font-size: 0.85rem; - justify-content: center; - - .page-item { - &:not(:last-child) { - margin-right: 0.7rem; - } - } - - .page-index { + .page-index { + @include bp.lg { display: none; } - } /* .pagination */ + } } diff --git a/_sass/pages/_index.scss b/_sass/pages/_index.scss new file mode 100644 index 00000000..74e9ea6e --- /dev/null +++ b/_sass/pages/_index.scss @@ -0,0 +1,7 @@ +@forward 'search'; +@forward 'home'; +@forward 'post'; +@forward 'categories'; +@forward 'tags'; +@forward 'archives'; +@forward 'category-tag'; diff --git a/_sass/layout/post.scss b/_sass/pages/_post.scss similarity index 67% rename from _sass/layout/post.scss rename to _sass/pages/_post.scss index 891479e6..d789050d 100644 --- a/_sass/layout/post.scss +++ b/_sass/pages/_post.scss @@ -1,14 +1,15 @@ -/** - * Post-specific styles - */ +@use '../abstracts/variables' as v; +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/mixins' as mx; +@use '../abstracts/placeholders'; -%btn-post-nav { +%-btn-post-nav { width: 50%; position: relative; border-color: var(--btn-border-color); } -@mixin dot($pl: 0.25rem, $pr: 0.25rem) { +@mixin -dot($pl: 0.25rem, $pr: 0.25rem) { content: '\2022'; padding-left: $pl; padding-right: $pr; @@ -24,7 +25,7 @@ header { .post-meta { span + span::before { - @include dot; + @include -dot; } em, @@ -113,9 +114,20 @@ header { } /* .share-wrapper */ } +.post-tail-bottom { + @include bp.lte(bp.get(sm)) { + flex-wrap: wrap-reverse !important; + + > div:first-child { + width: 100%; + margin-top: 1rem; + } + } +} + .share-mastodon { /* See: https://github.com/justinribeiro/share-to-mastodon#properties */ - --wc-stm-font-family: $font-family-base; + --wc-stm-font-family: v.$font-family-base; --wc-stm-dialog-background-color: var(--card-bg); --wc-stm-form-button-border: 1px solid var(--btn-border-color); --wc-stm-form-submit-background-color: var(--sidebar-btn-bg); @@ -139,8 +151,13 @@ header { } .post-navigation { + @include bp.lt(bp.get(lg)) { + @include mx.pl-pr(0); + @include mx.ml-mr(-0.5rem); + } + .btn { - @extend %btn-post-nav; + @extend %-btn-post-nav; &:not(:hover) { color: var(--link-color); @@ -153,7 +170,7 @@ header { } &.disabled { - @extend %btn-post-nav; + @extend %-btn-post-nav; pointer-events: auto; cursor: not-allowed; @@ -173,12 +190,12 @@ header { } &:first-child { - border-radius: $radius-lg 0 0 $radius-lg; + border-radius: v.$radius-lg 0 0 v.$radius-lg; left: 0.5px; } &:last-child { - border-radius: 0 $radius-lg $radius-lg 0; + border-radius: 0 v.$radius-lg v.$radius-lg 0; right: 0.5px; } } @@ -298,23 +315,27 @@ header { top: 0; z-index: 1; margin: 0 -1rem; - height: $topbar-height; + height: v.$topbar-height; background: var(--main-bg); border-bottom: 1px solid var(--main-border-color); transition: all 0.2s ease-in-out; @extend %btn-color; + @include bp.xl { + display: none !important; + } + .label { @extend %heading; - margin-left: 0.25rem; + margin-left: 0.375rem; padding: 0 0.75rem; color: inherit; } &.invisible { - top: -$topbar-height; + top: -#{v.$topbar-height}; transition: none; } } @@ -322,11 +343,15 @@ header { #toc-solo-trigger { color: var(--text-muted-color); border-color: var(--btn-border-color); - border-radius: $radius-lg; + border-radius: v.$radius-lg; + + @include bp.xl { + display: none !important; + } .label { font-size: 1rem; - font-family: $font-family-heading; + font-family: v.$font-family-heading; } &:hover { @@ -338,7 +363,7 @@ header { @mixin slide-in { from { opacity: 0.7; - transform: translateY(-$topbar-height); + transform: translateY(-#{v.$topbar-height}); } to { @@ -354,7 +379,7 @@ header { } 100% { - transform: translateY(-$topbar-height); + transform: translateY(-#{v.$topbar-height}); opacity: 0; } } @@ -375,129 +400,11 @@ header { @include slide-out; } -#toc-popup { - $slide-in: slide-in 0.3s ease-out; - $slide-out: slide-out 0.3s ease-out; - $curtain-height: 2rem; - $backdrop: blur(5px); - - border-color: var(--toc-popup-border-color); - border-width: 1px; - border-radius: $radius-lg; - color: var(--text-color); - background: var(--card-bg); - margin-top: $topbar-height; - min-width: 20rem; - font-size: 1.05rem; - - @media all and (min-width: 576px) { - max-width: 32rem; - } - - &[open] { - -webkit-animation: $slide-in; - animation: $slide-in; - } - - &[closing] { - -webkit-animation: $slide-out; - animation: $slide-out; - } - - @media all and (min-width: 850px) { - left: $sidebar-width; - } - - .header { - @extend %btn-color; - - position: -webkit-sticky; - position: sticky; - top: 0; - background-color: inherit; - border-bottom: 1px solid var(--main-border-color); - - .label { - font-family: $font-family-heading; - } - } - - button { - > i { - font-size: 1.25rem; - vertical-align: middle; - } - - &:focus-visible { - box-shadow: none; - } - } - - ul { - list-style-type: none; - padding-left: 0; - - li { - ul, - & + li { - margin-top: 0.25rem; - } - - a { - display: flex; - line-height: 1.5; - padding: 0.375rem 0; - padding-right: 1.125rem; - - &.toc-link::before { - display: none; - } - } - } - } - - @for $i from 2 through 4 { - .node-name--H#{$i} { - padding-left: 1.125rem * ($i - 1); - } - } - - .is-active-link { - color: var(--toc-highlight) !important; - font-weight: 600; - } - - &::-webkit-backdrop { - -webkit-backdrop-filter: $backdrop; - backdrop-filter: $backdrop; - } - - &::backdrop { - -webkit-backdrop-filter: $backdrop; - backdrop-filter: $backdrop; - } - - &::after { - display: flex; - content: ''; - position: relative; - background: linear-gradient(transparent, var(--card-bg) 70%); - height: $curtain-height; - } - - #toc-popup-content { - overflow: auto; - max-height: calc(100vh - 4 * $topbar-height); - font-family: $font-family-heading; - margin-bottom: -$curtain-height; - } -} - /* --- Related Posts --- */ #related-posts { > h3 { - @include label(1.1rem, 600); + @include mx.label(1.1rem, 600); } time { @@ -540,47 +447,23 @@ header { } .share-label { - @include label(inherit, 400, inherit); + @include mx.label(inherit, 400, inherit); &::after { content: ':'; } } -@media all and (max-width: 576px) { - .post-tail-bottom { - flex-wrap: wrap-reverse !important; - - > div:first-child { - width: 100%; - margin-top: 1rem; - } - } -} - -@media all and (max-width: 768px) { - .content > p > img { +.content > p > img { + @include bp.lte(bp.get(md)) { max-width: calc(100% + 1rem); } } -/* Hide SideBar and TOC */ -@media all and (max-width: 849px) { - .post-navigation { - @include pl-pr(0); - @include ml-mr(-0.5rem); - } -} - -@media all and (min-width: 1200px) { - h2, - h3, - h4 { +h2, +h3, +h4 { + @include bp.xl { scroll-margin-top: 2rem; } - - #toc-bar, - #toc-solo-trigger { - display: none !important; - } } diff --git a/_sass/pages/_search.scss b/_sass/pages/_search.scss new file mode 100644 index 00000000..dfb044ed --- /dev/null +++ b/_sass/pages/_search.scss @@ -0,0 +1,184 @@ +@use '../abstracts/breakpoints' as bp; +@use '../abstracts/variables' as v; +@use '../abstracts/placeholders'; + +search { + display: flex; + width: 100%; + border-radius: 1rem; + border: 1px solid var(--search-border-color); + background: var(--main-bg); + padding: 0 0.5rem; + + i { + z-index: 2; + font-size: 0.9rem; + color: var(--search-icon-color); + } + + @include bp.lt(bp.get(lg)) { + display: none; + } + + @include bp.lg { + max-width: v.$search-max-width; + } + + @include bp.xl { + margin-right: 4rem; + } + + @include bp.xxxl { + margin-right: calc( + v.$main-content-max-width / 4 - v.$search-max-width - 0.75rem + ); + } +} + +#search-result-wrapper { + display: none; + height: 100%; + width: 100%; + overflow: auto; + + .content { + margin-top: 2rem; + } + + @include bp.lt(bp.get(lg)) { + width: 100%; + + .content { + letter-spacing: 0; + } + } + + @include bp.lg { + max-width: v.$main-content-max-width; + justify-content: start !important; + } +} + +#search-results { + padding-bottom: 3rem; + + @include bp.between(bp.get(lg), calc(#{bp.get(xl)} - 1px)) { + > div { + max-width: 700px; + } + } + + a { + font-size: 1.4rem; + line-height: 1.5rem; + + &:hover { + @extend %link-hover; + } + + @extend %link-color; + @extend %no-bottom-border; + @extend %heading; + } + + > article { + width: 100%; + + &:not(:last-child) { + margin-bottom: 1rem; + } + + @include bp.xl { + width: 45%; + + &:nth-child(odd) { + margin-right: 1.5rem; + } + + &:nth-child(even) { + margin-left: 1.5rem; + } + + &:last-child:nth-child(odd) { + position: relative; + right: 24.3%; + } + } + + h2 { + line-height: 2.5rem; + } + + /* icons */ + i { + color: #818182; + margin-right: 0.15rem; + font-size: 80%; + } + + > p { + @extend %text-ellipsis; + + white-space: break-spaces; + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + } + } +} + +/* 'Cancel' link */ +#search-cancel { + color: var(--link-color); + display: none; + white-space: nowrap; + + @extend %cursor-pointer; +} + +#search-input { + background: center; + border: 0; + border-radius: 0; + padding: 0.18rem 0.3rem; + color: var(--text-color); + height: auto; + + &:focus { + box-shadow: none; + } + + @include bp.xl { + transition: all 0.3s ease-in-out; + } +} + +#search-hints { + padding: 0 1rem; + + @include bp.lg { + display: none; + } + + h4 { + margin-bottom: 1.5rem; + } + + .post-tag { + display: inline-block; + line-height: 1rem; + font-size: 1rem; + background: var(--search-tag-bg); + border: none; + padding: 0.5rem; + margin: 0 1.25rem 1rem 0; + + &::before { + content: '#'; + color: var(--text-muted-color); + padding-right: 0.2rem; + } + + @extend %link-color; + } +} diff --git a/_sass/layout/tags.scss b/_sass/pages/_tags.scss similarity index 71% rename from _sass/layout/tags.scss rename to _sass/pages/_tags.scss index 4cf5d3b7..d22f20d6 100644 --- a/_sass/layout/tags.scss +++ b/_sass/pages/_tags.scss @@ -1,6 +1,4 @@ -/* - Styles for Tab Tags -*/ +@use '../abstracts/breakpoints' as bp; .tag { border-radius: 0.7em; @@ -17,3 +15,9 @@ font-family: Oswald, sans-serif; } } + +#tags { + @include bp.lt(bp.get(lg)) { + justify-content: center !important; + } +} diff --git a/_sass/colors/typography-dark.scss b/_sass/themes/_dark.scss similarity index 62% rename from _sass/colors/typography-dark.scss rename to _sass/themes/_dark.scss index 664c9365..8c2f6ea8 100644 --- a/_sass/colors/typography-dark.scss +++ b/_sass/themes/_dark.scss @@ -1,8 +1,6 @@ -/* - * The main dark mode styles - */ +@mixin styles { + color-scheme: dark; -@mixin dark-scheme { /* Framework color */ --main-bg: rgb(27, 27, 30); --mask-bg: rgb(68, 69, 70); @@ -100,7 +98,18 @@ --timeline-color: rgb(63, 65, 68); --timeline-year-dot-color: var(--timeline-color); - color-scheme: dark; + /* Code highlight colors */ + --language-border-color: #2d2d2d; + --highlight-bg-color: #151515; + --highlighter-rouge-color: #c9def1; + --highlight-lineno-color: #808080; + --inline-code-bg: rgba(255, 255, 255, 0.05); + --code-color: #b0b0b0; + --code-header-text-color: #6a6a6a; + --code-header-muted-color: #353535; + --code-header-icon-color: #565656; + --clipboard-checked-color: #2bcc2b; + --filepath-text-color: #cacaca; .light { display: none; @@ -144,4 +153,151 @@ #disqus_thread { color-scheme: none; } -} /* dark-scheme */ + + /* --- Syntax highlight theme from `rougify style base16.dark` --- */ + + .highlight .gp { + color: #87939d; + } + + .highlight table td { + padding: 5px; + } + + .highlight table pre { + margin: 0; + } + + .highlight, + .highlight .w { + color: #d0d0d0; + background-color: #151515; + } + + .highlight .err { + color: #151515; + background-color: #ac4142; + } + + .highlight .c, + .highlight .ch, + .highlight .cd, + .highlight .cm, + .highlight .cpf, + .highlight .c1, + .highlight .cs { + color: #848484; + } + + .highlight .cp { + color: #f4bf75; + } + + .highlight .nt { + color: #f4bf75; + } + + .highlight .o, + .highlight .ow { + color: #d0d0d0; + } + + .highlight .p, + .highlight .pi { + color: #d0d0d0; + } + + .highlight .gi { + color: #90a959; + } + + .highlight .gd { + color: #f08a8b; + background-color: #320000; + } + + .highlight .gh { + color: #6a9fb5; + background-color: #151515; + font-weight: bold; + } + + .highlight .k, + .highlight .kn, + .highlight .kp, + .highlight .kr, + .highlight .kv { + color: #aa759f; + } + + .highlight .kc { + color: #d28445; + } + + .highlight .kt { + color: #d28445; + } + + .highlight .kd { + color: #d28445; + } + + .highlight .s, + .highlight .sb, + .highlight .sc, + .highlight .dl, + .highlight .sd, + .highlight .s2, + .highlight .sh, + .highlight .sx, + .highlight .s1 { + color: #90a959; + } + + .highlight .sa { + color: #aa759f; + } + + .highlight .sr { + color: #75b5aa; + } + + .highlight .si { + color: #b76d45; + } + + .highlight .se { + color: #b76d45; + } + + .highlight .nn { + color: #f4bf75; + } + + .highlight .nc { + color: #f4bf75; + } + + .highlight .no { + color: #f4bf75; + } + + .highlight .na { + color: #6a9fb5; + } + + .highlight .m, + .highlight .mb, + .highlight .mf, + .highlight .mh, + .highlight .mi, + .highlight .il, + .highlight .mo, + .highlight .mx { + color: #90a959; + } + + .highlight .ss { + color: #90a959; + } +} diff --git a/_sass/themes/_light.scss b/_sass/themes/_light.scss new file mode 100644 index 00000000..14c3962b --- /dev/null +++ b/_sass/themes/_light.scss @@ -0,0 +1,313 @@ +@mixin styles { + /* Framework color */ + --main-bg: white; + --mask-bg: #c1c3c5; + --main-border-color: #f3f3f3; + + /* Common color */ + --text-color: #34343c; + --text-muted-color: #757575; + --text-muted-highlight-color: inherit; + --heading-color: #2a2a2a; + --label-color: #585858; + --blockquote-border-color: #eeeeee; + --blockquote-text-color: #757575; + --link-color: #0056b2; + --link-underline-color: #dee2e6; + --button-bg: #ffffff; + --btn-border-color: #e9ecef; + --btn-backtotop-color: #686868; + --btn-backtotop-border-color: #f1f1f1; + --checkbox-color: #c5c5c5; + --checkbox-checked-color: #07a8f7; + --img-bg: radial-gradient( + circle, + rgb(255, 255, 255) 0%, + rgb(239, 239, 239) 100% + ); + --shimmer-bg: linear-gradient( + 90deg, + rgba(250, 250, 250, 0) 0%, + rgba(232, 230, 230, 1) 50%, + rgba(250, 250, 250, 0) 100% + ); + + /* Sidebar */ + --site-title-color: rgb(113, 113, 113); + --site-subtitle-color: #717171; + --sidebar-bg: #f6f8fa; + --sidebar-border-color: #efefef; + --sidebar-muted-color: #545454; + --sidebar-active-color: #1d1d1d; + --sidebar-hover-bg: rgb(223, 233, 241, 0.64); + --sidebar-btn-bg: white; + --sidebar-btn-color: #8e8e8e; + --avatar-border-color: white; + + /* Topbar */ + --topbar-bg: rgb(255, 255, 255, 0.7); + --topbar-text-color: rgb(78, 78, 78); + --search-border-color: rgb(240, 240, 240); + --search-icon-color: #c2c6cc; + --input-focus-border-color: #b8b8b8; + + /* Home page */ + --post-list-text-color: dimgray; + --btn-patinator-text-color: #555555; + --btn-paginator-hover-color: var(--sidebar-bg); + + /* Posts */ + --toc-highlight: #0550ae; + --toc-popup-border-color: lightgray; + --btn-share-color: gray; + --btn-share-hover-color: #0d6efd; + --card-bg: white; + --card-hovor-bg: #e2e2e2; + --card-shadow: rgb(104, 104, 104, 0.05) 0 2px 6px 0, + rgba(211, 209, 209, 0.15) 0 0 0 1px; + --footnote-target-bg: lightcyan; + --tb-odd-bg: #fbfcfd; + --tb-border-color: #eaeaea; + --dash-color: silver; + --kbd-wrap-color: #bdbdbd; + --kbd-text-color: var(--text-color); + --kbd-bg-color: white; + --prompt-text-color: rgb(46, 46, 46, 0.77); + --prompt-tip-bg: rgb(123, 247, 144, 0.2); + --prompt-tip-icon-color: #03b303; + --prompt-info-bg: #e1f5fe; + --prompt-info-icon-color: #0070cb; + --prompt-warning-bg: rgb(255, 243, 205); + --prompt-warning-icon-color: #ef9c03; + --prompt-danger-bg: rgb(248, 215, 218, 0.56); + --prompt-danger-icon-color: #df3c30; + + /* Tags */ + --tag-border: #dee2e6; + --tag-shadow: var(--btn-border-color); + --tag-hover: rgb(222, 226, 230); + --search-tag-bg: #f8f9fa; + + /* Categories */ + --categories-border: rgba(0, 0, 0, 0.125); + --categories-hover-bg: var(--btn-border-color); + --categories-icon-hover-color: darkslategray; + + /* Archive */ + --timeline-color: rgba(0, 0, 0, 0.075); + --timeline-node-bg: #c2c6cc; + --timeline-year-dot-color: #ffffff; + + /* --- Custom code light mode colors --- */ + --language-border-color: #ececec; + --highlight-bg-color: #f6f8fa; + --highlighter-rouge-color: #3f596f; + --highlight-lineno-color: #9e9e9e; + --inline-code-bg: rgba(25, 25, 28, 0.05); + --code-color: #3a3a3a; + --code-header-text-color: #a3a3a3; + --code-header-muted-color: #e5e5e5; + --code-header-icon-color: #c9c8c8; + --clipboard-checked-color: #43c743; + + [class^='prompt-'] { + --link-underline-color: rgb(219, 216, 216); + } + + .dark { + display: none; + } + + /* --- Syntax highlight theme from `rougify style github` --- */ + + .highlight table td { + padding: 5px; + } + + .highlight table pre { + margin: 0; + } + + .highlight, + .highlight .w { + color: #24292f; + background-color: #f6f8fa; + } + + .highlight .k, + .highlight .kd, + .highlight .kn, + .highlight .kp, + .highlight .kr, + .highlight .kt, + .highlight .kv { + color: #cf222e; + } + + .highlight .gr { + color: #f6f8fa; + } + + .highlight .gd { + color: #82071e; + background-color: #ffebe9; + } + + .highlight .nb { + color: #953800; + } + + .highlight .nc { + color: #953800; + } + + .highlight .no { + color: #953800; + } + + .highlight .nn { + color: #953800; + } + + .highlight .sr { + color: #116329; + } + + .highlight .na { + color: #116329; + } + + .highlight .nt { + color: #116329; + } + + .highlight .gi { + color: #116329; + background-color: #dafbe1; + } + + .highlight .kc { + color: #0550ae; + } + + .highlight .l, + .highlight .ld, + .highlight .m, + .highlight .mb, + .highlight .mf, + .highlight .mh, + .highlight .mi, + .highlight .il, + .highlight .mo, + .highlight .mx { + color: #0550ae; + } + + .highlight .sb { + color: #0550ae; + } + + .highlight .bp { + color: #0550ae; + } + + .highlight .ne { + color: #0550ae; + } + + .highlight .nl { + color: #0550ae; + } + + .highlight .py { + color: #0550ae; + } + + .highlight .nv, + .highlight .vc, + .highlight .vg, + .highlight .vi, + .highlight .vm { + color: #0550ae; + } + + .highlight .o, + .highlight .ow { + color: #0550ae; + } + + .highlight .gh { + color: #0550ae; + font-weight: bold; + } + + .highlight .gu { + color: #0550ae; + font-weight: bold; + } + + .highlight .s, + .highlight .sa, + .highlight .sc, + .highlight .dl, + .highlight .sd, + .highlight .s2, + .highlight .se, + .highlight .sh, + .highlight .sx, + .highlight .s1, + .highlight .ss { + color: #0a3069; + } + + .highlight .nd { + color: #8250df; + } + + .highlight .nf, + .highlight .fm { + color: #8250df; + } + + .highlight .err { + color: #f6f8fa; + background-color: #82071e; + } + + .highlight .c, + .highlight .ch, + .highlight .cd, + .highlight .cm, + .highlight .cp, + .highlight .cpf, + .highlight .c1, + .highlight .cs { + color: #68717a; + } + + .highlight .gl { + color: #68717a; + } + + .highlight .gt { + color: #68717a; + } + + .highlight .ni { + color: #24292f; + } + + .highlight .si { + color: #24292f; + } + + .highlight .ge { + color: #24292f; + font-style: italic; + } + + .highlight .gs { + color: #24292f; + font-weight: bold; + } +} diff --git a/_sass/variables-hook.scss b/_sass/variables-hook.scss deleted file mode 100644 index f27e0eb8..00000000 --- a/_sass/variables-hook.scss +++ /dev/null @@ -1,3 +0,0 @@ -/* - Appending custom SCSS variables will override the default ones in `_sass/addon/variables.scsss` -*/ diff --git a/assets/css/jekyll-theme-chirpy.scss b/assets/css/jekyll-theme-chirpy.scss index d20545ba..7ff89bf7 100644 --- a/assets/css/jekyll-theme-chirpy.scss +++ b/assets/css/jekyll-theme-chirpy.scss @@ -1,7 +1,7 @@ --- --- -@import 'main +@use 'main {%- if jekyll.environment == 'production' -%} .bundle {%- endif -%} diff --git a/package.json b/package.json index d6beea03..aa83ee72 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "homepage": "https://github.com/cotes2020/jekyll-theme-chirpy/", "scripts": { "build": "concurrently npm:build:*", - "build:css": "purgecss -c purgecss.config.js", + "build:css": "node purgecss.js", "build:js": "rollup -c --bundleConfigAsCjs --environment BUILD:production", "watch:js": "rollup -c --bundleConfigAsCjs -w", "lint:scss": "stylelint _sass/**/*.scss", diff --git a/purgecss.config.js b/purgecss.config.js deleted file mode 100644 index de370dea..00000000 --- a/purgecss.config.js +++ /dev/null @@ -1,23 +0,0 @@ -const fs = require('fs'); -const DIST_PATH = '_sass/dist'; - -fs.rm(DIST_PATH, { recursive: true, force: true }, (err) => { - if (err) { - throw err; - } - - fs.mkdirSync(DIST_PATH); -}); - -module.exports = { - content: ['_includes/**/*.html', '_layouts/**/*.html', '_javascript/**/*.js'], - css: ['node_modules/bootstrap/dist/css/bootstrap.min.css'], - keyframes: true, - variables: true, - output: `${DIST_PATH}/bootstrap.css`, - // The `safelist` should be changed appropriately for future development - safelist: { - standard: [/^collaps/, /^w-/, 'shadow', 'border', 'kbd'], - greedy: [/^col-/, /tooltip/] - } -}; diff --git a/purgecss.js b/purgecss.js new file mode 100644 index 00000000..ad42db29 --- /dev/null +++ b/purgecss.js @@ -0,0 +1,30 @@ +const fs = require('fs').promises; +const { PurgeCSS } = require('purgecss'); +const DIST_PATH = '_sass/vendors'; +const output = `${DIST_PATH}/_bootstrap.scss`; + +const config = { + content: ['_includes/**/*.html', '_layouts/**/*.html', '_javascript/**/*.js'], + css: ['node_modules/bootstrap/dist/css/bootstrap.min.css'], + keyframes: true, + variables: true, + // The `safelist` should be changed appropriately for future development + safelist: { + standard: [/^collaps/, /^w-/, 'shadow', 'border', 'kbd'], + greedy: [/^col-/, /tooltip/] + } +}; + +function main() { + fs.rm(DIST_PATH, { recursive: true, force: true }) + .then(() => fs.mkdir(DIST_PATH)) + .then(() => new PurgeCSS().purge(config)) + .then((result) => { + return fs.writeFile(output, result[0].css); + }) + .catch((err) => { + console.error('Error during PurgeCSS process:', err); + }); +} + +main(); diff --git a/tools/init.sh b/tools/init.sh index 2ad72ab9..d710182b 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -92,7 +92,8 @@ init_files() { npm i && npm run build # track the CSS/JS output - _sedi "/.*\/dist$/d" .gitignore + _sedi "/^_sass\/vendors/d" .gitignore + _sedi "/^assets\/js\/dist/d" .gitignore } commit() { diff --git a/tools/release.sh b/tools/release.sh index 522c892c..36ca88af 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -15,7 +15,7 @@ NODE_SPEC="package.json" CHANGELOG="docs/CHANGELOG.md" CONFIG="_config.yml" -CSS_DIST="_sass/dist" +CSS_DIST="_sass/vendors" JS_DIST="assets/js/dist" FILES=( From 5756b8fc2636071de9bf7a137fec1dec811a9043 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 25 Nov 2024 00:18:06 +0800 Subject: [PATCH 073/177] build(deps-dev): upgrade dependencies Close #2058 --- package.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index aa83ee72..36f77e53 100644 --- a/package.json +++ b/package.json @@ -28,25 +28,25 @@ "bootstrap": "^5.3.3" }, "devDependencies": { - "@babel/core": "^7.25.2", - "@babel/plugin-transform-class-properties": "^7.25.4", - "@babel/plugin-transform-private-methods": "^7.25.7", - "@babel/preset-env": "^7.25.4", - "@commitlint/cli": "^19.5.0", - "@commitlint/config-conventional": "^19.5.0", + "@babel/core": "^7.26.0", + "@babel/plugin-transform-class-properties": "^7.25.9", + "@babel/plugin-transform-private-methods": "^7.25.9", + "@babel/preset-env": "^7.26.0", + "@commitlint/cli": "^19.6.0", + "@commitlint/config-conventional": "^19.6.0", "@rollup/plugin-babel": "^6.0.4", - "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-terser": "^0.4.4", "@semantic-release/changelog": "^6.0.3", "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", - "concurrently": "^9.0.1", + "concurrently": "^9.1.0", "conventional-changelog-conventionalcommits": "^8.0.0", - "husky": "^9.1.6", - "purgecss": "^6.0.0", - "rollup": "^4.21.3", - "semantic-release": "^24.1.1", - "stylelint": "^16.9.0", + "husky": "^9.1.7", + "purgecss": "^7.0.2", + "rollup": "^4.27.4", + "semantic-release": "^24.2.0", + "stylelint": "^16.10.0", "stylelint-config-standard-scss": "^13.1.0" }, "prettier": { From 11647697bbacb84df6171a0ac7947a0e4fdef5da Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 25 Nov 2024 03:55:11 +0800 Subject: [PATCH 074/177] build(deps): update dependencies version --- _data/origin/cors.yml | 8 ++++---- assets/lib | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index afdb3d9e..e9bb4eb9 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -20,17 +20,17 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour # Libraries toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.32.2/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.32.2/dist/tocbot.min.js fontawesome: - css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/all.min.css + css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.7.1/css/all.min.css search: js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js mermaid: - js: https://cdn.jsdelivr.net/npm/mermaid@11.0.2/dist/mermaid.min.js + js: https://cdn.jsdelivr.net/npm/mermaid@11.4.0/dist/mermaid.min.js dayjs: js: diff --git a/assets/lib b/assets/lib index a231bc7e..b9e18a15 160000 --- a/assets/lib +++ b/assets/lib @@ -1 +1 @@ -Subproject commit a231bc7e2c67198e604950cb2be9147a0b2020c0 +Subproject commit b9e18a1510e3be5de250ed34205da318b76474e0 From 5265b039741555943f9a6f0451287aefb6810f28 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 28 Nov 2024 02:58:25 +0800 Subject: [PATCH 075/177] feat: support vertical scrolling for toc in desktop mode (#2064) --- _includes/toc.html | 5 +-- _layouts/default.html | 2 +- _sass/abstracts/_placeholders.scss | 4 +++ _sass/layout/_panel.scss | 12 +++++--- _sass/pages/_post.scss | 49 +++++++++++++++++++++++++++--- 5 files changed, 60 insertions(+), 12 deletions(-) diff --git a/_includes/toc.html b/_includes/toc.html index 49c8f905..883bf135 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -1,8 +1,9 @@ {% include toc-status.html %} {% if enable_toc %} -
-

{{- site.data.locales[include.lang].panel.toc -}}

+
+
+

{{- site.data.locales[include.lang].panel.toc -}}

{% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index c83c561c..a55bfefe 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -33,7 +33,7 @@ -
{% endcapture %} diff --git a/assets/js/data/search.json b/assets/js/data/search.json index 2601ed07..32bcff9b 100644 --- a/assets/js/data/search.json +++ b/assets/js/data/search.json @@ -5,16 +5,16 @@ swcache: true [ {% for post in site.posts %} + {%- capture description -%} + {% include post-description.html %} + {%- endcapture -%} { "title": {{ post.title | jsonify }}, "url": {{ post.url | relative_url | jsonify }}, "categories": {{ post.categories | join: ', ' | jsonify }}, "tags": {{ post.tags | join: ', ' | jsonify }}, "date": "{{ post.date }}", - {% include no-linenos.html content=post.content %} - {% assign _content = content | strip_html | strip_newlines %} - "snippet": {{ _content | truncate: 200 | jsonify }}, - "content": {{ _content | jsonify }} + "content": "{{ description }}" }{% unless forloop.last %},{% endunless %} {% endfor %} ] From 231956d77ad2cd05293e2eb0bcb9f6238aaf840b Mon Sep 17 00:00:00 2001 From: algorithmic-parallels <197329719+algorithmic-parallels@users.noreply.github.com> Date: Thu, 6 Feb 2025 00:27:54 -0500 Subject: [PATCH 097/177] docs: using long form Jekyll subcommand (#2231) --- _posts/2019-08-09-getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 26811269..71383938 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -68,7 +68,7 @@ For Unix-like systems, you can set up the environment natively for optimal perfo To run the site locally, use the following command: ```terminal -$ bundle exec jekyll s +$ bundle exec jekyll serve ``` > If you are using Dev Containers, you must run that command in the **VS Code** Terminal. From 7d4d35cd10109e78d60fbb6b25a9b205f780ad63 Mon Sep 17 00:00:00 2001 From: MasihGhaznavi <48735862+masihgh@users.noreply.github.com> Date: Sun, 9 Feb 2025 09:58:39 +0330 Subject: [PATCH 098/177] feat(i18n): add persian language (#2238) --- _data/locales/fa-IR.yaml | 91 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 _data/locales/fa-IR.yaml diff --git a/_data/locales/fa-IR.yaml b/_data/locales/fa-IR.yaml new file mode 100644 index 00000000..d5c6e0eb --- /dev/null +++ b/_data/locales/fa-IR.yaml @@ -0,0 +1,91 @@ +# The layout text of site + +# ----- Commons label ----- + +layout: + post: پست + category: دسته‌بندی + tag: برچسب + +# The tabs of sidebar +tabs: + # format: : + home: خانه + categories: دسته‌بندی‌ها + tags: برچسب‌ها + archives: آرشیو + about: درباره + +# the text displayed in the search bar & search results +search: + hint: جستجو + cancel: لغو + no_results: متأسفیم! هیچ نتیجه‌ای یافت نشد. + +panel: + lastmod: آخرین به‌روزرسانی + trending_tags: برچسب‌های پرطرفدار + toc: فهرست مطالب + +copyright: + # Shown at the bottom of the post + license: + template: این پست تحت مجوز :LICENSE_NAME توسط نویسنده منتشر شده است. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: برخی حقوق محفوظ است. + verbose: >- + مگر اینکه خلاف آن ذکر شده باشد، پست‌های وبلاگ در این سایت + تحت مجوز Creative Commons Attribution 4.0 International (CC BY 4.0) توسط نویسنده منتشر شده‌اند. + +meta: با استفاده از :PLATFORM قالب :THEME + +not_found: + statement: متأسفیم، لینک زیر معتبر نیست یا به صفحه‌ای که وجود ندارد اشاره می‌کند. + +notification: + update_found: نسخه جدیدی از محتوا موجود است. + update: به‌روزرسانی + +# ----- Posts related labels ----- + +post: + written_by: نوشته شده توسط + posted: منتشر شده + updated: به‌روزرسانی شده + words: کلمات + pageview_measure: بازدیدها + read_time: + unit: دقیقه + prompt: زمان مطالعه + relate_posts: بیشتر بخوانید + share: اشتراک‌گذاری + button: + next: جدیدتر + previous: قدیمی‌تر + copy_code: + succeed: کپی شد! + share_link: + title: کپی لینک + succeed: لینک با موفقیت کپی شد! + +# Date time format. +# See: , +df: + post: + strftime: "%b %e, %Y" + dayjs: "ll" + archives: + strftime: "%b" + dayjs: "MMM" + +# categories page +categories: + category_measure: + singular: دسته‌بندی + plural: دسته‌بندی‌ها + post_measure: + singular: پست + plural: پست‌ها From e3158642c3aa248fc1f655773e903cafa862972e Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Tue, 4 Mar 2025 16:06:37 -0500 Subject: [PATCH 099/177] docs: fix typo in `2019-08-08-write-a-new-post.md` (#2281) Signed-off-by: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> --- _posts/2019-08-08-write-a-new-post.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index 085e7d67..10201655 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -21,7 +21,7 @@ Basically, you need to fill the [Front Matter](https://jekyllrb.com/docs/front-m --- title: TITLE date: YYYY-MM-DD HH:MM:SS +/-TTTT -categories: [TOP_CATEGORIE, SUB_CATEGORIE] +categories: [TOP_CATEGORY, SUB_CATEGORY] tags: [TAG] # TAG names should always be lowercase --- ``` From 54d4d59d22ac543a14bfbd9bb3d6fb6756056041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=BCrkalp=20Burak=20KAYRANCIO=C4=9ELU?= Date: Sat, 8 Mar 2025 17:24:47 +0300 Subject: [PATCH 100/177] perf(seo): improve accessibility and aligns with best practices (#2289) --- _includes/topbar.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/topbar.html b/_includes/topbar.html index fd68d1fe..09bbc208 100644 --- a/_includes/topbar.html +++ b/_includes/topbar.html @@ -40,7 +40,7 @@ - @@ -55,7 +55,7 @@ {% endif %} - From 571c90f13011eb91d0e1392218f3953060b920c9 Mon Sep 17 00:00:00 2001 From: nakamura <71050561+manabu-nakamura@users.noreply.github.com> Date: Sat, 29 Mar 2025 04:54:54 +0900 Subject: [PATCH 101/177] feat(i18n): add Japanese locale (#2295) --- _data/locales/ja-JP.yml | 84 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 _data/locales/ja-JP.yml diff --git a/_data/locales/ja-JP.yml b/_data/locales/ja-JP.yml new file mode 100644 index 00000000..8e016b99 --- /dev/null +++ b/_data/locales/ja-JP.yml @@ -0,0 +1,84 @@ +# The layout text of site + +# ----- Commons label ----- + +layout: + post: 投稿 + category: カテゴリー + tag: タグ + +# The tabs of sidebar +tabs: + # format: : + home: ホーム + categories: カテゴリー + tags: タグ + archives: アーカイブ + about: このサイトについて + +# the text displayed in the search bar & search results +search: + hint: 検索 + cancel: キャンセル + no_results: 該当なし + +panel: + lastmod: 最近更新された投稿 + trending_tags: トレンドのタグ + toc: コンテンツ + +copyright: + # Shown at the bottom of the post + license: + template: この投稿は投稿者によって :LICENSE_NAME の下でライセンスされています。 + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: Some rights reserved. + verbose: >- + Except where otherwise noted, the blog posts on this site are licensed + under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author. + +meta: :PLATFORM 用の :THEME を使用しています。 + +not_found: + statement: このURLは存在しないものを指し示しています。 + +notification: + update_found: 新しいバージョンが利用可能です。 + update: 更新 + +# ----- Posts related labels ----- + +post: + written_by: 投稿者 + posted: 投稿日 + updated: 更新日 + words: 語 + pageview_measure: 回閲覧 + read_time: + unit: 分 + prompt: で読めます + relate_posts: さらに読む + share: シェア + button: + next: 次 + previous: 前 + copy_code: + succeed: コピーしました + share_link: + title: リンクをコピー + succeed: リンクをコピーしました + +# Date time format. +# See: , +df: + post: + strftime: "%Y/%m/%d" + dayjs: "YYYY/MM/DD" + +# categories page +categories: + category_measure: カテゴリー + post_measure: 投稿 From db40db6d3df7058a28b04f42ff6ee79954a5de1c Mon Sep 17 00:00:00 2001 From: Alejandro Date: Sat, 5 Apr 2025 01:28:29 +0200 Subject: [PATCH 102/177] chore: add parameter in `search-results.html` (#2330) --- _includes/search-results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/search-results.html b/_includes/search-results.html index 00a31828..04a10305 100644 --- a/_includes/search-results.html +++ b/_includes/search-results.html @@ -3,7 +3,7 @@
- {% include_cached trending-tags.html %} + {% include_cached trending-tags.html lang=include.lang %}
From f7449299e88c71da2104f0007f2db23a8fa798be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Mon, 7 Apr 2025 13:36:32 +0200 Subject: [PATCH 103/177] fix: prevent the search bar from moving when focused (#2336) --- _includes/topbar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/topbar.html b/_includes/topbar.html index 09bbc208..735f1d1c 100644 --- a/_includes/topbar.html +++ b/_includes/topbar.html @@ -1,6 +1,6 @@ -
+
Date: Sun, 13 Apr 2025 22:16:47 +0800 Subject: [PATCH 104/177] feat(i18n): add Catalan Spanish locale translation (#2349) --- _data/locales/ca-ES.yml | 84 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 _data/locales/ca-ES.yml diff --git a/_data/locales/ca-ES.yml b/_data/locales/ca-ES.yml new file mode 100644 index 00000000..e3d5b39c --- /dev/null +++ b/_data/locales/ca-ES.yml @@ -0,0 +1,84 @@ +# The layout text of site + +# ----- Commons label ----- + +layout: + post: Entrada + category: Categoria + tag: Etiqueta + +# The tabs of sidebar +tabs: + # format: : + home: Inici + categories: Categories + tags: Etiquetes + archives: Arxiu + about: Sobre + +# the text displayed in the search bar & search results +search: + hint: Cercar + cancel: Cancel·lar + no_results: Ups! No s'han trobat resultats. + +panel: + lastmod: Actualitzat recentment + trending_tags: Etiquetes populars + toc: Taula de continguts + +copyright: + # Shown at the bottom of the post + license: + template: Aquesta entrada està llicenciada sota :LICENSE_NAME per l'autor. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: Alguns drets reservats. + verbose: >- + Excepte que s'indiqui explícitament, les entrades d'aquest blog estan llicenciades + sota la llicència Creative Commons Attribution 4.0 International (CC BY 4.0) per l'autor. + +meta: Fet amb :PLATFORM utilitzant el tema :THEME + +not_found: + statement: Ho sentim, hem perdut aquesta URL o apunta a alguna cosa que no existeix. + +notification: + update_found: Hi ha una nova versió de contingut disponible. + update: Actualitzar + +# ----- Posts related labels ----- + +post: + written_by: Per + posted: Publicat + updated: Actualitzat + words: paraules + pageview_measure: visites + read_time: + unit: min + prompt: " de lectura" + relate_posts: Entrades relacionades + share: Compartir + button: + next: Següent + previous: Anterior + copy_code: + succeed: Copiat! + share_link: + title: Copiar enllaç + succeed: Enllaç copiat! + +# Date time format. +# See: , +df: + post: + strftime: "%Y/%m/%d" + dayjs: "YYYY/MM/DD" + +# categories page +categories: + category_measure: categories + post_measure: entrades From 7708adbf30e6dea51a84311b86bc224739f656f6 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 16 Apr 2025 18:08:43 +0800 Subject: [PATCH 105/177] fix: recognize global theme mode (#2357) --- _javascript/modules/theme.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_javascript/modules/theme.js b/_javascript/modules/theme.js index f9ebf202..49e4e89b 100644 --- a/_javascript/modules/theme.js +++ b/_javascript/modules/theme.js @@ -39,7 +39,10 @@ class Theme { } static get #mode() { - return sessionStorage.getItem(this.#modeKey); + return ( + sessionStorage.getItem(this.#modeKey) || + document.documentElement.getAttribute(this.#modeAttr) + ); } static get #isDarkMode() { From c62644759cb4e0e07f7ee6eb9503ef69be62371b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 24 Apr 2025 14:23:43 +0200 Subject: [PATCH 106/177] fix(ui): fix incomplete border color on hover for tags (#2359) --- _sass/abstracts/_placeholders.scss | 3 +++ _sass/pages/_post.scss | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/_sass/abstracts/_placeholders.scss b/_sass/abstracts/_placeholders.scss index 9a2b8ac8..d8a10604 100644 --- a/_sass/abstracts/_placeholders.scss +++ b/_sass/abstracts/_placeholders.scss @@ -31,7 +31,10 @@ } %tag-hover { + @extend %link-color; + background: var(--tag-hover); + border-color: var(--tag-hover); transition: background 0.35s ease-in-out; } diff --git a/_sass/pages/_post.scss b/_sass/pages/_post.scss index 12a301f5..2cd3eee3 100644 --- a/_sass/pages/_post.scss +++ b/_sass/pages/_post.scss @@ -143,9 +143,7 @@ header { .post-tag { &:hover { - @extend %link-hover; @extend %tag-hover; - @extend %no-bottom-border; } } } From b48ea68bf7b98a093b8d7d513a1cc1f7729effc4 Mon Sep 17 00:00:00 2001 From: iSpeakNerd <96841384+iSpeakNerd@users.noreply.github.com> Date: Thu, 24 Apr 2025 05:25:46 -0700 Subject: [PATCH 107/177] chore: update `linkedin` sharing url (#2307) --- _data/share.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/share.yml b/_data/share.yml index 6f975680..edbc02b2 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -18,7 +18,7 @@ platforms: # # - type: Linkedin # icon: "fab fa-linkedin" - # link: "https://www.linkedin.com/sharing/share-offsite/?url=URL" + # link: "https://www.linkedin.com/feed/?shareActive=true&shareUrl=URL" # # - type: Weibo # icon: "fab fa-weibo" From 23d953c313b2ece9f2977266b2cce5ede66d12c2 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 3 May 2025 16:14:50 +0800 Subject: [PATCH 108/177] chore(deps): remove plugin `jekyll-redirect-from` Discussed in #2313 --- assets/404.html | 7 +------ jekyll-theme-chirpy.gemspec | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/assets/404.html b/assets/404.html index af89d6d1..cb129c06 100644 --- a/assets/404.html +++ b/assets/404.html @@ -2,13 +2,8 @@ layout: page title: "404: Page not found" permalink: /404.html - -redirect_from: - - /norobots/ - - /assets/ - - /posts/ --- {% include lang.html %} -

{{ site.data.locales[lang].not_found.statement }}

+

{{ site.data.locales[lang].not_found.statement }}

\ No newline at end of file diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index e3ad5d67..969e4d08 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -27,7 +27,6 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "jekyll", "~> 4.3" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" - spec.add_runtime_dependency "jekyll-redirect-from", "~> 0.16" spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.8" spec.add_runtime_dependency "jekyll-archives", "~> 2.2" spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4" From 9f38a2deadc4668ab9452360b70883b6aedeb0f6 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 3 May 2025 16:18:52 +0800 Subject: [PATCH 109/177] refactor: move the path of `theme.js` --- _javascript/{modules => }/theme.js | 0 rollup.config.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename _javascript/{modules => }/theme.js (100%) diff --git a/_javascript/modules/theme.js b/_javascript/theme.js similarity index 100% rename from _javascript/modules/theme.js rename to _javascript/theme.js diff --git a/rollup.config.js b/rollup.config.js index 0e8a6c74..d9322f83 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -80,7 +80,7 @@ export default [ build('page'), build('post'), build('misc'), - build('theme', { src: `${SRC_DEFAULT}/modules`, outputName: 'Theme' }), + build('theme', { outputName: 'Theme' }), build('app', { src: SRC_PWA, jekyll: true }), build('sw', { src: SRC_PWA, jekyll: true }) ]; From 61ae6cced8e9ea412ff6f4c2cc3ba5ec7bc001a5 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 5 May 2025 11:14:07 +0800 Subject: [PATCH 110/177] chore(dev-deps): add eslint config file --- _config.yml | 2 +- eslint.config.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 eslint.config.js diff --git a/_config.yml b/_config.yml index d6f84c57..0a78679d 100644 --- a/_config.yml +++ b/_config.yml @@ -213,7 +213,7 @@ exclude: - README.md - LICENSE - purgecss.js - - rollup.config.js + - "*.config.js" - "package*.json" jekyll-archives: diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..c8f6d53d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,5 @@ +export default [ + { + files: ['_javascript/**/*.js'] + } +]; From ada38aad969efdbe311ffcf6e933bf5ef17773f8 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 5 May 2025 11:15:08 +0800 Subject: [PATCH 111/177] chore: avoid auto-formatting liquid and sass mixed code --- assets/css/jekyll-theme-chirpy.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/css/jekyll-theme-chirpy.scss b/assets/css/jekyll-theme-chirpy.scss index 7ff89bf7..ff1f01c0 100644 --- a/assets/css/jekyll-theme-chirpy.scss +++ b/assets/css/jekyll-theme-chirpy.scss @@ -1,6 +1,7 @@ --- --- +/* prettier-ignore */ @use 'main {%- if jekyll.environment == 'production' -%} .bundle From 401e2af0f8a173d8437e03027c7aff558e8c0bde Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 5 May 2025 11:55:48 +0800 Subject: [PATCH 112/177] fix: avoid `mathjax` loading failure on page refresh (#2389) --- _includes/js-selector.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/js-selector.html b/_includes/js-selector.html index fd4acca8..5a80532f 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -66,7 +66,7 @@ {% if page.math %} - + {% endif %} From d0f8f9553e41536eb84ae2fdd3f3bc9d13f7ef8c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 11 May 2025 22:19:18 +0800 Subject: [PATCH 113/177] fix: improve accuracy of moving `img` element classes (#2399) --- _includes/refactor-content.html | 44 ++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/_includes/refactor-content.html b/_includes/refactor-content.html index 8d298cde..4586f5c4 100644 --- a/_includes/refactor-content.html +++ b/_includes/refactor-content.html @@ -88,9 +88,41 @@ {% endfor %} + {% assign _wrapper_class = '' %} + {% if _class %} - {% capture _old_class %}class="{{ _class }}"{% endcapture %} - {% assign _left = _left | remove: _old_class %} + {% assign _remain = _class %} + {% assign _class_array = _class | split: ' ' %} + + {% for c in _class_array %} + {% assign _pick = false %} + + {% case c %} + {% when 'preview-img', 'normal', 'left', 'right', 'light', 'dark' %} + {% assign _pick = true %} + {% else %} + {% if c contains '-' %} + {% assign start = c | split: '-' | first %} + {% if start == 'w' %} + {% assign _pick = true %} + {% endif %} + {% endif %} + {% endcase %} + + {% if _pick %} + {% assign _remain = _remain | remove: c | strip %} + {% assign _wrapper_class = _wrapper_class | append: ' ' | append: c %} + {% endif %} + {% endfor %} + + {% unless _wrapper_class == '' %} + {% capture _old_class %}class="{{ _class }}"{% endcapture %} + {% assign _left = _left | remove: _old_class %} + {% unless _remain == '' %} + {% capture _new_class %}class="{{ _remain }}"{% endcapture %} + {% assign _left = _left | append: _new_class %} + {% endunless %} + {% endunless %} {% endif %} {% assign _final_src = null %} @@ -110,7 +142,7 @@ {% if _lqip %} {% assign _lazyload = false %} - {% assign _class = _class | append: ' blur' %} + {% assign _wrapper_class = _wrapper_class | append: ' blur' %} {% unless _lqip contains 'data:' %} {% assign _lqip_alt = 'lqip="' | append: _path_prefix %} @@ -121,7 +153,7 @@ {% assign _left = _left | replace: 'src=', 'data-src=' | replace: ' lqip=', ' data-lqip="true" src=' %} {% else %} - {% assign _class = _class | append: ' shimmer' %} + {% assign _wrapper_class = _wrapper_class | append: ' shimmer' %} {% endif %} @@ -153,8 +185,8 @@ {% assign _wrapper_start = _final_src | default: _src | prepend: '' %} From 519e4f193a1e7163827e2b4b63a65a31c14064f7 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 18 May 2025 21:14:56 +0800 Subject: [PATCH 114/177] chore: upgrade dependencies to the latest version (#2409) --- _includes/head.html | 2 +- assets/lib | 2 +- package.json | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/_includes/head.html b/_includes/head.html index 4514666a..e24384d5 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -70,7 +70,7 @@ {% unless jekyll.environment == 'production' %} - + {% endunless %} diff --git a/assets/lib b/assets/lib index b9e18a15..02f4ada6 160000 --- a/assets/lib +++ b/assets/lib @@ -1 +1 @@ -Subproject commit b9e18a1510e3be5de250ed34205da318b76474e0 +Subproject commit 02f4ada65dc75197654c3265a37a6f5fbc39f17c diff --git a/package.json b/package.json index 3fc089c2..8e2232c0 100644 --- a/package.json +++ b/package.json @@ -25,29 +25,29 @@ }, "dependencies": { "@popperjs/core": "^2.11.8", - "bootstrap": "^5.3.3" + "bootstrap": "^5.3.6" }, "devDependencies": { - "@babel/core": "^7.26.0", - "@babel/plugin-transform-class-properties": "^7.25.9", - "@babel/plugin-transform-private-methods": "^7.25.9", - "@babel/preset-env": "^7.26.0", - "@commitlint/cli": "^19.6.0", - "@commitlint/config-conventional": "^19.6.0", + "@babel/core": "^7.27.1", + "@babel/plugin-transform-class-properties": "^7.27.1", + "@babel/plugin-transform-private-methods": "^7.27.1", + "@babel/preset-env": "^7.27.2", + "@commitlint/cli": "^19.8.1", + "@commitlint/config-conventional": "^19.8.1", "@rollup/plugin-babel": "^6.0.4", - "@rollup/plugin-node-resolve": "^15.3.0", + "@rollup/plugin-node-resolve": "^16.0.1", "@rollup/plugin-terser": "^0.4.4", "@semantic-release/changelog": "^6.0.3", - "@semantic-release/exec": "^6.0.3", + "@semantic-release/exec": "^7.1.0", "@semantic-release/git": "^10.0.1", - "concurrently": "^9.1.0", + "concurrently": "^9.1.2", "conventional-changelog-conventionalcommits": "^8.0.0", "husky": "^9.1.7", "purgecss": "^7.0.2", - "rollup": "^4.27.4", - "semantic-release": "^24.2.0", - "stylelint": "^16.10.0", - "stylelint-config-standard-scss": "^13.1.0" + "rollup": "^4.41.0", + "semantic-release": "^24.2.4", + "stylelint": "^16.19.1", + "stylelint-config-standard-scss": "^15.0.1" }, "prettier": { "trailingComma": "none" From 53770e4923be1b0c16ad6c9f7b62def297ecff52 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 18 May 2025 13:17:30 +0000 Subject: [PATCH 115/177] chore(release): 7.3.0 ## [7.3.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.2.4...v7.3.0) (2025-05-18) ### Features * **i18n:** add Catalan Spanish locale translation ([#2349](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2349)) ([167c98c](https://github.com/cotes2020/jekyll-theme-chirpy/commit/167c98c781d0607c90ede8fc73eb43dffeea6abd)) * **i18n:** add Dutch locale ([#2076](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2076)) ([981ddba](https://github.com/cotes2020/jekyll-theme-chirpy/commit/981ddba30e57934f9056b8d468f0d17db131e1e8)) * **i18n:** add Japanese locale ([#2295](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2295)) ([571c90f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/571c90f13011eb91d0e1392218f3953060b920c9)) * **i18n:** add persian language ([#2238](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2238)) ([7d4d35c](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7d4d35cd10109e78d60fbb6b25a9b205f780ad63)) ### Bug Fixes * avoid `mathjax` loading failure on page refresh ([#2389](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2389)) ([401e2af](https://github.com/cotes2020/jekyll-theme-chirpy/commit/401e2af0f8a173d8437e03027c7aff558e8c0bde)) * improve accuracy of moving `img` element classes ([#2399](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2399)) ([d0f8f95](https://github.com/cotes2020/jekyll-theme-chirpy/commit/d0f8f9553e41536eb84ae2fdd3f3bc9d13f7ef8c)) * prevent the search bar from moving when focused ([#2336](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2336)) ([f744929](https://github.com/cotes2020/jekyll-theme-chirpy/commit/f7449299e88c71da2104f0007f2db23a8fa798be)) * recognize global theme mode ([#2357](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2357)) ([7708adb](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7708adbf30e6dea51a84311b86bc224739f656f6)) * **search:** avoid missing spaces between paragraphs in search results ([#2199](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2199)) ([0eb7efa](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0eb7efa7f53508bf6b48eb9d773d5c5047c3c525)) * **ui:** fix incomplete border color on hover for tags ([#2359](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2359)) ([c626447](https://github.com/cotes2020/jekyll-theme-chirpy/commit/c62644759cb4e0e07f7ee6eb9503ef69be62371b)) ### Improvements * **seo:** improve accessibility and aligns with best practices ([#2289](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2289)) ([54d4d59](https://github.com/cotes2020/jekyll-theme-chirpy/commit/54d4d59d22ac543a14bfbd9bb3d6fb6756056041)) --- docs/CHANGELOG.md | 22 ++++++++++++++++++++++ jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0cfa89bf..24afe667 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [7.3.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.2.4...v7.3.0) (2025-05-18) + +### Features + +* **i18n:** add Catalan Spanish locale translation ([#2349](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2349)) ([167c98c](https://github.com/cotes2020/jekyll-theme-chirpy/commit/167c98c781d0607c90ede8fc73eb43dffeea6abd)) +* **i18n:** add Dutch locale ([#2076](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2076)) ([981ddba](https://github.com/cotes2020/jekyll-theme-chirpy/commit/981ddba30e57934f9056b8d468f0d17db131e1e8)) +* **i18n:** add Japanese locale ([#2295](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2295)) ([571c90f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/571c90f13011eb91d0e1392218f3953060b920c9)) +* **i18n:** add persian language ([#2238](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2238)) ([7d4d35c](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7d4d35cd10109e78d60fbb6b25a9b205f780ad63)) + +### Bug Fixes + +* avoid `mathjax` loading failure on page refresh ([#2389](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2389)) ([401e2af](https://github.com/cotes2020/jekyll-theme-chirpy/commit/401e2af0f8a173d8437e03027c7aff558e8c0bde)) +* improve accuracy of moving `img` element classes ([#2399](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2399)) ([d0f8f95](https://github.com/cotes2020/jekyll-theme-chirpy/commit/d0f8f9553e41536eb84ae2fdd3f3bc9d13f7ef8c)) +* prevent the search bar from moving when focused ([#2336](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2336)) ([f744929](https://github.com/cotes2020/jekyll-theme-chirpy/commit/f7449299e88c71da2104f0007f2db23a8fa798be)) +* recognize global theme mode ([#2357](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2357)) ([7708adb](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7708adbf30e6dea51a84311b86bc224739f656f6)) +* **search:** avoid missing spaces between paragraphs in search results ([#2199](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2199)) ([0eb7efa](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0eb7efa7f53508bf6b48eb9d773d5c5047c3c525)) +* **ui:** fix incomplete border color on hover for tags ([#2359](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2359)) ([c626447](https://github.com/cotes2020/jekyll-theme-chirpy/commit/c62644759cb4e0e07f7ee6eb9503ef69be62371b)) + +### Improvements + +* **seo:** improve accessibility and aligns with best practices ([#2289](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2289)) ([54d4d59](https://github.com/cotes2020/jekyll-theme-chirpy/commit/54d4d59d22ac543a14bfbd9bb3d6fb6756056041)) + ## [7.2.4](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.2.3...v7.2.4) (2024-12-21) ### Bug Fixes diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 969e4d08..07d64e43 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-theme-chirpy" - spec.version = "7.2.4" + spec.version = "7.3.0" spec.authors = ["Cotes Chung"] spec.email = ["cotes.chung@gmail.com"] diff --git a/package.json b/package.json index 8e2232c0..6f2cfb0c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jekyll-theme-chirpy", - "version": "7.2.4", + "version": "7.3.0", "description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.", "repository": { "type": "git", From f5802b8a8a4fb94cd51a484e438f6ba2ba8d62c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20Sk=C3=B8dt=20Holmgaard?= <24588044+Nicolai9852@users.noreply.github.com> Date: Wed, 21 May 2025 19:03:29 +0200 Subject: [PATCH 116/177] feat(i18n): add Danish locale (#2410) --- _data/locales/da-DK.yml | 86 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 _data/locales/da-DK.yml diff --git a/_data/locales/da-DK.yml b/_data/locales/da-DK.yml new file mode 100644 index 00000000..4b41fb38 --- /dev/null +++ b/_data/locales/da-DK.yml @@ -0,0 +1,86 @@ +# The layout text of site + +# ----- Commons label ----- + +layout: + post: Opslag + category: Kategori + tag: Tag + +# The tabs of sidebar +tabs: + # format: : + home: Hjem + categories: Kategorier + tags: Tags + archives: Arkiv + about: Om siden + +# the text displayed in the search bar & search results +search: + hint: søg + cancel: Afbryd + no_results: Ups! Ingen resultater fundet. + +panel: + lastmod: Senest opdateret + trending_tags: Populære tags + toc: Indhold + +copyright: + # Shown at the bottom of the post + license: + template: Dette opslag er licenseret under :LICENSE_NAME af forfatteren. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: Nogle rettigheder forbeholdes. + verbose: >- + Medmindre andet er angivet, er opslag på denne side beskyttet + under Creative Commons Attribution 4.0 International (CC BY 4.0) licensen af forfatteren. + +# meta: Using the :THEME theme for :PLATFORM. + +not_found: + statement: Beklager, vi har malpaceret denne URL, eller den peger på et sted, som ikke findes. + +notification: + update_found: En ny version af indholdet er fundet! + update: Opdater + +# ----- Posts related labels ----- + +post: + written_by: Af + posted: Udgivet + updated: Opdateret + words: ord + pageview_measure: visninger + read_time: + unit: min + prompt: læsetid + relate_posts: Læs videre + share: Del + button: + next: Nyere + previous: Ældre + copy_code: + succeed: Kopieret! + share_link: + title: Kopier link + succeed: Link kopieret! + +# Date time format. +# See: , +df: + post: + strftime: "%Y/%m/%d" + dayjs: "YYYY/MM/DD" + +# categories page +categories: + category_measure: + singular: kategori + plural: kategorier + post_measure: opslag From 18c48b4c49f896eeeeb52a8de1dca715add70c6a Mon Sep 17 00:00:00 2001 From: Zakaria Fatahi Date: Wed, 21 May 2025 19:06:12 +0200 Subject: [PATCH 117/177] feat(i18n): add locale files for some rtl languages (#2415) --- "_data/locales/dv\342\200\221MV.yml" | 90 ++++++++++++++++++++++++ _data/locales/{fa-IR.yaml => fa-IR.yml} | 16 ++--- _data/locales/ku-IQ.yml | 91 +++++++++++++++++++++++++ "_data/locales/ps\342\200\221AF.yml" | 90 ++++++++++++++++++++++++ _data/locales/ur-PK.yml | 90 ++++++++++++++++++++++++ 5 files changed, 369 insertions(+), 8 deletions(-) create mode 100644 "_data/locales/dv\342\200\221MV.yml" rename _data/locales/{fa-IR.yaml => fa-IR.yml} (85%) create mode 100644 _data/locales/ku-IQ.yml create mode 100644 "_data/locales/ps\342\200\221AF.yml" create mode 100644 _data/locales/ur-PK.yml diff --git "a/_data/locales/dv\342\200\221MV.yml" "b/_data/locales/dv\342\200\221MV.yml" new file mode 100644 index 00000000..680ca1f8 --- /dev/null +++ "b/_data/locales/dv\342\200\221MV.yml" @@ -0,0 +1,90 @@ +# The layout text of site in Dhivehi (Maldives) + +# ----- Commons label ----- + +layout: + post: ޕޯސްޓް + category: ނަތީޖާ + tag: ޓެގް + +# The tabs of sidebar +tabs: + # format: : + home: ހުންނަ + categories: ނަތީޖާތައް + tags: ޓެގްތައް + archives: އާރޗިވްސް + about: އިންސާން + +# the text displayed in the search bar & search results +search: + hint: ސާރޗް + cancel: ކެންސަލް + no_results: އޮޕްސް! އެއްވެސް ނުފެނުނީ. + +panel: + lastmod: އާދަމާ އޮޕްޑޭޓްކުރި + trending_tags: މަރާހު ޓެގްތައް + toc: ކޮންޓެންސް + +copyright: + # Shown at the bottom of the post + license: + template: މި ޕޯސްޓް :LICENSE_NAME އިން ލައިސަންސްކުރާ ނުވަތަ މުޤައްރާއަށް. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: އެކީ ބާރަށް ހުށަހަޅާ. + verbose: >- + އަދި އެ ރަނގަޅުގައި ނުލާހެވެސް، މި ސައިޓުގެ ޕޯސްޓްތައް + މުޤައްރާއަށް Creative Commons Attribution 4.0 International (CC BY 4.0) ލައިސަންސްކުރަނީ. + +meta: :PLATFORM އަށް :THEME ތީމް ބަލާލާށެވެ. + +not_found: + statement: ސޯރީ، މި ޔޫ.އާރއެލް މަށެވެއްނެ ނުވަތަ އެކަމެއް ނުވެއެވެ. + +notification: + update_found: ޔޫ ވާރޝަން ހުރިހާ. + update: އޮޕްޑޭޓް + +# ----- Posts related labels ----- + +post: + written_by: ލެކްއޯލް + posted: ޕޯސްޓްކުރެވި + updated: އޮޕްޑޭޓްކުރެވި + words: ބަސް + pageview_measure: ބަނޑުކުރާ + read_time: + unit: މިނެޓް + prompt: އިސްކާރު + relate_posts: އެއްޗެހި ފަހުރަށްދަން + share: ސެއާރް + button: + next: އަދާވަނަ + previous: ކޮނޯނި + copy_code: + succeed: ކޮޕީ ކުރެވި! + share_link: + title: ލިންކް ކޮޕީ ކުރު + succeed: ލިންކް ހަދަންކުރެވި! + +# Date time format. +# See: , +df: + post: + strftime: "%b %e, %Y" + dayjs: "ll" + archives: + strftime: "%b" + dayjs: "MMM" + +categories: + category_measure: + singular: ނަތީޖާ + plural: ނަތީޖާތައް + post_measure: + singular: ޕޯސްޓް + plural: ޕޯސްޓްތައް diff --git a/_data/locales/fa-IR.yaml b/_data/locales/fa-IR.yml similarity index 85% rename from _data/locales/fa-IR.yaml rename to _data/locales/fa-IR.yml index d5c6e0eb..7a33deb1 100644 --- a/_data/locales/fa-IR.yaml +++ b/_data/locales/fa-IR.yml @@ -37,10 +37,10 @@ copyright: # Displayed in the footer brief: برخی حقوق محفوظ است. verbose: >- - مگر اینکه خلاف آن ذکر شده باشد، پست‌های وبلاگ در این سایت + به‌جز مواردی که خلاف آن ذکر شده باشد، محتوای پست‌های این وبلاگ تحت مجوز Creative Commons Attribution 4.0 International (CC BY 4.0) توسط نویسنده منتشر شده‌اند. -meta: با استفاده از :PLATFORM قالب :THEME +meta: با استفاده از قالب :THEME برای :PLATFORM not_found: statement: متأسفیم، لینک زیر معتبر نیست یا به صفحه‌ای که وجود ندارد اشاره می‌کند. @@ -55,11 +55,11 @@ post: written_by: نوشته شده توسط posted: منتشر شده updated: به‌روزرسانی شده - words: کلمات - pageview_measure: بازدیدها + words: کلمه + pageview_measure: بازدید read_time: - unit: دقیقه - prompt: زمان مطالعه + unit: "دقیقه " + prompt: " زمان مطالعه" relate_posts: بیشتر بخوانید share: اشتراک‌گذاری button: @@ -85,7 +85,7 @@ df: categories: category_measure: singular: دسته‌بندی - plural: دسته‌بندی‌ها + plural: دسته‌بندی‌ post_measure: singular: پست - plural: پست‌ها + plural: پست‌ diff --git a/_data/locales/ku-IQ.yml b/_data/locales/ku-IQ.yml new file mode 100644 index 00000000..bcc53565 --- /dev/null +++ b/_data/locales/ku-IQ.yml @@ -0,0 +1,91 @@ +# The layout text of site in Kurdish (Sorani) + +# ----- Commons label ----- + +layout: + post: بابەت + category: هاوپۆل + tag: تاگ + +# The tabs of sidebar +tabs: + # format: : + home: سەرەکی + categories: هاوپۆلەکان + tags: تاگەکان + archives: ئەرشیف + about: دەربارە + +# the text displayed in the search bar & search results +search: + hint: گەڕان + cancel: هەڵوەشاندنەوە + no_results: ببوورە! هیچ ئەنجامێک نەدۆزرایەوە. + +panel: + lastmod: دوایین نوێکردنەوەکان + trending_tags: تاگە باوەکان + toc: ناوەڕۆک + +copyright: + # Shown at the bottom of the post + license: + template: ئەم بابەتە لەلایەن نووسەرەوە بە مۆڵەتی :LICENSE_NAME بڵاوکراوەتەوە. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: هەندێک مافی پارێزراوە. + verbose: >- + تەنها لەو شوێنانەی کە بە پێچەوانەوە ئاماژەی پێدراوە، بابەتەکانی بڵۆگ لەم سایتەدا + لەژێر مۆڵەتی Creative Commons Attribution 4.0 International (CC BY 4.0) لەلایەن نووسەرەوە مۆڵەتیان پێدراوە. + +meta: بە بەکارهێنانی :PLATFORM لەگەڵ ڕووکاری :THEME + +not_found: + statement: ببوورە، ئەم بەستەرە نادۆزرێتەوە یان ئاماژە بە شتێک دەکات کە بوونی نییە. + +notification: + update_found: وەشانێکی نوێی ناوەڕۆک بەردەستە. + update: نوێکردنەوە + +# ----- Posts related labels ----- + +post: + written_by: نووسەر + posted: بڵاوکراوەتەوە + updated: نوێکراوەتەوە + words: وشە + pageview_measure: بینین + read_time: + unit: خولەک + prompt: خوێندنەوە + relate_posts: بابەتی پەیوەندیدار + share: بڵاوکردنەوە + button: + next: نوێتر + previous: کۆنتر + copy_code: + succeed: کۆپی کرا! + share_link: + title: کۆپی بەستەر + succeed: بەستەر بە سەرکەوتوویی کۆپی کرا! + +# Date time format. +# See: , +df: + post: + strftime: "%d %b, %Y" + dayjs: "DD MMM, YYYY" + archives: + strftime: "%b" + dayjs: "MMM" + +# categories page +categories: + category_measure: + singular: هاوپۆل + plural: هاوپۆل + post_measure: + singular: بابەت + plural: بابەت diff --git "a/_data/locales/ps\342\200\221AF.yml" "b/_data/locales/ps\342\200\221AF.yml" new file mode 100644 index 00000000..fca68772 --- /dev/null +++ "b/_data/locales/ps\342\200\221AF.yml" @@ -0,0 +1,90 @@ +# The layout text of site in Pashto (Afghanistan) + +# ----- Commons label ----- + +layout: + post: لیکنه + category: وېشنيزه + tag: ټګ + +# The tabs of sidebar +tabs: + # format: : + home: کورپاڼه + categories: وېشنيزې + tags: ټګونه + archives: آرشيف + about: په اړه + +# the text displayed in the search bar & search results +search: + hint: لټون + cancel: لغوه + no_results: ها! هېڅ پایله ونه موندل شوه. + +panel: + lastmod: وروستی تازه + trending_tags: مشهور ټګونه + toc: منځپانګه + +copyright: + # Shown at the bottom of the post + license: + template: دا لیکنه د :LICENSE_NAME جواز لاندې د لیکوال له خوا خپره شوې ده. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: ځینې حقونه خوندي دي. + verbose: >- + تر هغه ځایه چې بل ډول نه وي یاد شوي، د دې سایټ لیکنې + د لیکوال له خوا د کریټېو کامنز د انتساب 4.0 نړیوال (CC BY 4.0) جواز لاندې خپرېږي. + +meta: د :PLATFORM لپاره د :THEME موضوع کاروي. + +not_found: + statement: بښنه غواړو، دغه URL ناسم دی یا هغه څه ته اشاره کوي چې شتون نه لري. + +notification: + update_found: نوې نسخه شتون لري. + update: تازه + +# ----- Posts related labels ----- + +post: + written_by: لیکوال + posted: خپره شوې + updated: تازه شوې + words: کلمې + pageview_measure: کتنې + read_time: + unit: دقیقې + prompt: لوستل + relate_posts: نوره لوستنه + share: شریکول + button: + next: نوی + previous: زوړ + copy_code: + succeed: کاپي شو! + share_link: + title: لینک کاپي کړئ + succeed: لینک بریالي کاپي شو! + +# Date time format. +# See: , +df: + post: + strftime: "%b %e, %Y" + dayjs: "ll" + archives: + strftime: "%b" + dayjs: "MMM" + +categories: + category_measure: + singular: وېشنيزه + plural: وېشنيزې + post_measure: + singular: لیکنه + plural: لیکنې diff --git a/_data/locales/ur-PK.yml b/_data/locales/ur-PK.yml new file mode 100644 index 00000000..e5184df1 --- /dev/null +++ b/_data/locales/ur-PK.yml @@ -0,0 +1,90 @@ +# The layout text of site in Urdu (Pakistan) + +# ----- Commons label ----- + +layout: + post: تحریر + category: زمرہ + tag: ٹیگ + +# The tabs of sidebar +tabs: + # format: : + home: گھر + categories: زمروں + tags: ٹیگز + archives: محفوظات + about: تعارف + +# the text displayed in the search bar & search results +search: + hint: تلاش + cancel: منسوخ + no_results: اوہ! کوئی نتیجہ نہیں ملا۔ + +panel: + lastmod: حال ہی میں اپ ڈیٹ + trending_tags: مقبول ٹیگز + toc: مواد + +copyright: + # Shown at the bottom of the post + license: + template: یہ تحریر :LICENSE_NAME کے تحت مصنف کی جانب سے لائسنس یافتہ ہے۔ + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: کچھ حقوق محفوظ ہیں۔ + verbose: >- + جب تک کہ دوسری صورت میں ذکر نہ ہو، اس سائٹ کی تحریریں + مصنف کی جانب سے تخلیقی العام انتساب 4.0 بین الاقوامی (CC BY 4.0) لائسنس کے تحت دستیاب ہیں۔ + +meta: :PLATFORM کے لیے :THEME تھیم استعمال کیا جا رہا ہے۔ + +not_found: + statement: معذرت، یہ URL غلط ہے یا جس چیز کی طرف اشارہ کر رہا ہے وہ موجود نہیں۔ + +notification: + update_found: نیا مواد دستیاب ہے۔ + update: اپ ڈیٹ + +# ----- Posts related labels ----- + +post: + written_by: از + posted: شائع شدہ + updated: اپ ڈیٹ شدہ + words: لفظ + pageview_measure: مشاہدات + read_time: + unit: منٹ + prompt: پڑھیں + relate_posts: مزید مطالعہ + share: شیئر + button: + next: نیا + previous: پرانا + copy_code: + succeed: کاپی ہو گیا! + share_link: + title: لنک کاپی کریں + succeed: لنک کامیابی سے کاپی ہو گیا! + +# Date time format. +# See: , +df: + post: + strftime: "%b %e, %Y" + dayjs: "ll" + archives: + strftime: "%b" + dayjs: "MMM" + +categories: + category_measure: + singular: زمرہ + plural: زمروں + post_measure: + singular: تحریر + plural: تحریریں From c706799f9b2e724dee9a3b891dea72dfa587929e Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Sun, 1 Jun 2025 00:51:43 +0400 Subject: [PATCH 118/177] fix: correct GoatCounter pageviews extraction (#2420) --- _includes/pageviews/goatcounter.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/pageviews/goatcounter.html b/_includes/pageviews/goatcounter.html index 265b2243..9cd1281e 100644 --- a/_includes/pageviews/goatcounter.html +++ b/_includes/pageviews/goatcounter.html @@ -10,7 +10,7 @@ fetch(url) .then((response) => response.json()) .then((data) => { - const count = data.count.replace(/\s/g, ''); + const count = data.count.replace(/\D/g, ''); pv.innerText = new Intl.NumberFormat().format(count); }) .catch((error) => { From 1bac96a8e1ae23a7a48f2b7d249bfbfd5d9bfe50 Mon Sep 17 00:00:00 2001 From: Josh Wickham Date: Fri, 27 Jun 2025 08:58:10 -0700 Subject: [PATCH 119/177] fix: resolve discrepancy in lqip between post and main page (#2453) --- _layouts/home.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/_layouts/home.html b/_layouts/home.html index 451e391c..66a12012 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -55,16 +55,15 @@ {% if post.image %} {% assign src = post.image.path | default: post.image %} - {% unless src contains '//' %} - {% assign src = post.media_subpath | append: '/' | append: src | replace: '//', '/' %} - {% endunless %} + {% capture src %}{% include media-url.html src=src subpath=post.media_subpath %}{% endcapture %} {% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %} {% assign lqip = null %} {% if post.image.lqip %} - {% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %} + {% capture lqip_url %}{% include media-url.html src=post.image.lqip subpath=post.media_subpath %}{% endcapture %} + {% assign lqip = 'lqip="' | append: lqip_url | append: '"' %} {% endif %}
From 7615d72e9300a1514ef2fc8ec941ab2974ba7eb4 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 26 Jul 2025 20:22:30 +0800 Subject: [PATCH 120/177] fix: escape special JSON characters in search results (#2481) Also restore full-text search --- _includes/post-description.html | 37 +++++++++++++++++++-------------- assets/js/data/search.json | 7 ++----- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/_includes/post-description.html b/_includes/post-description.html index c00e5165..48bb03b7 100644 --- a/_includes/post-description.html +++ b/_includes/post-description.html @@ -2,24 +2,29 @@ Get post description or generate it from the post content. {%- endcomment -%} -{%- assign max_length = include.max_length | default: 200 -%} - {%- capture description -%} -{%- if post.description -%} - {{- post.description -}} -{%- else -%} - {% comment %} - Remove the line number of the code snippet. - {% endcomment %} - {% assign content = post.content %} + {%- if post.description -%} + {{- post.description -}} + {%- else -%} + {% comment %} + Remove the line number of the code snippet. + {% endcomment %} + {%- assign content = post.content -%} - {% if content contains '
' %}
-    {% assign content = content | replace: '
', '' %}
-  {% endif %}
+    {%- if content contains '
' -%}
+      {%- assign content = content | replace: '
', '' -%}
+    {%- endif -%}
 
-  {{- content | markdownify | strip_html | newline_to_br | replace: '
', ' ' | strip_newlines -}} -{%- endif -%} + {{- content | strip_html | newline_to_br | replace: '
', ' ' | strip_newlines -}} + {%- endif -%} {%- endcapture -%} -{{- description | strip | truncate: max_length | escape -}} +{%- if include.json -%} + {%- assign description = description | jsonify -%} +{%- else -%} + {%- assign max_length = include.max_length | default: 200 -%} + {%- assign description = description | strip | truncate: max_length -%} +{%- endif -%} + +{{- description -}} diff --git a/assets/js/data/search.json b/assets/js/data/search.json index 32bcff9b..5003e518 100644 --- a/assets/js/data/search.json +++ b/assets/js/data/search.json @@ -5,16 +5,13 @@ swcache: true [ {% for post in site.posts %} - {%- capture description -%} - {% include post-description.html %} - {%- endcapture -%} { "title": {{ post.title | jsonify }}, "url": {{ post.url | relative_url | jsonify }}, "categories": {{ post.categories | join: ', ' | jsonify }}, "tags": {{ post.tags | join: ', ' | jsonify }}, - "date": "{{ post.date }}", - "content": "{{ description }}" + "date": {{ post.date | jsonify }}, + "content": {% include post-description.html json=true %} }{% unless forloop.last %},{% endunless %} {% endfor %} ] From c0e47562001026319ee2740594e0344ce36c222e Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 26 Jul 2025 12:24:47 +0000 Subject: [PATCH 121/177] chore(release): 7.3.1 ## [7.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.3.0...v7.3.1) (2025-07-26) ### Bug Fixes * escape special JSON characters in search results ([#2481](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2481)) ([7615d72](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7615d72e9300a1514ef2fc8ec941ab2974ba7eb4)) --- docs/CHANGELOG.md | 6 ++++++ jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 24afe667..b9a41727 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [7.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.3.0...v7.3.1) (2025-07-26) + +### Bug Fixes + +* escape special JSON characters in search results ([#2481](https://github.com/cotes2020/jekyll-theme-chirpy/issues/2481)) ([7615d72](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7615d72e9300a1514ef2fc8ec941ab2974ba7eb4)) + ## [7.3.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.2.4...v7.3.0) (2025-05-18) ### Features diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 07d64e43..a4d3679b 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-theme-chirpy" - spec.version = "7.3.0" + spec.version = "7.3.1" spec.authors = ["Cotes Chung"] spec.email = ["cotes.chung@gmail.com"] diff --git a/package.json b/package.json index 6f2cfb0c..ceed0287 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jekyll-theme-chirpy", - "version": "7.3.0", + "version": "7.3.1", "description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.", "repository": { "type": "git", From 49519d13e53f584186c16cc9ce4ecf870a4344de Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 26 Jul 2025 20:49:56 +0800 Subject: [PATCH 122/177] chore: complete ESLint v9 configuration --- eslint.config.js | 36 +++++++++++++++++++++++++++++++++--- package.json | 6 +++++- purgecss.js | 5 +++-- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index c8f6d53d..b8073b6d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,5 +1,35 @@ -export default [ +import { defineConfig, globalIgnores } from 'eslint/config'; +import js from '@eslint/js'; +import globals from 'globals'; + +export default defineConfig([ + globalIgnores(['assets/*', 'node_modules/*', '_site/*']), + js.configs.recommended, { - files: ['_javascript/**/*.js'] + rules: { + semi: ['error', 'always'], + quotes: ['error', 'single'] + }, + languageOptions: { + globals: { + ...globals.browser, + ...globals.node + } + } + }, + { + files: ['_javascript/**/*.js'], + languageOptions: { + globals: { + ClipboardJS: 'readonly', + GLightbox: 'readonly', + Theme: 'readonly', + dayjs: 'readonly', + mermaid: 'readonly', + tocbot: 'readonly', + importScripts: 'readonly', + swconf: 'readonly' + } + } } -]; +]); diff --git a/package.json b/package.json index ceed0287..bb712a6b 100644 --- a/package.json +++ b/package.json @@ -13,14 +13,16 @@ "url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues" }, "homepage": "https://github.com/cotes2020/jekyll-theme-chirpy/", + "type": "module", "scripts": { "build": "concurrently npm:build:*", "build:css": "node purgecss.js", "build:js": "rollup -c --bundleConfigAsCjs --environment BUILD:production", "watch:js": "rollup -c --bundleConfigAsCjs -w", + "lint:js": "eslint", "lint:scss": "stylelint _sass/**/*.scss", "lint:fix:scss": "npm run lint:scss -- --fix", - "test": "npm run lint:scss", + "test": "npm run lint:js && npm run lint:scss", "prepare": "husky" }, "dependencies": { @@ -42,6 +44,8 @@ "@semantic-release/git": "^10.0.1", "concurrently": "^9.1.2", "conventional-changelog-conventionalcommits": "^8.0.0", + "eslint": "^9.27.0", + "globals": "^16.1.0", "husky": "^9.1.7", "purgecss": "^7.0.2", "rollup": "^4.41.0", diff --git a/purgecss.js b/purgecss.js index ad42db29..2380f6f7 100644 --- a/purgecss.js +++ b/purgecss.js @@ -1,5 +1,6 @@ -const fs = require('fs').promises; -const { PurgeCSS } = require('purgecss'); +import { promises as fs } from 'fs'; +import { PurgeCSS } from 'purgecss'; + const DIST_PATH = '_sass/vendors'; const output = `${DIST_PATH}/_bootstrap.scss`; From b855e8b6b470e8321b3d82fecd33e8b355bdca73 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:55:54 +0800 Subject: [PATCH 123/177] style: unify quote style in rollup config --- rollup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index d9322f83..42e205e0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -11,7 +11,7 @@ const DIST = 'assets/js/dist'; const banner = `/*! * ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage} */`; -const frontmatter = `---\npermalink: /:basename\n---\n`; +const frontmatter = '---\npermalink: /:basename\n---\n'; const isProd = process.env.BUILD === 'production'; let hasWatched = false; From 648398c63cfb6fe1cc139cbfbfc58a726ae00c9c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 27 Jul 2025 01:11:55 +0800 Subject: [PATCH 124/177] ci: migrate eslint and stylelint from codacy to gh-actions --- .github/workflows/lint-js.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/lint-scss.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/lint-js.yml create mode 100644 .github/workflows/lint-scss.yml diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml new file mode 100644 index 00000000..1e192348 --- /dev/null +++ b/.github/workflows/lint-js.yml @@ -0,0 +1,30 @@ +name: Lint JS + +on: + push: + paths: + - "_javascript/**/*.js" + - ".github/workflows/scripts/**/*.js" + - "*.js" + pull_request: + paths: + - "_javascript/**/*.js" + - ".github/workflows/scripts/*.js" + - "*.js" + +jobs: + lint-js: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install Dependencies + run: npm i + + - name: Lint JS + run: npm run lint:js diff --git a/.github/workflows/lint-scss.yml b/.github/workflows/lint-scss.yml new file mode 100644 index 00000000..57776dd2 --- /dev/null +++ b/.github/workflows/lint-scss.yml @@ -0,0 +1,26 @@ +name: Lint SCSS + +on: + push: + paths: + - "_sass/**/*.scss" + pull_request: + paths: + - "_sass/**/*.scss" + +jobs: + lint-scss: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install Dependencies + run: npm i + + - name: Lint SCSS + run: npm run lint:scss From 29bf95e9c7a7f012f17f508765f76dea77440a66 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 27 Jul 2025 21:39:00 +0800 Subject: [PATCH 125/177] style: change css color functions to use modern notation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `rgba()` → `rgb()` --- .stylelintrc.json | 2 - _sass/base/_base.scss | 4 +- _sass/base/_syntax.scss | 4 +- _sass/base/_typography.scss | 2 +- _sass/components/_popups.scss | 2 +- _sass/pages/_home.scss | 2 +- _sass/themes/_dark.scss | 92 +++++++++++++++++------------------ _sass/themes/_light.scss | 46 ++++++++---------- 8 files changed, 74 insertions(+), 80 deletions(-) diff --git a/.stylelintrc.json b/.stylelintrc.json index b8902909..c0c1b95a 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -8,8 +8,6 @@ "property-no-vendor-prefix": null, "selector-no-vendor-prefix": null, "value-no-vendor-prefix": null, - "color-function-notation": "legacy", - "alpha-value-notation": "number", "selector-not-notation": "simple", "color-hex-length": "long", "declaration-block-single-line-max-declarations": 3, diff --git a/_sass/base/_base.scss b/_sass/base/_base.scss index 19f153bd..46e9eb6e 100644 --- a/_sass/base/_base.scss +++ b/_sass/base/_base.scss @@ -103,7 +103,7 @@ main { width: 100%; height: 100%; position: absolute; - background-color: var(--card-hovor-bg); + background-color: var(--card-hover-bg); opacity: 0; transition: opacity 0.35s ease-in-out; } @@ -349,7 +349,7 @@ main { } .disabled { - color: rgb(206, 196, 196); + color: rgb(206 196 196); pointer-events: auto; cursor: not-allowed; } diff --git a/_sass/base/_syntax.scss b/_sass/base/_syntax.scss index 69924fc6..ae03d0dc 100644 --- a/_sass/base/_syntax.scss +++ b/_sass/base/_syntax.scss @@ -66,7 +66,7 @@ code { &.highlighter-rouge { font-size: v.$code-font-size; padding: 3px 5px; - word-break: break-word; + overflow-wrap: break-word; border-radius: v.$radius-sm; background-color: var(--inline-code-bg); } @@ -243,7 +243,7 @@ div { } &:not([timeout]):hover { - background-color: rgba(128, 128, 128, 0.37); + background-color: rgb(128 128 128 / 37%); i { color: white; diff --git a/_sass/base/_typography.scss b/_sass/base/_typography.scss index 4cf39643..1e7a6ef3 100644 --- a/_sass/base/_typography.scss +++ b/_sass/base/_typography.scss @@ -238,7 +238,7 @@ main { border-spacing: 0; thead { - border-bottom: solid 2px rgba(210, 215, 217, 0.75); + border-bottom: solid 2px rgb(210 215 217 / 75%); th { @extend %table-cell; diff --git a/_sass/components/_popups.scss b/_sass/components/_popups.scss index ca3e2fc6..e94fcde3 100644 --- a/_sass/components/_popups.scss +++ b/_sass/components/_popups.scss @@ -41,7 +41,7 @@ border-radius: 0.5rem; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); - background-color: rgba(255, 255, 255, 0.5); + background-color: rgb(255 255 255 / 50%); color: #1b1b1eba; position: fixed; left: 50%; diff --git a/_sass/pages/_home.scss b/_sass/pages/_home.scss index 7a4bbf9b..027cbe6a 100644 --- a/_sass/pages/_home.scss +++ b/_sass/pages/_home.scss @@ -160,7 +160,7 @@ cursor: not-allowed; .page-link { - color: rgba(108, 117, 125, 0.57); + color: rgb(108 117 125 / 57%); } } } /* .page-item */ diff --git a/_sass/themes/_dark.scss b/_sass/themes/_dark.scss index 8c2f6ea8..aae65221 100644 --- a/_sass/themes/_dark.scss +++ b/_sass/themes/_dark.scss @@ -2,33 +2,33 @@ color-scheme: dark; /* Framework color */ - --main-bg: rgb(27, 27, 30); - --mask-bg: rgb(68, 69, 70); - --main-border-color: rgb(44, 45, 45); + --main-bg: rgb(27 27 30); + --mask-bg: rgb(68 69 70); + --main-border-color: rgb(44 45 45); /* Common color */ - --text-color: rgb(175, 176, 177); + --text-color: rgb(175 176 177); --text-muted-color: #868686; --text-muted-highlight-color: #aeaeae; --heading-color: #cccccc; --label-color: #a7a7a7; - --blockquote-border-color: rgb(66, 66, 66); + --blockquote-border-color: rgb(66 66 66); --blockquote-text-color: #868686; - --link-color: rgb(138, 180, 248); - --link-underline-color: rgb(82, 108, 150); + --link-color: rgb(138 180 248); + --link-underline-color: rgb(82 108 150); --button-bg: #1e1e1e; --btn-border-color: #2e2f31; --btn-backtotop-color: var(--text-color); --btn-backtotop-border-color: #212122; --card-header-bg: #292929; - --checkbox-color: rgb(118, 120, 121); + --checkbox-color: rgb(118 120 121); --checkbox-checked-color: var(--link-color); - --img-bg: radial-gradient(circle, rgb(22, 22, 24) 0%, rgb(32, 32, 32) 100%); + --img-bg: radial-gradient(circle, rgb(22 22 24) 0%, rgb(32 32 32) 100%); --shimmer-bg: linear-gradient( 90deg, - rgba(255, 255, 255, 0) 0%, - rgba(58, 55, 55, 0.4) 50%, - rgba(255, 255, 255, 0) 100% + rgb(255 255 255 / 0%) 0%, + rgb(58 55 55 / 40%) 50%, + rgb(255 255 255 / 0%) 100% ); /* Sidebar */ @@ -37,65 +37,65 @@ --sidebar-bg: #1e1e1e; --sidebar-border-color: #292929; --sidebar-muted-color: #868686; - --sidebar-active-color: rgb(255, 255, 255, 0.95); + --sidebar-active-color: rgb(255 255 255 / 95%); --sidebar-hover-bg: #262626; --sidebar-btn-bg: #232328; --sidebar-btn-color: #787878; - --avatar-border-color: rgb(206, 206, 206, 0.9); + --avatar-border-color: rgb(206 206 206 / 90%); /* Topbar */ - --topbar-bg: rgb(27, 27, 30, 0.64); + --topbar-bg: rgb(27 27 30 / 64%); --topbar-text-color: var(--text-color); - --search-border-color: rgb(55, 55, 55); - --search-icon-color: rgb(100, 102, 105); - --input-focus-border-color: rgb(112, 114, 115); + --search-border-color: rgb(55 55 55); + --search-icon-color: rgb(100 102 105); + --input-focus-border-color: rgb(112 114 115); /* Home page */ - --post-list-text-color: rgb(175, 176, 177); + --post-list-text-color: rgb(175 176 177); --btn-patinator-text-color: var(--text-color); --btn-paginator-hover-color: #2e2e2e; /* Posts */ - --toc-highlight: rgb(116, 178, 243); + --toc-highlight: rgb(116 178 243); --toc-popup-border-color: #373737; - --tag-hover: rgb(43, 56, 62); + --tag-hover: rgb(43 56 62); --tb-odd-bg: #252526; /* odd rows of the posts' table */ - --tb-even-bg: rgb(31, 31, 34); /* even rows of the posts' table */ + --tb-even-bg: rgb(31 31 34); /* even rows of the posts' table */ --tb-border-color: var(--tb-odd-bg); - --footnote-target-bg: rgb(63, 81, 181); + --footnote-target-bg: rgb(63 81 181); --btn-share-color: #6c757d; --btn-share-hover-color: #bfc1ca; --card-bg: #1e1e1e; - --card-hovor-bg: #464d51; - --card-shadow: rgb(21, 21, 21, 0.72) 0 6px 18px 0, - rgb(137, 135, 135, 0.24) 0 0 0 1px; + --card-hover-bg: #464d51; + --card-shadow: rgb(21 21 21 / 72%) 0 6px 18px 0, + rgb(137 135 135 / 24%) 0 0 0 1px; --kbd-wrap-color: #6a6a6a; --kbd-text-color: #d3d3d3; --kbd-bg-color: #242424; - --prompt-text-color: rgb(216, 212, 212, 0.75); - --prompt-tip-bg: rgb(22, 60, 36, 0.64); - --prompt-tip-icon-color: rgb(15, 164, 15, 0.81); - --prompt-info-bg: rgb(7, 59, 104, 0.8); + --prompt-text-color: rgb(216 212 212 / 75%); + --prompt-tip-bg: rgb(22 60 36 / 64%); + --prompt-tip-icon-color: rgb(15 164 15 / 81%); + --prompt-info-bg: rgb(7 59 104 / 80%); --prompt-info-icon-color: #0075d1; - --prompt-warning-bg: rgb(90, 69, 3, 0.88); - --prompt-warning-icon-color: rgb(255, 165, 0, 0.8); - --prompt-danger-bg: rgb(86, 28, 8, 0.8); + --prompt-warning-bg: rgb(90 69 3 / 88%); + --prompt-warning-icon-color: rgb(255 165 0 / 80%); + --prompt-danger-bg: rgb(86 28 8 / 80%); --prompt-danger-icon-color: #cd0202; /* Tags */ - --tag-border: rgb(59, 79, 88); - --tag-shadow: rgb(32, 33, 33); - --dash-color: rgb(63, 65, 68); + --tag-border: rgb(59 79 88); + --tag-shadow: rgb(32 33 33); + --dash-color: rgb(63 65 68); --search-tag-bg: #292828; /* Categories */ - --categories-border: rgb(64, 66, 69, 0.5); - --categories-hover-bg: rgb(73, 75, 76); + --categories-border: rgb(64 66 69 / 50%); + --categories-hover-bg: rgb(73 75 76); --categories-icon-hover-color: white; /* Archive */ - --timeline-node-bg: rgb(150, 152, 156); - --timeline-color: rgb(63, 65, 68); + --timeline-node-bg: rgb(150 152 156); + --timeline-color: rgb(63 65 68); --timeline-year-dot-color: var(--timeline-color); /* Code highlight colors */ @@ -103,7 +103,7 @@ --highlight-bg-color: #151515; --highlighter-rouge-color: #c9def1; --highlight-lineno-color: #808080; - --inline-code-bg: rgba(255, 255, 255, 0.05); + --inline-code-bg: rgb(255 255 255 / 5%); --code-color: #b0b0b0; --code-header-text-color: #6a6a6a; --code-header-muted-color: #353535; @@ -141,11 +141,11 @@ #archives li:nth-child(odd) { background-image: linear-gradient( to left, - rgb(26, 26, 30), - rgb(39, 39, 45), - rgb(39, 39, 45), - rgb(39, 39, 45), - rgb(26, 26, 30) + rgb(26 26 30), + rgb(39 39 45), + rgb(39 39 45), + rgb(39 39 45), + rgb(26 26 30) ); } diff --git a/_sass/themes/_light.scss b/_sass/themes/_light.scss index 14c3962b..48d47558 100644 --- a/_sass/themes/_light.scss +++ b/_sass/themes/_light.scss @@ -20,34 +20,30 @@ --btn-backtotop-border-color: #f1f1f1; --checkbox-color: #c5c5c5; --checkbox-checked-color: #07a8f7; - --img-bg: radial-gradient( - circle, - rgb(255, 255, 255) 0%, - rgb(239, 239, 239) 100% - ); + --img-bg: radial-gradient(circle, rgb(255 255 255) 0%, rgb(239 239 239) 100%); --shimmer-bg: linear-gradient( 90deg, - rgba(250, 250, 250, 0) 0%, - rgba(232, 230, 230, 1) 50%, - rgba(250, 250, 250, 0) 100% + rgb(250 250 250 / 0%) 0%, + rgb(232 230 230 / 100%) 50%, + rgb(250 250 250 / 0%) 100% ); /* Sidebar */ - --site-title-color: rgb(113, 113, 113); + --site-title-color: rgb(113 113 113); --site-subtitle-color: #717171; --sidebar-bg: #f6f8fa; --sidebar-border-color: #efefef; --sidebar-muted-color: #545454; --sidebar-active-color: #1d1d1d; - --sidebar-hover-bg: rgb(223, 233, 241, 0.64); + --sidebar-hover-bg: rgb(223 233 241 / 64%); --sidebar-btn-bg: white; --sidebar-btn-color: #8e8e8e; --avatar-border-color: white; /* Topbar */ - --topbar-bg: rgb(255, 255, 255, 0.7); - --topbar-text-color: rgb(78, 78, 78); - --search-border-color: rgb(240, 240, 240); + --topbar-bg: rgb(255 255 255 / 70%); + --topbar-text-color: rgb(78 78 78); + --search-border-color: rgb(240 240 240); --search-icon-color: #c2c6cc; --input-focus-border-color: #b8b8b8; @@ -62,9 +58,9 @@ --btn-share-color: gray; --btn-share-hover-color: #0d6efd; --card-bg: white; - --card-hovor-bg: #e2e2e2; - --card-shadow: rgb(104, 104, 104, 0.05) 0 2px 6px 0, - rgba(211, 209, 209, 0.15) 0 0 0 1px; + --card-hover-bg: #e2e2e2; + --card-shadow: rgb(104 104 104 / 5%) 0 2px 6px 0, + rgb(211 209 209 / 15%) 0 0 0 1px; --footnote-target-bg: lightcyan; --tb-odd-bg: #fbfcfd; --tb-border-color: #eaeaea; @@ -72,29 +68,29 @@ --kbd-wrap-color: #bdbdbd; --kbd-text-color: var(--text-color); --kbd-bg-color: white; - --prompt-text-color: rgb(46, 46, 46, 0.77); - --prompt-tip-bg: rgb(123, 247, 144, 0.2); + --prompt-text-color: rgb(46 46 46 / 77%); + --prompt-tip-bg: rgb(123 247 144 / 20%); --prompt-tip-icon-color: #03b303; --prompt-info-bg: #e1f5fe; --prompt-info-icon-color: #0070cb; - --prompt-warning-bg: rgb(255, 243, 205); + --prompt-warning-bg: rgb(255 243 205); --prompt-warning-icon-color: #ef9c03; - --prompt-danger-bg: rgb(248, 215, 218, 0.56); + --prompt-danger-bg: rgb(248 215 218 / 56%); --prompt-danger-icon-color: #df3c30; /* Tags */ --tag-border: #dee2e6; --tag-shadow: var(--btn-border-color); - --tag-hover: rgb(222, 226, 230); + --tag-hover: rgb(222 226 230); --search-tag-bg: #f8f9fa; /* Categories */ - --categories-border: rgba(0, 0, 0, 0.125); + --categories-border: rgb(0 0 0 / 12.5%); --categories-hover-bg: var(--btn-border-color); --categories-icon-hover-color: darkslategray; /* Archive */ - --timeline-color: rgba(0, 0, 0, 0.075); + --timeline-color: rgb(0 0 0 / 7.5%); --timeline-node-bg: #c2c6cc; --timeline-year-dot-color: #ffffff; @@ -103,7 +99,7 @@ --highlight-bg-color: #f6f8fa; --highlighter-rouge-color: #3f596f; --highlight-lineno-color: #9e9e9e; - --inline-code-bg: rgba(25, 25, 28, 0.05); + --inline-code-bg: rgb(25 25 28 / 5%); --code-color: #3a3a3a; --code-header-text-color: #a3a3a3; --code-header-muted-color: #e5e5e5; @@ -111,7 +107,7 @@ --clipboard-checked-color: #43c743; [class^='prompt-'] { - --link-underline-color: rgb(219, 216, 216); + --link-underline-color: rgb(219 216 216); } .dark { From eaf5e574493776212be4ed14a2ddd2d60f7f4094 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 31 Jul 2025 03:37:32 +0800 Subject: [PATCH 126/177] ci: change filter script to ESM format Because `"type": "module"` was added to `package.json` --- .github/workflows/pr-filter.yml | 4 ++-- .github/workflows/scripts/pr-filter.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml index 8e9a18b7..40ba53b1 100644 --- a/.github/workflows/pr-filter.yml +++ b/.github/workflows/pr-filter.yml @@ -21,5 +21,5 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const script = require('.github/workflows/scripts/pr-filter.js'); - await script({ github, context, core }); + const { default: filter } = await import('${{ github.workspace }}/.github/workflows/scripts/pr-filter.js'); + await filter({ github, context, core }); diff --git a/.github/workflows/scripts/pr-filter.js b/.github/workflows/scripts/pr-filter.js index 03f50dc5..52e8d526 100644 --- a/.github/workflows/scripts/pr-filter.js +++ b/.github/workflows/scripts/pr-filter.js @@ -9,7 +9,7 @@ function hasDescription(markdown) { ); } -module.exports = async ({ github, context, core }) => { +export default async ({ github, context, core }) => { const pr = context.payload.pull_request; const body = pr.body === null ? '' : pr.body; const markdown = body.replace(//g, ''); From 5f8ec7ffd3b23998bad48c110e809576fe5daf80 Mon Sep 17 00:00:00 2001 From: Jason Raveling Date: Sun, 31 Aug 2025 08:51:01 -0500 Subject: [PATCH 127/177] fix: avoid unconfigured social options in sidebar (#2507) --- _includes/sidebar.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/_includes/sidebar.html b/_includes/sidebar.html index 569585f6..1cd0ee8a 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -52,13 +52,21 @@ {% endunless %} {% for entry in site.data.contact %} + {%- assign url = null -%} + {% case entry.type %} {% when 'github', 'twitter' %} + {%- unless site[entry.type].username -%} + {%- continue -%} + {%- endunless -%} {%- capture url -%} https://{{ entry.type }}.com/{{ site[entry.type].username }} {%- endcapture -%} {% when 'email' %} - {% assign email = site.social.email | split: '@' %} + {%- unless site.social.email -%} + {%- continue -%} + {%- endunless -%} + {%- assign email = site.social.email | split: '@' -%} {%- capture url -%} javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@') {%- endcapture -%} From cda62e28d1b71ce4018301aacf93532230aa2b3b Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Mon, 8 Sep 2025 23:45:20 +0400 Subject: [PATCH 128/177] feat: add support for embed spotify (#2515) --- _includes/embed/audio.html | 2 +- _includes/embed/spotify.html | 22 +++++++++++++++++++++ _posts/2019-08-08-write-a-new-post.md | 28 +++++++++++++++------------ _sass/base/_base.scss | 9 ++++++++- 4 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 _includes/embed/spotify.html diff --git a/_includes/embed/audio.html b/_includes/embed/audio.html index cf928a7f..bb20688e 100644 --- a/_includes/embed/audio.html +++ b/_includes/embed/audio.html @@ -9,7 +9,7 @@ {% endunless %}

-

' %} + {% assign _wrapper_start = '
' %} {% assign _img_content = _img_content | append: _wrapper_start %} {% assign _right = _right | prepend: '> Date: Tue, 14 Oct 2025 04:53:51 +0800 Subject: [PATCH 131/177] chore: remove deprecated URL --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index f22921b7..fed8764e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1 @@ ko_fi: coteschung -custom: https://sponsor.cotes.page From a385ffabff61d902db618450d51651afcb00c00a Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 14 Oct 2025 04:54:48 +0800 Subject: [PATCH 132/177] chore: improve ESLint config --- eslint.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index b8073b6d..b6d8f192 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -21,13 +21,13 @@ export default defineConfig([ files: ['_javascript/**/*.js'], languageOptions: { globals: { + ...globals.serviceworker, ClipboardJS: 'readonly', GLightbox: 'readonly', Theme: 'readonly', dayjs: 'readonly', mermaid: 'readonly', tocbot: 'readonly', - importScripts: 'readonly', swconf: 'readonly' } } From ee6839516e046cb2c0230dad1142ce2d39a7abc2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 05:23:24 +0800 Subject: [PATCH 133/177] build(deps): bump the gh-actions group across 1 directory with 5 updates (#2550) Bumps the gh-actions group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `4` | `5` | | [actions/setup-node](https://github.com/actions/setup-node) | `4` | `5` | | [github/codeql-action](https://github.com/github/codeql-action) | `3` | `4` | | [actions/github-script](https://github.com/actions/github-script) | `7` | `8` | | [actions/stale](https://github.com/actions/stale) | `9` | `10` | Updates `actions/checkout` from 4 to 5 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) Updates `actions/setup-node` from 4 to 5 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v4...v5) Updates `github/codeql-action` from 3 to 4 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v3...v4) Updates `actions/github-script` from 7 to 8 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v7...v8) Updates `actions/stale` from 9 to 10 - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v9...v10) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: gh-actions - dependency-name: actions/setup-node dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: gh-actions - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: gh-actions - dependency-name: actions/github-script dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major dependency-group: gh-actions - dependency-name: actions/stale dependency-version: '10' dependency-type: direct:production update-type: version-update:semver-major dependency-group: gh-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/cd.yml | 4 ++-- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql.yml | 8 ++++---- .github/workflows/commitlint.yml | 2 +- .github/workflows/lint-js.yml | 4 ++-- .github/workflows/lint-scss.yml | 4 ++-- .github/workflows/pr-filter.yml | 4 ++-- .github/workflows/stale.yml | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c665f755..cd67b6d2 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -14,14 +14,14 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: ruby/setup-ruby@v1 with: ruby-version: 3.3 bundler-cache: true - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 with: node-version: lts/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31b87863..118fc715 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 # for posts's lastmod @@ -42,7 +42,7 @@ jobs: bundler-cache: true - name: Setup Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v5 with: node-version: lts/* diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 06feb7fd..e460e49a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,11 +24,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: "${{ matrix.language }}" config-file: .github/codeql/codeql-config.yml @@ -36,9 +36,9 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v3 + uses: github/codeql-action/autobuild@v4 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 with: category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 58f1a3ff..ef14388b 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -11,5 +11,5 @@ jobs: commitlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: wagoid/commitlint-github-action@v6 diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml index 1e192348..205f4790 100644 --- a/.github/workflows/lint-js.yml +++ b/.github/workflows/lint-js.yml @@ -16,10 +16,10 @@ jobs: lint-js: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v5 with: node-version: lts/* diff --git a/.github/workflows/lint-scss.yml b/.github/workflows/lint-scss.yml index 57776dd2..48d8a726 100644 --- a/.github/workflows/lint-scss.yml +++ b/.github/workflows/lint-scss.yml @@ -12,10 +12,10 @@ jobs: lint-scss: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v5 with: node-version: lts/* diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml index 40ba53b1..ee3f09db 100644 --- a/.github/workflows/pr-filter.yml +++ b/.github/workflows/pr-filter.yml @@ -13,11 +13,11 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Check PR Content id: intercept - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 4f6e91cb..1c9913f5 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -20,7 +20,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v9 + - uses: actions/stale@v10 with: # 60 days before marking issues/PRs stale days-before-close: -1 # does not close automatically From b3d7db3cda006a63cdecd718f97d415eab709dc8 Mon Sep 17 00:00:00 2001 From: Cotes <11371340+cotes2020@users.noreply.github.com> Date: Fri, 17 Oct 2025 00:02:12 +0800 Subject: [PATCH 134/177] =?UTF-8?q?refactor:=20avoid=20converting=20media?= =?UTF-8?q?=E2=80=98s=20relative=20paths=20to=20absolute=20paths=20(#2552)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _includes/media-url.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_includes/media-url.html b/_includes/media-url.html index ea410750..407d4218 100644 --- a/_includes/media-url.html +++ b/_includes/media-url.html @@ -15,7 +15,9 @@ {%- if url -%} {% unless url contains ':' %} {%- comment -%} Add media resources subpath prefix {%- endcomment -%} - {% assign url = include.subpath | default: '' | append: '/' | append: url %} + {% if include.subpath %} + {% assign url = include.subpath | append: '/' | append: url %} + {% endif %} {%- comment -%} Prepend CND URL {%- endcomment -%} {% if site.cdn %} From 604528e3ce11ec0278e83f41105ed5949362bb54 Mon Sep 17 00:00:00 2001 From: Cotes <11371340+cotes2020@users.noreply.github.com> Date: Mon, 20 Oct 2025 02:24:40 +0800 Subject: [PATCH 135/177] fix(search): restore full-text search for posts with description (#2557) --- _includes/post-description.html | 30 ------------------------- _includes/post-summary.html | 39 +++++++++++++++++++++++++++++++++ _includes/related-posts.html | 2 +- _layouts/home.html | 2 +- assets/feed.xml | 2 +- assets/js/data/search.json | 3 ++- 6 files changed, 44 insertions(+), 34 deletions(-) delete mode 100644 _includes/post-description.html create mode 100644 _includes/post-summary.html diff --git a/_includes/post-description.html b/_includes/post-description.html deleted file mode 100644 index 48bb03b7..00000000 --- a/_includes/post-description.html +++ /dev/null @@ -1,30 +0,0 @@ -{%- comment -%} - Get post description or generate it from the post content. -{%- endcomment -%} - -{%- capture description -%} - {%- if post.description -%} - {{- post.description -}} - {%- else -%} - {% comment %} - Remove the line number of the code snippet. - {% endcomment %} - {%- assign content = post.content -%} - - {%- if content contains '
' -%}
-      {%- assign content = content | replace: '
', '' -%}
-    {%- endif -%}
-
-    {{- content | strip_html | newline_to_br | replace: '
', ' ' | strip_newlines -}} - {%- endif -%} -{%- endcapture -%} - -{%- if include.json -%} - {%- assign description = description | jsonify -%} -{%- else -%} - {%- assign max_length = include.max_length | default: 200 -%} - {%- assign description = description | strip | truncate: max_length -%} -{%- endif -%} - -{{- description -}} diff --git a/_includes/post-summary.html b/_includes/post-summary.html new file mode 100644 index 00000000..c9314fc8 --- /dev/null +++ b/_includes/post-summary.html @@ -0,0 +1,39 @@ +{%- comment -%} + Get the post's description or body content. + + Arguments: + full_text: If true, return the full content. Default is false. + max_length: The maximum length of the returned content. Default is 200. +{%- endcomment -%} + +{%- if post.description and include.full_text != true -%} + {{- post.description -}} +{%- else -%} + {%- comment -%} Remove the line numbers from the code snippet. {%- endcomment -%} + + {%- assign content = post.content -%} + + {%- if content contains '
' -%}
+    {%- assign content = content
+      | replace: '
',
+        '' -%}
+  {%- endif -%}
+
+  {%- assign content = content
+    | markdownify
+    | strip_html
+    | newline_to_br
+    | replace: '
', ' ' + | strip_newlines + | strip + -%} + + {%- unless include.full_text -%} + {%- assign max_length = include.max_length | default: 200 -%} + {%- assign content = content | truncate: max_length -%} + {%- endunless -%} + + {{- content -}} +{%- endif -%} diff --git a/_includes/related-posts.html b/_includes/related-posts.html index 37a295bd..4b4f8088 100644 --- a/_includes/related-posts.html +++ b/_includes/related-posts.html @@ -82,7 +82,7 @@

{{ post.title }}

-

{% include post-description.html %}

+

{% include post-summary.html %}

diff --git a/_layouts/home.html b/_layouts/home.html index 66a12012..cb9ab244 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -78,7 +78,7 @@

{{ post.title }}

-

{% include post-description.html %}

+

{% include post-summary.html %}