You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alt: Responsive rendering of Chirpy theme on multiple devices.
14
13
---
15
14
16
15
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.
17
16
18
-
19
17
## Titles
20
18
---
21
19
# H1 - heading
@@ -26,7 +24,6 @@ This post is to show Markdown syntax rendering on [**Chirpy**](https://github.co
26
24
27
25
<h4>H4 - heading</h4>
28
26
---
29
-
<br>
30
27
31
28
## Paragraph
32
29
@@ -95,35 +92,49 @@ Moon
95
92
96
93
Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2].
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. Phasellus a tortor aliquam, tristique felis sit amet, elementum enim. Integer vestibulum vitae nulla nec pretium.
129
+
## Mathematics
130
+
131
+
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
132
+
133
+
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
122
134
123
-
- Float to right
135
+
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
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. Phasellus a tortor aliquam, tristique felis sit amet, elementum enim. Integer vestibulum vitae nulla nec pretium.
137
+
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
127
138
128
139
## Mermaid SVG
129
140
@@ -135,59 +146,37 @@ _shadow effect (visible in light mode)_
135
146
cherry :active, c, after b a, 1d
136
147
```
137
148
138
-
## Mathematics
139
-
140
-
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
149
+
## Images
141
150
142
-
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
151
+
### Default (with caption)
143
152
144
-
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
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.
153
164
154
-
Here is the `/path/to/the/file.extend`{: .filepath}.
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.
157
169
158
-
### Common
170
+
### Dark/Light mode & Shadow
159
171
160
-
```
161
-
This is a common code snippet, without syntax highlight and line number.
162
-
```
172
+
The image below will toggle dark/light mode based on theme preference, notice it has shadows.
Copy file name to clipboardExpand all lines: _posts/2019-08-08-write-a-new-post.md
+56-9Lines changed: 56 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ tags: [writing]
7
7
render_with_liquid: false
8
8
---
9
9
10
-
This post will guide you how to write a post on _Chirpy_theme. Even if you have previous experience with Jekyll, this article is worth reading, because many features require specific variables to be set.
10
+
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.
11
11
12
12
## Naming and Path
13
13
@@ -177,9 +177,18 @@ By default, the image is centered, but you can specify the position by using one
177
177
```
178
178
{: .nolineno}
179
179
180
+
### Dark/Light mode
181
+
182
+
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`):
@@ -220,7 +229,6 @@ When a post contains many images, it will be a time-consuming task to repeatedly
220
229
img_path: /img/path/
221
230
---
222
231
```
223
-
{: .nolineno }
224
232
225
233
And then, the image source of Markdown can write the file name directly:
226
234
@@ -238,28 +246,49 @@ The output will be:
238
246
239
247
### Preview Image
240
248
241
-
If you want to add an image to the top of the post contents, specify the attribute `path`, `width`, `height`, and `alt` for the image:
249
+
If you want to add an image at the top of the article, 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.
250
+
251
+
Knowing these prerequisites, you can start setting the image's attribute:
242
252
243
253
```yaml
244
254
---
245
255
image:
246
256
path: /path/to/image
247
-
width: 1000 # in pixels
248
-
height: 400 # in pixels
249
257
alt: image alternative text
250
258
---
251
259
```
252
260
253
-
Except for `alt`, all other options are necessary, especially the `width` and `height`, which are related to user experience and web page loading performance. The above section "[Size](#size)" also mentions this.
254
-
255
261
Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height`→ `h`, `width` → `w`. In addition, 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.
256
262
257
263
For simple use, you can also just use `image` to define the path.
258
264
259
265
```yml
266
+
---
260
267
image: /path/to/image
268
+
---
269
+
```
270
+
271
+
### LQIP
272
+
273
+
For preview images:
274
+
275
+
```yaml
276
+
---
277
+
image:
278
+
lqip: /path/to/lqip-file # or base64 URI
279
+
---
261
280
```
262
281
282
+
> You can observe LQIP in the preview image of post [_Text and Typography_](/posts/text-and-typography/).
0 commit comments