Skip to content

Commit f722757

Browse files
committed
Update docs
1 parent beabb36 commit f722757

File tree

4 files changed

+41
-46
lines changed

4 files changed

+41
-46
lines changed

_posts/2019-08-08-text-and-typography.md

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -176,44 +176,23 @@ SHELL=/usr/local/bin/bash
176176
PYENV_SHELL=bash
177177
```
178178

179-
#### Ruby
180-
181-
```ruby
182-
def sum_eq_n?(arr, n)
183-
return true if arr.empty? && n == 0
184-
arr.product(arr).reject { |a,b| a == b }.any? { |a,b| a + b == n }
185-
end
186-
```
187-
188179
#### Shell
189180

190-
```shell
181+
```bash
191182
if [ $? -ne 0 ]; then
192183
echo "The command was not successful.";
193184
#do the needful / exit
194185
fi;
195186
```
196187

197-
#### Liquid
198-
199-
{% raw %}
200-
```liquid
201-
{% if product.title contains 'Pack' %}
202-
This product's title contains the word Pack.
203-
{% endif %}
204-
```
205-
{% endraw %}
206-
207-
#### Java
188+
### Specific filename
208189

209-
```java
210-
private void writeObject(java.io.ObjectOutputStream s)
211-
throws java.io.IOException {
212-
// Write out any hidden serialization magic
213-
s.defaultWriteObject();
214-
for (E e: map.keySet()) s.writeObject(e);
215-
}
190+
```sass
191+
@import
192+
"colors/light-typography",
193+
"colors/dark-typography"
216194
```
195+
{: file='_sass/jekyll-theme-chirpy.scss'}
217196

218197
## Reverse Footnote
219198

_posts/2019-08-08-write-a-new-post.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ author: Cotes Chung
44
date: 2019-08-08 14:10:00 +0800
55
categories: [Blogging, Tutorial]
66
tags: [writing]
7+
render_with_liquid: false
78
---
89

910
## Naming and Path
@@ -163,7 +164,7 @@ If you host the images on the CDN, you can save the time of repeatedly writing t
163164
```yaml
164165
img_cdn: https://cdn.com
165166
```
166-
{: .nolineno}
167+
{: file='_config.yml' .nolineno}
167168

168169
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 `/`.
169170

@@ -193,30 +194,27 @@ pin: true
193194

194195
## Code Block
195196

196-
Markdown symbols ```` ``` ```` can easily create a code block as following examples.
197+
Markdown symbols ```` ``` ```` can easily create a code block as follows:
197198

198199
```
199-
This is a common code snippet, without syntax highlight and line number.
200+
This is a plaintext code snippet.
200201
```
201202

202-
### Specific Language
203-
204-
Using ```` ```language ```` you will get code snippets with line numbers and syntax highlight.
203+
### Specifying Language
205204

206-
> **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 !
205+
Using ```` ```{language} ```` you will get a code block with syntax highlight:
207206

207+
````markdown
208208
```yaml
209-
# Yaml code snippet
210-
items:
211-
- part_no: A4786
212-
descrip: Water Bucket (Filled)
213-
price: 1.47
214-
quantity: 4
209+
key: value
215210
```
211+
````
216212

217-
### Hiding Line Number
213+
> **Limination**: The Jekyll style `highlight` tag ais not compatible with this theme.
218214

219-
When you want to hide the line number of the code block, you can append `{: .nolineno}` at the next line of it:
215+
### Line Number
216+
217+
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:
220218

221219
````markdown
222220
```shell
@@ -225,17 +223,32 @@ echo 'No more line numbers!'
225223
{: .nolineno}
226224
````
227225

226+
### Specifying the Filename
227+
228+
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:
229+
230+
````markdown
231+
```shell
232+
# content
233+
```
234+
{: file="path/to/file" }
235+
````
236+
228237
### Liquid Codes
229238

230-
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}{%{% endraw %} raw {%raw%}%}{%endraw%}` and `{% raw %}{%{% endraw %} endraw {%raw%}%}{%endraw%}` .
239+
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:
231240

241+
````markdown
232242
{% raw %}
233243
```liquid
234244
{% if product.title contains 'Pack' %}
235245
This product's title contains the word Pack.
236246
{% endif %}
237247
```
238248
{% endraw %}
249+
````
250+
251+
Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block.
239252

240253
## Learn More
241254

_posts/2019-08-09-getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Add this line to your Jekyll site's `Gemfile`:
2525
```ruby
2626
gem "jekyll-theme-chirpy"
2727
```
28-
{: .nolineno}
28+
{: .nolineno file='Gemfile' }
2929

3030
And add this line to your Jekyll site's `_config.yml`:
3131

3232
```yaml
3333
theme: jekyll-theme-chirpy
3434
```
35-
{: .nolineno}
35+
{: .nolineno file='_config.yml' }
3636
3737
And then execute:
3838

_posts/2021-01-03-enable-google-pv.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ google_analytics:
4545
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
4646
cache_path: # the local PV cache data, friendly to visitors from GFW region
4747
```
48+
{: file="_config.yml"}
4849
4950
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.
5051
@@ -140,6 +141,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
140141
# XSRF Settings
141142
XSRF_KEY = 'OnceUponATimeThereLivedALegend'
142143
```
144+
{: file="src/config.py"}
143145

144146
**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.
145147

@@ -226,6 +228,7 @@ google_analytics:
226228
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
227229
cache_path: # the local PV cache data, friendly to visitors from GFW region
228230
```
231+
{: file="_config.yml"}
229232

230233
Now, you should see the Page View enabled on your blog.
231234

0 commit comments

Comments
 (0)