chore: initialize the environment

This commit is contained in:
Aliberk Sandıkçı 2024-04-13 01:43:02 +03:00
parent 7a7818b579
commit c1c46e6db9
28 changed files with 25 additions and 1209 deletions

View file

@ -1,26 +0,0 @@
body:
- type: checkboxes
attributes:
label: Checklist
description: Following the guidelines can make you more likely to get responses.
options:
- label: >-
I have read and accepted the
[contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md).
required: true
- type: dropdown
attributes:
label: What is the topic?
options:
- Sharing tips and tricks
- Just chatting
validations:
required: true
- type: textarea
attributes:
label: Description
description: Please describe in detail what you want to share.
validations:
required: true

View file

@ -1,40 +0,0 @@
body:
- type: checkboxes
attributes:
label: Checklist
description: Following the guidelines can make you more likely to get responses.
options:
- label: >-
I have read and accepted the
[contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md).
required: true
- type: dropdown
id: download
attributes:
label: How did you create the site?
options:
- Generated from `chirpy-starter`
- Built from `jekyll-theme-chirpy`
validations:
required: true
- type: textarea
attributes:
label: Description
description: Please describe your need in detail.
validations:
required: true
- type: textarea
attributes:
label: Operations you have already tried
description: Describe the effort you went through.
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Or logs? Anything that will give us more context about the issue you are encountering!

2
.github/FUNDING.yml vendored
View file

@ -1,2 +0,0 @@
ko_fi: coteschung
custom: https://sponsor.cotes.page

View file

@ -1,64 +0,0 @@
name: Bug Report
description: Create a report to help us improve
body:
- type: checkboxes
attributes:
label: Checklist
description: Following the guidelines can make you more likely to get responses.
options:
- label: >-
I have read and accepted the
[contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md).
required: true
- type: dropdown
id: download
attributes:
label: How did you create the site?
options:
- Generated from `chirpy-starter`
- Built from `jekyll-theme-chirpy`
validations:
required: true
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Environment
value: |
- Ruby: <!-- run `ruby -v` -->
- Jekyll: <!-- run `bundle exec jekyll -v` -->
- Chirpy: <!-- run `bundle info jekyll-theme-chirpy` -->
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Or logs? Anything that will give us more context about the issue you are encountering!

View file

@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Ask the community for help
url: https://github.com/cotes2020/jekyll-theme-chirpy/discussions
about: Please ask and answer questions here.

View file

@ -1,38 +0,0 @@
name: Feature Request
description: Suggest an idea for this project
labels:
- enhancement
body:
- type: checkboxes
attributes:
label: Checklist
description: Following the guidelines can make you more likely to get responses.
options:
- label: >-
I have read and accepted the
[contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md).
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe
description: A clear and concise description of what the problem is.
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.

View file

@ -1,17 +0,0 @@
## Type of change
<!-- Please select the desired item checkbox and change it from `[ ]` to `[x]` and then delete the irrelevant options. -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Improvement (refactoring and improving code)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Description
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
-->
## Additional context
<!-- e.g. Fixes #(issue) -->

View file

@ -1,2 +0,0 @@
paths-ignore:
- "assets/js"

View file

@ -1,26 +0,0 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
versioning-strategy: increase
groups:
bundler:
dependency-type: "production"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/"
versioning-strategy: increase
groups:
npm:
dependency-type: "development"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
groups:
gh-actions:
update-types:
- "major"
schedule:
interval: "weekly"

View file

@ -1,17 +0,0 @@
name: CD
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- docs
jobs:
launch:
runs-on: ubuntu-latest
steps:
- run: |
curl -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \
-d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}'

View file

@ -1,45 +0,0 @@
name: "CI"
on:
push:
branches-ignore:
- "production"
- "docs"
paths-ignore:
- ".github/**"
- "!.github/workflows/ci.yml"
- ".gitignore"
- "docs/**"
- "README.md"
- "LICENSE"
pull_request:
paths:
- "**"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["3.0", "3.1", "3.2"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Setup Node
uses: actions/setup-node@v4
- name: Build Assets
run: npm i && npm run build
- name: Test Site
run: bash tools/test

View file

@ -1,43 +0,0 @@
name: "CodeQL"
on:
push:
paths: ["_javascript/**/*.js"]
pull_request:
paths: ["_javascript/**/*.js"]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["javascript"]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: "${{ matrix.language }}"
config-file: .github/codeql/codeql-config.yml
# 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
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"

View file

@ -1,11 +0,0 @@
name: Lint Commit Messages
on: pull_request
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5

View file

@ -1,32 +0,0 @@
name: "Close stale issues and PRs"
on:
schedule:
- cron: "0 0 * * *" # every day at 00:00 UTC
permissions:
issues: write
pull-requests: write
env:
STALE_LABEL: stale
EXEMPT_LABELS: "pending,planning,in progress"
MESSAGE: >
This conversation has been automatically marked as stale because it has not had recent activity.
It will be closed if no further activity occurs.
Thank you for your contributions.
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
# 60 days before marking issues/PRs stale
days-before-close: -1 # does not close automatically
stale-issue-label: ${{ env.STALE_LABEL }}
exempt-issue-labels: ${{ env.EXEMPT_LABELS }}
stale-issue-message: ${{ env.MESSAGE }}
stale-pr-label: ${{ env.STALE_LABEL }}
exempt-pr-labels: ${{ env.EXEMPT_LABELS }}
stale-pr-message: ${{ env.MESSAGE }}

View file

@ -1,25 +0,0 @@
name: "Style Lint"
on:
push:
branches-ignore:
- "production"
- "docs"
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
- run: npm i
- run: npm test

1
.gitignore vendored
View file

@ -18,4 +18,3 @@ package-lock.json
.idea
# Misc
assets/js/dist

View file

@ -76,7 +76,7 @@ theme_mode: # [light | dark]
img_cdn: "https://chirpy-img.netlify.app"
# the avatar on sidebar, support local or CORS resources
avatar: "/commons/avatar.jpg"
avatar:
# The URL of the site-wide social preview image used in SEO `og:image` meta tag.
# It can be overridden by a customized `page.image` in front matter.

View file

@ -1,195 +0,0 @@
---
title: Text and Typography
author: cotes
date: 2019-08-08 11:33:00 +0800
categories: [Blogging, Demo]
tags: [typography]
pin: true
math: true
mermaid: true
image:
path: /commons/devices-mockup.png
lqip: data:image/webp;base64,UklGRpoAAABXRUJQVlA4WAoAAAAQAAAADwAABwAAQUxQSDIAAAARL0AmbZurmr57yyIiqE8oiG0bejIYEQTgqiDA9vqnsUSI6H+oAERp2HZ65qP/VIAWAFZQOCBCAAAA8AEAnQEqEAAIAAVAfCWkAALp8sF8rgRgAP7o9FDvMCkMde9PK7euH5M1m6VWoDXf2FkP3BqV0ZYbO6NA/VFIAAAA
alt: Responsive rendering of Chirpy theme on multiple devices.
---
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
## Headings
# H1 - heading
{: .mt-4 .mb-0 }
## H2 - heading
{: data-toc-skip='' .mt-4 .mb-0 }
### H3 - heading
{: data-toc-skip='' .mt-4 .mb-0 }
#### H4 - heading
{: data-toc-skip='' .mt-4 }
## Paragraph
Quisque egestas convallis ipsum, ut sollicitudin risus tincidunt a. Maecenas interdum malesuada egestas. Duis consectetur porta risus, sit amet vulputate urna facilisis ac. Phasellus semper dui non purus ultrices sodales. Aliquam ante lorem, ornare a feugiat ac, finibus nec mauris. Vivamus ut tristique nisi. Sed vel leo vulputate, efficitur risus non, posuere mi. Nullam tincidunt bibendum rutrum. Proin commodo ornare sapien. Vivamus interdum diam sed sapien blandit, sit amet aliquam risus mattis. Nullam arcu turpis, mollis quis laoreet at, placerat id nibh. Suspendisse venenatis eros eros.
## Lists
### Ordered list
1. Firstly
2. Secondly
3. Thirdly
### Unordered list
- Chapter
+ Section
* Paragraph
### ToDo list
- [ ] Job
+ [x] Step 1
+ [x] Step 2
+ [ ] Step 3
### Description list
Sun
: the star around which the earth orbits
Moon
: the natural satellite of the earth, visible by reflected light from the sun
## Block Quote
> This line shows the _block quote_.
## Prompts
> An example showing the `tip` type prompt.
{: .prompt-tip }
> An example showing the `info` type prompt.
{: .prompt-info }
> An example showing the `warning` type prompt.
{: .prompt-warning }
> An example showing the `danger` type prompt.
{: .prompt-danger }
## Tables
| Company | Contact | Country |
|:-----------------------------|:-----------------|--------:|
| Alfreds Futterkiste | Maria Anders | Germany |
| Island Trading | Helen Bennett | UK |
| Magazzini Alimentari Riuniti | Giovanni Rovelli | Italy |
## Links
<http://127.0.0.1:4000>
## Footnote
Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2].
## Inline code
This is an example of `Inline Code`.
## Filepath
Here is the `/path/to/the/file.extend`{: .filepath}.
## Code blocks
### Common
```
This is a common code snippet, without syntax highlight and line number.
```
### Specific Language
```bash
if [ $? -ne 0 ]; then
echo "The command was not successful.";
#do the needful / exit
fi;
```
### Specific filename
```sass
@import
"colors/light-typography",
"colors/dark-typography";
```
{: file='_sass/jekyll-theme-chirpy.scss'}
## Mathematics
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
$$
\begin{equation}
\sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6}
\label{eq:series}
\end{equation}
$$
We can reference the equation as \eqref{eq:series}.
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
## Mermaid SVG
```mermaid
gantt
title Adding GANTT diagram functionality to mermaid
apple :a, 2017-07-20, 1w
banana :crit, b, 2017-07-23, 1d
cherry :active, c, after b a, 1d
```
## Images
### Default (with caption)
![Desktop View](/posts/20190808/mockup.png){: width="972" height="589" }
_Full screen width and center alignment_
### Left aligned
![Desktop View](/posts/20190808/mockup.png){: width="972" height="589" .w-75 .normal}
### Float to left
![Desktop View](/posts/20190808/mockup.png){: width="972" height="589" .w-50 .left}
Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum.
### Float to right
![Desktop View](/posts/20190808/mockup.png){: width="972" height="589" .w-50 .right}
Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum.
### Dark/Light mode & Shadow
The image below will toggle dark/light mode based on theme preference, notice it has shadows.
![light mode only](/posts/20190808/devtools-light.png){: .light .w-75 .shadow .rounded-10 w='1212' h='668' }
![dark mode only](/posts/20190808/devtools-dark.png){: .dark .w-75 .shadow .rounded-10 w='1212' h='668' }
## Video
{% include embed/youtube.html id='Balreaj8Yqs' %}
## Reverse Footnote
[^footnote]: The footnote source
[^fn-nth-2]: The 2nd footnote source

View file

@ -1,448 +0,0 @@
---
title: Writing a New Post
author: cotes
date: 2019-08-08 14:10:00 +0800
categories: [Blogging, Tutorial]
tags: [writing]
render_with_liquid: false
---
This tutorial will guide you how to write a post in the _Chirpy_ template, and it's worth reading even if you've used Jekyll before, as many features require specific variables to be set.
## Naming and Path
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION`{: .filepath} and put it in the `_posts`{: .filepath} of the root directory. Please note that the `EXTENSION`{: .filepath} must be one of `md`{: .filepath} and `markdown`{: .filepath}. If you want to save time of creating files, please consider using the plugin [`Jekyll-Compose`](https://github.com/jekyll/jekyll-compose) to accomplish this.
## Front Matter
Basically, you need to fill the [Front Matter](https://jekyllrb.com/docs/front-matter/) as below at the top of the post:
```yaml
---
title: TITLE
date: YYYY-MM-DD HH:MM:SS +/-TTTT
categories: [TOP_CATEGORIE, SUB_CATEGORIE]
tags: [TAG] # TAG names should always be lowercase
---
```
> The posts' _layout_ has been set to `post` by default, so there is no need to add the variable _layout_ in the Front Matter block.
{: .prompt-tip }
### 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`.
### Categories and Tags
The `categories` of each post are designed to contain up to two elements, and the number of elements in `tags` can be zero to infinity. For instance:
```yaml
---
categories: [Animal, Insect]
tags: [bee]
---
```
### Author Information
The author information of the post usually does not need to be filled in the _Front Matter_ , they will be obtained from variables `social.name` and the first entry of `social.links` of the configuration file by default. But you can also override it as follows:
Adding author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one).
```yaml
<author_id>:
name: <full name>
twitter: <twitter_of_author>
url: <homepage_of_author>
```
{: file="_data/authors.yml" }
And then use `author` to specify a single entry or `authors` to specify multiple entries:
```yaml
---
author: <author_id> # for single entry
# or
authors: [<author1_id>, <author2_id>] # for multiple entries
---
```
Having said that, the key `author` can also identify multiple entries.
> The benefit of reading the author information from the file `_data/authors.yml`{: .filepath } is that the page will have the meta tag `twitter:creator`, which enriches the [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started#card-and-content-attribution) and is good for SEO.
{: .prompt-info }
## Table of Contents
By default, the **T**able **o**f **C**ontents (TOC) is displayed on the right panel of the post. If you want to turn it off globally, go to `_config.yml`{: .filepath} and set the value of variable `toc` to `false`. If you want to turn off TOC for a specific post, add the following to the post's [Front Matter](https://jekyllrb.com/docs/front-matter/):
```yaml
---
toc: false
---
```
## Comments
The global switch of comments is defined by variable `comments.active` in the file `_config.yml`{: .filepath}. After selecting a comment system for this variable, comments will be turned on for all posts.
If you want to close the comment for a specific post, add the following to the **Front Matter** of the post:
```yaml
---
comments: false
---
```
## Mathematics
For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by:
```yaml
---
math: true
---
```
After enabling the mathematical feature, you can add math equations with the following syntax:
- **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 $$`
```markdown
<!-- Block math, keep all blank lines -->
$$
LaTeX_math_expression
$$
<!-- Equation numbering, keep all blank lines -->
$$
\begin{equation}
LaTeX_math_expression
\label{eq:label_name}
\end{equation}
$$
Can be referenced as \eqref{eq:label_name}.
<!-- Inline math in lines, NO blank lines -->
"Lorem ipsum dolor sit amet, $$ LaTeX_math_expression $$ consectetur adipiscing elit."
<!-- Inline math in lists, escape the first `$` -->
1. \$$ LaTeX_math_expression $$
2. \$$ LaTeX_math_expression $$
3. \$$ LaTeX_math_expression $$
```
## Mermaid
[**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:
```yaml
---
mermaid: true
---
```
Then you can use it like other markdown languages: surround the graph code with ```` ```mermaid ```` and ```` ``` ````.
## Images
### Caption
Add italics to the next line of an image, then it will become the caption and appear at the bottom of the image:
```markdown
![img-description](/path/to/image)
_Image Caption_
```
{: .nolineno}
### 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.
```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="700" height="400" }
```
{: .nolineno}
> For an SVG, you have to at least specify its _width_, otherwise it won't be rendered.
{: .prompt-info }
Starting from _Chirpy v5.0.0_, `height` and `width` support abbreviations (`height` → `h`, `width``w`). The following example has the same effect as the above:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: w="700" h="400" }
```
{: .nolineno}
### Position
By default, the image is centered, but you can specify the position by using one of the classes `normal`, `left`, and `right`.
> Once the position is specified, the image caption should not be added.
{: .prompt-warning }
- **Normal position**
Image will be left aligned in below sample:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .normal }
```
{: .nolineno}
- **Float to the left**
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .left }
```
{: .nolineno}
- **Float to the right**
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .right }
```
{: .nolineno}
### 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`):
```markdown
![Light mode only](/path/to/light-mode.png){: .light }
![Dark mode only](/path/to/dark-mode.png){: .dark }
```
### Shadow
The screenshots of the program window can be considered to show the shadow effect:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .shadow }
```
{: .nolineno}
### CDN URL
If you host the images on the CDN, you can save the time of repeatedly writing the CDN URL by assigning the variable `img_cdn` of `_config.yml`{: .filepath} file:
```yaml
img_cdn: https://cdn.com
```
{: file='_config.yml' .nolineno}
Once `img_cdn` is assigned, the CDN URL will be added to the path of all images (images of site avatar and posts) 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
<img src="https://cdn.com/path/to/flower.png" alt="The flower" />
```
{: .nolineno }
### Image Path
When a post contains many images, it will be a time-consuming task to repeatedly define the path of the images. To solve this, we can define this path in the YAML block of the post:
```yml
---
img_path: /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
<img src="/img/path/flower.png" alt="The flower" />
```
{: .nolineno }
### 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.
Knowing these prerequisites, you can start setting the image's attribute:
```yaml
---
image:
path: /path/to/image
alt: image alternative text
---
```
Note that the [`img_path`](#image-path) 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.
```yml
---
image: /path/to/image
---
```
### LQIP
For preview images:
```yaml
---
image:
lqip: /path/to/lqip-file # or base64 URI
---
```
> You can observe LQIP in the preview image of post [_Text and Typography_](/posts/text-and-typography/).
For normal images:
```markdown
![Image description](/path/to/image){: lqip="/path/to/lqip-file" }
```
{: .nolineno }
## 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:
```yaml
---
pin: true
---
```
## Prompts
There are several types of prompts: `tip`, `info`, `warning`, and `danger`. They can be generated by adding the class `prompt-{type}` to the blockquote. For example, define a prompt of type `info` as follows:
```md
> Example line for prompt.
{: .prompt-info }
```
{: .nolineno }
## Syntax
### Inline Code
```md
`inline code part`
```
{: .nolineno }
### Filepath Hightlight
```md
`/path/to/a/file.extend`{: .filepath}
```
{: .nolineno }
### Code Block
Markdown symbols ```` ``` ```` can easily create a code block as follows:
````md
```
This is a plaintext code snippet.
```
````
#### Specifying Language
Using ```` ```{language} ```` you will get a code block with syntax highlight:
````markdown
```yaml
key: value
```
````
> The Jekyll tag `{% highlight %}` is not compatible with this theme.
{: .prompt-danger }
#### Line Number
By default, all languages except `plaintext`, `console`, and `terminal` will display line numbers. When you want to hide the line number of a code block, add the class `nolineno` to it:
````markdown
```shell
echo 'No more line numbers!'
```
{: .nolineno }
````
#### Specifying the Filename
You may have noticed that the code language will be displayed at the top of the code block. If you want to replace it with the file name, you can add the attribute `file` to achieve this:
````markdown
```shell
# content
```
{: file="path/to/file" }
````
#### Liquid Codes
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:
````markdown
{% raw %}
```liquid
{% if product.title contains 'Pack' %}
This product's title contains the word Pack.
{% endif %}
```
{% endraw %}
````
Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block.
## Videos
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` |
## Learn More
For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/).

View file

@ -1,135 +0,0 @@
---
title: Getting Started
author: cotes
date: 2019-08-09 20:55:00 +0800
categories: [Blogging, Tutorial]
tags: [getting started]
pin: true
img_path: '/posts/20180809'
---
## Prerequisites
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.
## Installation
### Creating a New Site
There are two ways to create a new repository for this theme:
- [**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 1. Using the Chirpy Starter
Sign in to GitHub and browse to [**Chirpy Starter**][starter], click the button <kbd>Use this template</kbd> > <kbd>Create a new repository</kbd>, and name the new repository `USERNAME.github.io`, where `USERNAME` represents your GitHub username.
#### Option 2. GitHub Fork
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).
Next, clone your site to local machine. In order to build JavaScript files later, we need to install [Node.js][nodejs], and then run the tool:
```console
$ bash tools/init
```
> 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 }
The above command will:
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 JavaScript files and export to `assets/js/dist/`{: .filepath }, then make them tracked by Git.
4. Automatically create a new commit to save the changes above.
### Installing Dependencies
Before running local server for the first time, go to the root directory of your site and run:
```console
$ bundle
```
## Usage
### Configuration
Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options:
- `url`
- `avatar`
- `timezone`
- `lang`
### 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 }.
### Customizing 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.
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.
### Customing 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.
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
```
After a few seconds, the local service will be published at _<http://127.0.0.1:4000>_.
## Deployment
Before the deployment begins, check out the file `_config.yml`{: .filepath} and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starts with a slash, e.g, `/project-name`.
Now you can choose _ONE_ of the following methods to deploy your Jekyll site.
### Deploy by Using GitHub Actions
There are a few things to get ready for.
- If you're on the GitHub Free plan, keep your site repository public.
- If you have committed `Gemfile.lock`{: .filepath} to the repository, and your local machine is not running Linux, go to the root of your site and update the platform list of the lock-file:
```console
$ bundle lock --add-platform x86_64-linux
```
Next, configure the _Pages_ service.
1. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar. Then, in the **Source** section (under _Build and deployment_), select [**GitHub Actions**][pages-workflow-src] from the dropdown menu.
![Build source](pages-source-light.png){: .light .border .normal w='375' h='140' }
![Build source](pages-source-dark.png){: .dark .normal w='375' h='140' }
2. Push any commits to GitHub to trigger the _Actions_ workflow. In the _Actions_ tab of your repository, you should see the workflow _Build and Deploy_ running. Once the build is complete and successful, the site will be deployed automatically.
At this point, you can go to the URL indicated by GitHub to access your site.
### Manually Build and Deploy
On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server.
Go to the root of the source project, and build your site as follows:
```console
$ JEKYLL_ENV=production bundle exec jekyll b
```
Unless you specified the output path, the generated site files will be placed in folder `_site`{: .filepath} of the project's root directory. Now you should upload those files to the target server.
[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

View file

@ -1,36 +0,0 @@
---
title: Customize the Favicon
author: cotes
date: 2019-08-11 00:34:00 +0800
categories: [Blogging, Tutorial]
tags: [favicon]
---
The [favicons](https://www.favicon-generator.org/about/) of [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) are placed in the directory `assets/img/favicons/`{: .filepath}. You may want to replace them with your own. The following sections will guide you to create and replace the default favicons.
## Generate the favicon
Prepare a square image (PNG, JPG, or SVG) with a size of 512x512 or more, and then go to the online tool [**Real Favicon Generator**](https://realfavicongenerator.net/) and click the button <kbd>Select your Favicon image</kbd> to upload your image file.
In the next step, the webpage will show all usage scenarios. You can keep the default options, scroll to the bottom of the page, and click the button <kbd>Generate your Favicons and HTML code</kbd> to generate the favicon.
## Download & Replace
Download the generated package, unzip and delete the following two from the extracted files:
- `browserconfig.xml`{: .filepath}
- `site.webmanifest`{: .filepath}
And then copy the remaining image files (`.PNG`{: .filepath} and `.ICO`{: .filepath}) to cover the original files in the directory `assets/img/favicons/`{: .filepath} of your Jekyll site. If your Jekyll site doesn't have this directory yet, just create one.
The following table will help you understand the changes to the favicon files:
| File(s) | From Online Tool | From Chirpy |
|---------------------|:---------------------------------:|:-----------:|
| `*.PNG` | ✓ | ✗ |
| `*.ICO` | ✓ | ✗ |
> ✓ means keep, ✗ means delete.
{: .prompt-info }
The next time you build the site, the favicon will be replaced with a customized edition.

4
assets/js/dist/categories.min.js vendored Normal file
View file

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const o=$(".mode-toggle");function s(o){var s=function(o,s){if("object"!=typeof o||!o)return o;var t=o[Symbol.toPrimitive];if(void 0!==t){var e=t.call(o,s||"default");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===s?String:Number)(o)}(o,"string");return"symbol"==typeof s?s:s+""}function t(o,t,e){return(t=s(t))in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}const e=$("body"),a="sidebar-display";class r{static toggle(){!1===r.isExpanded?e.attr(a,""):e.removeAttr(a),r.isExpanded=!r.isExpanded}}t(r,"isExpanded",!1);const l=$("#sidebar-trigger"),n=$("#search-trigger"),i=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),f=$("#topbar-title"),d=$("search"),u=$("#search-result-wrapper"),p=$("#search-results"),b=$("#search-input"),m=$("#search-hints"),g=$("html,body"),C="loaded",v="unloaded",h="input-focus",w="d-flex";class y{static on(){y.offset=window.scrollY,g.scrollTop(0)}static off(){g.scrollTop(y.offset)}}t(y,"offset",0),t(y,"resultVisible",!1);class k{static on(){l.addClass(v),f.addClass(v),n.addClass(v),d.addClass(w),i.addClass(C)}static off(){i.removeClass(C),d.removeClass(w),l.removeClass(v),f.removeClass(v),n.removeClass(v)}}class T{static on(){y.resultVisible||(y.on(),u.removeClass(v),c.addClass(v),y.resultVisible=!0)}static off(){y.resultVisible&&(p.empty(),m.hasClass(v)&&m.removeClass(v),u.addClass(v),c.removeClass(v),y.off(),b.val(""),y.resultVisible=!1)}}function x(){return i.hasClass(C)}const E=$(".collapse");$(".code-header>button").children().attr("class"),function(){const o=$(window),s=$("#back-to-top");o.on("scroll",(()=>{o.scrollTop()>50?s.fadeIn():s.fadeOut()})),s.on("click",(()=>{o.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((o=>new bootstrap.Tooltip(o))),0!==o.length&&o.off().on("click",(o=>{const s=$(o.target);let t=s.prop("tagName")==="button".toUpperCase()?s:s.parent();modeToggle.flipMode(),t.trigger("blur")})),$("#sidebar-trigger").on("click",r.toggle),$("#mask").on("click",r.toggle),n.on("click",(function(){k.on(),T.on(),b.trigger("focus")})),i.on("click",(function(){k.off(),T.off()})),b.on("focus",(function(){d.addClass(h)})),b.on("focusout",(function(){d.removeClass(h)})),b.on("input",(()=>{""===b.val()?x()?m.removeClass(v):T.off():(T.on(),x()&&m.addClass(v))})),E.on("hide.bs.collapse",(function(){const o="h_"+$(this).attr("id").substring(2);o&&($("#".concat(o," .far.fa-folder-open")).attr("class","far fa-folder fa-fw"),$("#".concat(o," i.fas")).addClass("rotate"),$("#".concat(o)).removeClass("hide-border-bottom"))})),E.on("show.bs.collapse",(function(){const o="h_"+$(this).attr("id").substring(2);o&&($("#".concat(o," .far.fa-folder")).attr("class","far fa-folder-open fa-fw"),$("#".concat(o," i.fas")).removeClass("rotate"),$("#".concat(o)).addClass("hide-border-bottom"))}))}();

4
assets/js/dist/commons.min.js vendored Normal file
View file

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const e=$(".mode-toggle");function s(e){var s=function(e,s){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var t=o.call(e,s||"default");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===s?String:Number)(e)}(e,"string");return"symbol"==typeof s?s:s+""}function o(e,o,t){return(o=s(o))in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}const t=$("body"),r="sidebar-display";class a{static toggle(){!1===a.isExpanded?t.attr(r,""):t.removeAttr(r),a.isExpanded=!a.isExpanded}}o(a,"isExpanded",!1);const l=$("#sidebar-trigger"),i=$("#search-trigger"),n=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),d=$("#topbar-title"),f=$("search"),u=$("#search-result-wrapper"),p=$("#search-results"),g=$("#search-input"),m=$("#search-hints"),b=$("html,body"),v="loaded",C="unloaded",h="input-focus",y="d-flex";class w{static on(){w.offset=window.scrollY,b.scrollTop(0)}static off(){b.scrollTop(w.offset)}}o(w,"offset",0),o(w,"resultVisible",!1);class k{static on(){l.addClass(C),d.addClass(C),i.addClass(C),f.addClass(y),n.addClass(v)}static off(){n.removeClass(v),f.removeClass(y),l.removeClass(C),d.removeClass(C),i.removeClass(C)}}class T{static on(){w.resultVisible||(w.on(),u.removeClass(C),c.addClass(C),w.resultVisible=!0)}static off(){w.resultVisible&&(p.empty(),m.hasClass(C)&&m.removeClass(C),u.addClass(C),c.removeClass(C),w.off(),g.val(""),w.resultVisible=!1)}}function x(){return n.hasClass(v)}!function(){const e=$(window),s=$("#back-to-top");e.on("scroll",(()=>{e.scrollTop()>50?s.fadeIn():s.fadeOut()})),s.on("click",(()=>{e.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((e=>new bootstrap.Tooltip(e))),0!==e.length&&e.off().on("click",(e=>{const s=$(e.target);let o=s.prop("tagName")==="button".toUpperCase()?s:s.parent();modeToggle.flipMode(),o.trigger("blur")})),$("#sidebar-trigger").on("click",a.toggle),$("#mask").on("click",a.toggle),i.on("click",(function(){k.on(),T.on(),g.trigger("focus")})),n.on("click",(function(){k.off(),T.off()})),g.on("focus",(function(){f.addClass(h)})),g.on("focusout",(function(){f.removeClass(h)})),g.on("input",(()=>{""===g.val()?x()?m.removeClass(C):T.off():(T.on(),x()&&m.addClass(C))}))}();

4
assets/js/dist/home.min.js vendored Normal file
View file

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const t=$(".mode-toggle");function e(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var s=a.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function a(t,a,s){return(a=e(a))in t?Object.defineProperty(t,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[a]=s,t}const s=$("body"),o="sidebar-display";class r{static toggle(){!1===r.isExpanded?s.attr(o,""):s.removeAttr(o),r.isExpanded=!r.isExpanded}}a(r,"isExpanded",!1);const i=$("#sidebar-trigger"),l=$("#search-trigger"),n=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),d=$("#topbar-title"),u=$("search"),m=$("#search-result-wrapper"),f=$("#search-results"),p=$("#search-input"),g=$("#search-hints"),h=$("html,body"),b="loaded",v="unloaded",C="input-focus",y="d-flex";class w{static on(){w.offset=window.scrollY,h.scrollTop(0)}static off(){h.scrollTop(w.offset)}}a(w,"offset",0),a(w,"resultVisible",!1);class T{static on(){i.addClass(v),d.addClass(v),l.addClass(v),u.addClass(y),n.addClass(b)}static off(){n.removeClass(b),u.removeClass(y),i.removeClass(v),d.removeClass(v),l.removeClass(v)}}class k{static on(){w.resultVisible||(w.on(),m.removeClass(v),c.addClass(v),w.resultVisible=!0)}static off(){w.resultVisible&&(f.empty(),g.hasClass(v)&&g.removeClass(v),m.addClass(v),c.removeClass(v),w.off(),p.val(""),w.resultVisible=!1)}}function x(){return n.hasClass(b)}$(".collapse");$(".code-header>button").children().attr("class");const E="data-src",j="data-lqip",M={SHIMMER:"shimmer",BLUR:"blur"};function A(t){$(this).parent().removeClass(t)}function F(){this.complete&&(this.hasAttribute(j)?A.call(this,M.BLUR):A.call(this,M.SHIMMER))}function R(){const t=$(this),e=t.attr(E);t.attr("src",encodeURI(e)),t.removeAttr(E)}class S{static get attrTimestamp(){return"data-ts"}static get attrDateFormat(){return"data-df"}static get locale(){return $("html").attr("lang").substring(0,2)}static getTimestamp(t){return Number(t.attr(S.attrTimestamp))}static getDateFormat(t){return t.attr(S.attrDateFormat)}}!function(){const t=$(window),e=$("#back-to-top");t.on("scroll",(()=>{t.scrollTop()>50?e.fadeIn():e.fadeOut()})),e.on("click",(()=>{t.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((t=>new bootstrap.Tooltip(t))),0!==t.length&&t.off().on("click",(t=>{const e=$(t.target);let a=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),a.trigger("blur")})),$("#sidebar-trigger").on("click",r.toggle),$("#mask").on("click",r.toggle),l.on("click",(function(){T.on(),k.on(),p.trigger("focus")})),n.on("click",(function(){T.off(),k.off()})),p.on("focus",(function(){u.addClass(C)})),p.on("focusout",(function(){u.removeClass(C)})),p.on("input",(()=>{""===p.val()?x()?g.removeClass(v):k.off():(k.on(),x()&&g.addClass(v))})),dayjs.locale(S.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(S.attrTimestamp,"]")).each((function(){const t=dayjs.unix(S.getTimestamp($(this))),e=t.format(S.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(S.attrTimestamp),$(this).removeAttr(S.attrDateFormat);const a=$(this).attr("data-bs-toggle");if(void 0===a||"tooltip"!==a)return;const s=t.format("llll");$(this).attr("data-bs-title",s),new bootstrap.Tooltip($(this))})),function(){const t=$("article img");t.length&&t.on("load",F),$('article img[loading="lazy"]').each((function(){this.complete&&A.call(this,M.SHIMMER)}));const e=$("article img[".concat(j,'="true"]'));e.length&&e.each(R)}()}();

4
assets/js/dist/misc.min.js vendored Normal file
View file

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const t=$(".mode-toggle");function e(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var s=a.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function a(t,a,s){return(a=e(a))in t?Object.defineProperty(t,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[a]=s,t}const s=$("body"),o="sidebar-display";class r{static toggle(){!1===r.isExpanded?s.attr(o,""):s.removeAttr(o),r.isExpanded=!r.isExpanded}}a(r,"isExpanded",!1);const l=$("#sidebar-trigger"),i=$("#search-trigger"),n=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),d=$("#topbar-title"),u=$("search"),f=$("#search-result-wrapper"),m=$("#search-results"),p=$("#search-input"),g=$("#search-hints"),b=$("html,body"),h="loaded",v="unloaded",C="input-focus",y="d-flex";class w{static on(){w.offset=window.scrollY,b.scrollTop(0)}static off(){b.scrollTop(w.offset)}}a(w,"offset",0),a(w,"resultVisible",!1);class T{static on(){l.addClass(v),d.addClass(v),i.addClass(v),u.addClass(y),n.addClass(h)}static off(){n.removeClass(h),u.removeClass(y),l.removeClass(v),d.removeClass(v),i.removeClass(v)}}class k{static on(){w.resultVisible||(w.on(),f.removeClass(v),c.addClass(v),w.resultVisible=!0)}static off(){w.resultVisible&&(m.empty(),g.hasClass(v)&&g.removeClass(v),f.addClass(v),c.removeClass(v),w.off(),p.val(""),w.resultVisible=!1)}}function x(){return n.hasClass(h)}$(".collapse");$(".code-header>button").children().attr("class");class j{static get attrTimestamp(){return"data-ts"}static get attrDateFormat(){return"data-df"}static get locale(){return $("html").attr("lang").substring(0,2)}static getTimestamp(t){return Number(t.attr(j.attrTimestamp))}static getDateFormat(t){return t.attr(j.attrDateFormat)}}!function(){const t=$(window),e=$("#back-to-top");t.on("scroll",(()=>{t.scrollTop()>50?e.fadeIn():e.fadeOut()})),e.on("click",(()=>{t.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((t=>new bootstrap.Tooltip(t))),0!==t.length&&t.off().on("click",(t=>{const e=$(t.target);let a=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),a.trigger("blur")})),$("#sidebar-trigger").on("click",r.toggle),$("#mask").on("click",r.toggle),i.on("click",(function(){T.on(),k.on(),p.trigger("focus")})),n.on("click",(function(){T.off(),k.off()})),p.on("focus",(function(){u.addClass(C)})),p.on("focusout",(function(){u.removeClass(C)})),p.on("input",(()=>{""===p.val()?x()?g.removeClass(v):k.off():(k.on(),x()&&g.addClass(v))})),dayjs.locale(j.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(j.attrTimestamp,"]")).each((function(){const t=dayjs.unix(j.getTimestamp($(this))),e=t.format(j.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(j.attrTimestamp),$(this).removeAttr(j.attrDateFormat);const a=$(this).attr("data-bs-toggle");if(void 0===a||"tooltip"!==a)return;const s=t.format("llll");$(this).attr("data-bs-title",s),new bootstrap.Tooltip($(this))}))}();

4
assets/js/dist/page.min.js vendored Normal file
View file

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const t=$(".mode-toggle");function e(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var s=o.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function o(t,o,s){return(o=e(o))in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}const s=$("body"),a="sidebar-display";class n{static toggle(){!1===n.isExpanded?s.attr(a,""):s.removeAttr(a),n.isExpanded=!n.isExpanded}}o(n,"isExpanded",!1);const r=$("#sidebar-trigger"),i=$("#search-trigger"),l=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),u=$("#topbar-title"),d=$("search"),f=$("#search-result-wrapper"),p=$("#search-results"),m=$("#search-input"),g=$("#search-hints"),h=$("html,body"),b="loaded",v="unloaded",C="input-focus",w="d-flex";class y{static on(){y.offset=window.scrollY,h.scrollTop(0)}static off(){h.scrollTop(y.offset)}}o(y,"offset",0),o(y,"resultVisible",!1);class k{static on(){r.addClass(v),u.addClass(v),i.addClass(v),d.addClass(w),l.addClass(b)}static off(){l.removeClass(b),d.removeClass(w),r.removeClass(v),u.removeClass(v),i.removeClass(v)}}class S{static on(){y.resultVisible||(y.on(),f.removeClass(v),c.addClass(v),y.resultVisible=!0)}static off(){y.resultVisible&&(p.empty(),g.hasClass(v)&&g.removeClass(v),f.addClass(v),c.removeClass(v),y.off(),m.val(""),y.resultVisible=!1)}}function T(){return l.hasClass(b)}$(".collapse");const E=".code-header>button",A="fas fa-check",x="timeout",M="data-title-succeed",R="data-bs-original-title",I=2e3;function V(t){if($(t)[0].hasAttribute(x)){let e=$(t).attr(x);if(Number(e)>Date.now())return!0}return!1}function q(t){$(t).attr(x,Date.now()+I)}function N(t){$(t).removeAttr(x)}const P=$(E).children().attr("class");const U="data-src",j="data-lqip",B={SHIMMER:"shimmer",BLUR:"blur"};function H(t){$(this).parent().removeClass(t)}function O(){this.complete&&(this.hasAttribute(j)?H.call(this,B.BLUR):H.call(this,B.SHIMMER))}function z(){const t=$(this),e=t.attr(U);t.attr("src",encodeURI(e)),t.removeAttr(U)}!function(){const t=$(window),e=$("#back-to-top");t.on("scroll",(()=>{t.scrollTop()>50?e.fadeIn():e.fadeOut()})),e.on("click",(()=>{t.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((t=>new bootstrap.Tooltip(t))),0!==t.length&&t.off().on("click",(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),o.trigger("blur")})),$("#sidebar-trigger").on("click",n.toggle),$("#mask").on("click",n.toggle),i.on("click",(function(){k.on(),S.on(),m.trigger("focus")})),l.on("click",(function(){k.off(),S.off()})),m.on("focus",(function(){d.addClass(C)})),m.on("focusout",(function(){d.removeClass(C)})),m.on("input",(()=>{""===m.val()?T()?g.removeClass(v):S.off():(S.on(),T()&&g.addClass(v))})),function(){const t=$("article img");t.length&&t.on("load",O),$('article img[loading="lazy"]').each((function(){this.complete&&H.call(this,B.SHIMMER)}));const e=$("article img[".concat(j,'="true"]'));e.length&&e.each(z)}(),$(".popup")<=0||$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),function(){if($(E).length){const t=new ClipboardJS(E,{target:t=>t.parentNode.nextElementSibling.querySelector("code .rouge-code")});[...document.querySelectorAll(E)].map((t=>new bootstrap.Tooltip(t,{placement:"left"}))),t.on("success",(t=>{t.clearSelection();const e=t.trigger;V(e)||(!function(t){$(t).children().attr("class",A)}(e),function(t){const e=$(t).attr(M);$(t).attr(R,e).tooltip("show")}(e),q(e),setTimeout((()=>{!function(t){$(t).tooltip("hide").removeAttr(R)}(e),function(t){$(t).children().attr("class",P)}(e),N(e)}),I))}))}const t=$("#copy-link");t.on("click",(t=>{let e=$(t.target);V(e)||navigator.clipboard.writeText(window.location.href).then((()=>{const t=e.attr(R),o=e.attr(M);e.attr(R,o).tooltip("show"),q(e),setTimeout((()=>{e.attr(R,t),N(e)}),I)}))})),t.on("mouseleave",(function(t){$(t.target).tooltip("hide")}))}()}();

4
assets/js/dist/post.min.js vendored Normal file

File diff suppressed because one or more lines are too long