Merge branch 'feature/filepath-code'
This commit is contained in:
commit
3d8184602b
8 changed files with 69 additions and 41 deletions
|
@ -165,6 +165,10 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
|
|||
|
||||
This is an example of `Inline Code`.
|
||||
|
||||
## Filepath
|
||||
|
||||
Here is the `/path/to/the/file.extend`{: .filepath}.
|
||||
|
||||
## Code block
|
||||
|
||||
### Common
|
||||
|
|
|
@ -13,7 +13,7 @@ This post will guide you how to write a post on _Chirpy_ theme. Even if you have
|
|||
|
||||
## Naming and Path
|
||||
|
||||
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION` and put it in the `_posts` of the root directory. Please note that the `EXTENSION` must be one of `md` and `markdown`. 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.
|
||||
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
|
||||
|
||||
|
@ -33,7 +33,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_ but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`.
|
||||
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
|
||||
|
||||
|
@ -60,7 +60,7 @@ author:
|
|||
|
||||
## 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_ 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/):
|
||||
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
|
||||
---
|
||||
|
@ -70,7 +70,7 @@ toc: false
|
|||
|
||||
## Comments
|
||||
|
||||
The global switch of comments is defined by variable `comments.active` in the file _\_config.yml_. After selecting a comment system for this variable, comments will be turned on for all posts.
|
||||
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:
|
||||
|
||||
|
@ -171,7 +171,7 @@ The screenshots of the program window can be considered to show the shadow effec
|
|||
|
||||
### 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_ file:
|
||||
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
|
||||
|
@ -269,7 +269,23 @@ There are three types of prompts, `note`, `warning` and `danger`. When writing,
|
|||
{: .prompt-danger }
|
||||
```
|
||||
|
||||
## Code Block
|
||||
## 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:
|
||||
|
||||
|
@ -279,7 +295,7 @@ This is a plaintext code snippet.
|
|||
```
|
||||
````
|
||||
|
||||
### Specifying Language
|
||||
#### Specifying Language
|
||||
|
||||
Using ```` ```{language} ```` you will get a code block with syntax highlight:
|
||||
|
||||
|
@ -292,7 +308,7 @@ key: value
|
|||
> The Jekyll tag `{% highlight %}` is not compatible with this theme.
|
||||
{: .prompt-danger }
|
||||
|
||||
### Line Number
|
||||
#### 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:
|
||||
|
||||
|
@ -303,7 +319,7 @@ echo 'No more line numbers!'
|
|||
{: .nolineno }
|
||||
````
|
||||
|
||||
### Specifying the Filename
|
||||
#### 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:
|
||||
|
||||
|
@ -314,7 +330,7 @@ You may have noticed that the code language will be displayed at the top of the
|
|||
{: file="path/to/file" }
|
||||
````
|
||||
|
||||
### Liquid Codes
|
||||
#### Liquid Codes
|
||||
|
||||
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:
|
||||
|
||||
|
|
|
@ -42,13 +42,13 @@ $ bash tools/init.sh
|
|||
The above command will:
|
||||
|
||||
1. Removes some files or directories from your repository:
|
||||
- `.travis.yml`
|
||||
- files under `_posts`
|
||||
- folder `docs`
|
||||
- `.travis.yml`{: .filepath}
|
||||
- files under `_posts`{: .filepath}
|
||||
- folder `docs`{: .filepath}
|
||||
|
||||
2. If the option `--no-gh` is provided, the directory `.github` will be deleted. Otherwise, set up the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`.
|
||||
2. If the option `--no-gh` is provided, the directory `.github`{: .filepath} will be deleted. Otherwise, set up the GitHub Action workflow by removing the extension `.hook`{: .filepath} of `.github/workflows/pages-deploy.yml.hook`{: .filepath}, and then remove the other files and directories in the folder `.github`{: .filepath}.
|
||||
|
||||
3. Removes item `Gemfile.lock` from `.gitignore`.
|
||||
3. Removes item `Gemfile.lock` from `.gitignore`{: .filepath}.
|
||||
|
||||
4. Creates a new commit to save the changes automatically.
|
||||
|
||||
|
@ -64,7 +64,7 @@ $ bundle
|
|||
|
||||
### Configuration
|
||||
|
||||
Update the variables of `_config.yml` as needed. Some of them are typical options:
|
||||
Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options:
|
||||
|
||||
- `url`
|
||||
- `avatar`
|
||||
|
@ -73,9 +73,9 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
|
|||
|
||||
### Customing Stylesheet
|
||||
|
||||
If you need to customize the stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file.
|
||||
If you need to customize the stylesheet, copy the theme's `assets/css/style.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of the style file.
|
||||
|
||||
Starting from [`v4.1.0`][chirpy-4.1.0], if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it.
|
||||
Starting from [`v4.1.0`][chirpy-4.1.0], if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, create a new file `_sass/variables-hook.scss`{: .filepath} and assign new values to the target variable in it.
|
||||
|
||||
### Running Local Server
|
||||
|
||||
|
@ -98,7 +98,7 @@ After a while, the local service will be published at _<http://127.0.0.1:4000>_.
|
|||
|
||||
## Deployment
|
||||
|
||||
Before the deployment begins, check out the file `_config.yml` 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`.
|
||||
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.
|
||||
|
||||
|
@ -108,11 +108,11 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
|
|||
|
||||
Quickly check the files needed for GitHub Actions build:
|
||||
|
||||
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
|
||||
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`{: .filepath}. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
|
||||
|
||||
- Ensure your Jekyll site has file `tools/deploy.sh`. Otherwise, copy it from here to your Jekyll site.
|
||||
- Ensure your Jekyll site has file `tools/deploy.sh`{: .filepath}. Otherwise, copy it from here to your Jekyll site.
|
||||
|
||||
- Furthermore, if you have committed `Gemfile.lock` to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lock file:
|
||||
- Furthermore, if you have committed `Gemfile.lock`{: .filepath} to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lock file:
|
||||
|
||||
```console
|
||||
$ bundle lock --add-platform x86_64-linux
|
||||
|
@ -150,13 +150,13 @@ $ docker run -it --rm \
|
|||
jekyll build
|
||||
```
|
||||
|
||||
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to the target server.
|
||||
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.
|
||||
|
||||
## Upgrading
|
||||
|
||||
It depends on how you use the theme:
|
||||
|
||||
- If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`), editing the `Gemfile` and update the version number of the theme gem, for example:
|
||||
- If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`{: .filepath}), editing the `Gemfile`{: .filepath} and update the version number of the theme gem, for example:
|
||||
|
||||
```diff
|
||||
- gem "jekyll-theme-chirpy", "~> 3.2", ">= 3.2.1"
|
||||
|
@ -172,7 +172,7 @@ It depends on how you use the theme:
|
|||
|
||||
As the version upgrades, the critical files (for details, see the [Startup Template][starter]) and configuration options will change. Please refer to the [Upgrade Guide](https://github.com/cotes2020/jekyll-theme-chirpy/wiki/Upgrade-Guide) to keep your repo's files in sync with the latest version of the theme.
|
||||
|
||||
- If you forked from the source project (there will be `gemspec` in the `Gemfile` of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade.
|
||||
- If you forked from the source project (there will be `gemspec` in the `Gemfile`{: .filepath} of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade.
|
||||
The merge is likely to conflict with your local modifications. Please be patient and careful to resolve these conflicts.
|
||||
|
||||
[starter]: https://github.com/cotes2020/chirpy-starter
|
||||
|
|
|
@ -8,7 +8,7 @@ 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/`. You may want to replace them with your own. The following sections will guide you to create and replace the default favicons.
|
||||
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
|
||||
|
||||
|
@ -20,10 +20,10 @@ In the next step, the webpage will show all usage scenarios. You can keep the de
|
|||
|
||||
Download the generated package, unzip and delete the following two from the extracted files:
|
||||
|
||||
- `browserconfig.xml`
|
||||
- `site.webmanifest`
|
||||
- `browserconfig.xml`{: .filepath}
|
||||
- `site.webmanifest`{: .filepath}
|
||||
|
||||
And then copy the remaining image files (`PNG` and `ICO`) to cover the original files in the directory `assets/img/favicons/` of your Jekyll site. If your Jekyll site doesn't have this directory yet, just create one.
|
||||
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:
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ It should look like this:
|
|||
|
||||
![google-analytics-data-stream](/posts/20210103/01-google-analytics-data-stream.png){: width="1086" height="542"}
|
||||
|
||||
Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml` file
|
||||
Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml`{: .filepath} file:
|
||||
|
||||
```yaml
|
||||
google_analytics:
|
||||
|
@ -115,16 +115,16 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
|
|||
|
||||
1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local.
|
||||
|
||||
2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file:
|
||||
2. Remove the first 2 lines in the [`src/app.yaml`{: .filepath}](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file:
|
||||
|
||||
```diff
|
||||
- application: your-project-id
|
||||
- version: 1
|
||||
```
|
||||
|
||||
3. In `src/config.py`, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from your App Engine Dashboard.
|
||||
3. In `src/config.py`{: .filepath}, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from your App Engine Dashboard.
|
||||
|
||||
4. Enter any random key for `XSRF_KEY`, your `config.py` should look similar to this
|
||||
4. Enter any random key for `XSRF_KEY`, your `config.py`{: .filepath} should look similar to this
|
||||
|
||||
```python
|
||||
#!/usr/bin/python2.7
|
||||
|
@ -150,7 +150,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
|
|||
> But, for the sake of keeping it simple, we will be using the Google provided default URL.
|
||||
{: .prompt-note }
|
||||
|
||||
5. From inside the src/ directory, deploy the app
|
||||
5. From inside the `src/`{: .filepath} directory, deploy the app
|
||||
|
||||
```console
|
||||
[root@bc96abf71ef8 src]# gcloud app deploy
|
||||
|
@ -223,7 +223,7 @@ Once all the hard part is done, it is very easy to enable the Page View on Chirp
|
|||
|
||||
![superproxy-dashboard](/posts/20210103/05-superproxy-dashboard.png){: width="1210" height="694"}
|
||||
|
||||
Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
|
||||
Update the `_config.yml`{: .filepath} file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
|
||||
|
||||
```yaml
|
||||
google_analytics:
|
||||
|
|
|
@ -108,11 +108,18 @@ code {
|
|||
padding: 3px 5px;
|
||||
border-radius: 4px;
|
||||
background-color: var(--inline-code-bg);
|
||||
}
|
||||
|
||||
blockquote[class^="prompt-"] & {
|
||||
[class^="prompt-"] & {
|
||||
background-color: var(--prompt-code-bg);
|
||||
color: var(--prompt-code-text-color);
|
||||
}
|
||||
|
||||
&.filepath {
|
||||
background-color: inherit;
|
||||
color: var(--filepath-text-color);
|
||||
font-weight: 600;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a > &.highlighter-rouge {
|
||||
|
@ -124,7 +131,7 @@ code {
|
|||
border-bottom: none;
|
||||
}
|
||||
|
||||
blockquote &.highlighter-rouge {
|
||||
blockquote & {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
--code-header-muted-color: rgb(60 60 60);
|
||||
--code-header-icon-color: rgb(86 86 86);
|
||||
--clipboard-checked-color: #2bcc2b;
|
||||
--filepath-text-color: #bdbdbd;
|
||||
|
||||
/* the code of prompts */
|
||||
--prompt-code-bg: rgb(38 38 38 / 47%);
|
||||
|
|
|
@ -4,5 +4,5 @@ icon: fas fa-info-circle
|
|||
order: 4
|
||||
---
|
||||
|
||||
> Add Markdown syntax content to file `_tabs/about.md` and it will show up on this page.
|
||||
> Add Markdown syntax content to file `_tabs/about.md`{: .filepath } and it will show up on this page.
|
||||
{: .prompt-note }
|
||||
|
|
Loading…
Reference in a new issue