Update docs

This commit is contained in:
Cotes Chung 2021-09-16 00:26:35 +08:00
parent beabb36d7f
commit f722757f6f
4 changed files with 41 additions and 46 deletions

View file

@ -176,44 +176,23 @@ SHELL=/usr/local/bin/bash
PYENV_SHELL=bash PYENV_SHELL=bash
``` ```
#### Ruby
```ruby
def sum_eq_n?(arr, n)
return true if arr.empty? && n == 0
arr.product(arr).reject { |a,b| a == b }.any? { |a,b| a + b == n }
end
```
#### Shell #### Shell
```shell ```bash
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "The command was not successful."; echo "The command was not successful.";
#do the needful / exit #do the needful / exit
fi; fi;
``` ```
#### Liquid ### Specific filename
{% raw %} ```sass
```liquid @import
{% if product.title contains 'Pack' %} "colors/light-typography",
This product's title contains the word Pack. "colors/dark-typography"
{% endif %}
```
{% endraw %}
#### Java
```java
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
// Write out any hidden serialization magic
s.defaultWriteObject();
for (E e: map.keySet()) s.writeObject(e);
}
``` ```
{: file='_sass/jekyll-theme-chirpy.scss'}
## Reverse Footnote ## Reverse Footnote

View file

@ -4,6 +4,7 @@ author: Cotes Chung
date: 2019-08-08 14:10:00 +0800 date: 2019-08-08 14:10:00 +0800
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [writing] tags: [writing]
render_with_liquid: false
--- ---
## Naming and Path ## Naming and Path
@ -163,7 +164,7 @@ If you host the images on the CDN, you can save the time of repeatedly writing t
```yaml ```yaml
img_cdn: https://cdn.com img_cdn: https://cdn.com
``` ```
{: .nolineno} {: 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 `/`. 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 `/`.
@ -193,30 +194,27 @@ pin: true
## Code Block ## Code Block
Markdown symbols ```` ``` ```` can easily create a code block as following examples. Markdown symbols ```` ``` ```` can easily create a code block as follows:
``` ```
This is a common code snippet, without syntax highlight and line number. This is a plaintext code snippet.
``` ```
### Specific Language ### Specifying Language
Using ```` ```language ```` you will get code snippets with line numbers and syntax highlight. Using ```` ```{language} ```` you will get a code block with syntax highlight:
> **Note**: The Jekyll style `{% raw %}{%{% endraw %} highlight LANGUAGE {% raw %}%}{% endraw %}` or `{% raw %}{%{% endraw %} highlight LANGUAGE linenos {% raw %}%}{% endraw %}` are not allowed to be used in this theme !
````markdown
```yaml ```yaml
# Yaml code snippet key: value
items:
- part_no: A4786
descrip: Water Bucket (Filled)
price: 1.47
quantity: 4
``` ```
````
### Hiding Line Number > **Limination**: The Jekyll style `highlight` tag ais not compatible with this theme.
When you want to hide the line number of the code block, you can append `{: .nolineno}` at the next line of it: ### Line Number
By default, all languages except `plaintext`, `console` and `terminal` will display line numbers. When you want to hide the line number of the code block, you can append `{: .nolineno}` at the next line:
````markdown ````markdown
```shell ```shell
@ -225,10 +223,22 @@ echo 'No more line numbers!'
{: .nolineno} {: .nolineno}
```` ````
### Specifying the Filename
You may have noticed that the code language will be displayed on the left side of the header 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 ### Liquid Codes
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}{%{% endraw %} raw {%raw%}%}{%endraw%}` and `{% raw %}{%{% endraw %} endraw {%raw%}%}{%endraw%}` . If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:
````markdown
{% raw %} {% raw %}
```liquid ```liquid
{% if product.title contains 'Pack' %} {% if product.title contains 'Pack' %}
@ -236,6 +246,9 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{%
{% endif %} {% endif %}
``` ```
{% endraw %} {% endraw %}
````
Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block.
## Learn More ## Learn More

View file

@ -25,14 +25,14 @@ Add this line to your Jekyll site's `Gemfile`:
```ruby ```ruby
gem "jekyll-theme-chirpy" gem "jekyll-theme-chirpy"
``` ```
{: .nolineno} {: .nolineno file='Gemfile' }
And add this line to your Jekyll site's `_config.yml`: And add this line to your Jekyll site's `_config.yml`:
```yaml ```yaml
theme: jekyll-theme-chirpy theme: jekyll-theme-chirpy
``` ```
{: .nolineno} {: .nolineno file='_config.yml' }
And then execute: And then execute:

View file

@ -45,6 +45,7 @@ google_analytics:
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
cache_path: # the local PV cache data, friendly to visitors from GFW region cache_path: # the local PV cache data, friendly to visitors from GFW region
``` ```
{: file="_config.yml"}
When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pickup your changes. You should now be able to monitor your traffic in realtime. When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pickup your changes. You should now be able to monitor your traffic in realtime.
@ -140,6 +141,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
# XSRF Settings # XSRF Settings
XSRF_KEY = 'OnceUponATimeThereLivedALegend' XSRF_KEY = 'OnceUponATimeThereLivedALegend'
``` ```
{: file="src/config.py"}
**Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL. **Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL.
@ -226,6 +228,7 @@ google_analytics:
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>' proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
cache_path: # the local PV cache data, friendly to visitors from GFW region cache_path: # the local PV cache data, friendly to visitors from GFW region
``` ```
{: file="_config.yml"}
Now, you should see the Page View enabled on your blog. Now, you should see the Page View enabled on your blog.