Skip to content

Commit 10a1ddd

Browse files
committed
feat: use custom caption img component for better display
1 parent 5a73208 commit 10a1ddd

File tree

9 files changed

+50
-39
lines changed

9 files changed

+50
-39
lines changed

assets/css/patch.css

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/* patch for list */
2+
main ul {
3+
margin-block: 0;
4+
padding-inline-start: 2rem;
5+
}
6+
17
/* patch for table */
28
table {
39
width: 100%;
@@ -13,30 +19,6 @@ table tr :is(th, td) {
1319
}
1420
}
1521

16-
/* images */
17-
main ul {
18-
margin-block: 0;
19-
padding-inline-start: 2rem;
20-
}
21-
22-
main img {
23-
border-radius: 1rem;
24-
}
25-
26-
img.right {
27-
float: none;
28-
width: 100%;
29-
}
30-
31-
@media (min-width: 40rem) {
32-
img.right {
33-
float: right;
34-
margin-left: 1rem;
35-
margin-bottom: 1rem;
36-
width: attr(data-width rem, 20rem);
37-
}
38-
}
39-
4022
/* patch for disabled link */
4123
.chapter-item div {
4224
color: var(--sidebar-fg);

assets/css/templates.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* img template */
2+
main img {
3+
border-radius: 1rem;
4+
}
5+
6+
.img-container {
7+
float: none;
8+
9+
& .caption {
10+
margin: 0;
11+
font-size: small;
12+
text-align: center;
13+
color: var(--icons);
14+
}
15+
}
16+
17+
@media (min-width: 40rem) {
18+
.img-container {
19+
float: right;
20+
padding-left: 1rem;
21+
padding-bottom: 1rem;
22+
width: attr(data-width rem, 20rem);
23+
}
24+
}

assets/templates/img.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="img-container" data-width="{% width=20 %}">
2+
<img src="{% src %}" alt="{% alt %}" />
3+
<p class="caption">{% alt %}</p>
4+
</div>

book.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mathjax-support = false
1717
no-section-label = false
1818
git-repository-url = "https://github.com/mr-addict/notes"
1919
edit-url-template = "https://github.com/mr-addict/notes/edit/main/{path}"
20-
additional-css = ["./assets/css/patch.css"]
20+
additional-css = ["./assets/css/patch.css","./assets/css/templates.css"]
2121

2222
[output.html.print]
2323
enable = true

src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# 我的笔记
22

3-
{% embed include file="README.md" type="insert" range="5-11" %}
3+
{% embed include file="README.md" type="raw" range="5-11" %}

src/life/entertainment/chiikawa/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
### 吉伊卡哇 (ちいかわ)
2222

23-
<img src="images/chiikawa.jpg" alt="Chiikawa" class="right" />
23+
{% embed img src="images/chiikawa.jpg" alt="Chiikawa" class="right" %}
2424

2525
- 别名:吉伊、小可爱
2626
- 物种:仓鼠
@@ -33,7 +33,7 @@
3333

3434
### 小八猫(ハチワレ)
3535

36-
<img src="images/hachiware.webp" alt="Hachiware" class="right" />
36+
{% embed img src="images/hachiware.webp" alt="Hachiware" class="right" %}
3737

3838
- 别名:小八、八字猫
3939
- 物种:奔驰猫
@@ -46,7 +46,7 @@
4646

4747
### 兔兔(うさぎ)
4848

49-
<img src="images/usagi.webp" alt="Usagi" class="right" />
49+
{% embed img src="images/usagi.webp" alt="Usagi" class="right" %}
5050

5151
- 别名:乌萨奇、兔子、537
5252
- 物种:兔子
@@ -61,7 +61,7 @@
6161

6262
### 小桃鼠(モモンガ)
6363

64-
<img src="images/momonga.gif" alt="Momonga" class="right" />
64+
{% embed img src="images/momonga.gif" alt="Momonga" class="right" %}
6565

6666
- 别名:飞鼠、小桃、莫莫咖、毛毛力
6767
- 物种:飞鼠
@@ -72,7 +72,7 @@
7272

7373
### 栗子馒头(栗まんじゅう)
7474

75-
<img src="images/kuri.webp" alt="Kuri" class="right" />
75+
{% embed img src="images/kuri.webp" alt="Kuri" class="right" %}
7676

7777
- 别名:栗子馒头前辈、布丁狗前辈
7878
- 物种:蜜獾
@@ -83,7 +83,7 @@
8383

8484
### 海獭(ラッコ)
8585

86-
<img src="images/lakko.gif" alt="Lakko" class="right" />
86+
{% embed img src="images/lakko.gif" alt="Lakko" class="right" %}
8787

8888
- 别名:海獭勇者、海獭师傅、师傅、獭师
8989
- 物种:海獭

src/life/entertainment/sanrio/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515
> [帕恰狗](https://zh.wikipedia.org/wiki/帕恰狗)
1616
17-
<img src="images/pochacco.png" alt="Pochacco" class="right" />
17+
{% embed img src="images/pochacco.png" alt="Pochacco" class="right" %}
1818

1919
- 名称:Pochacco、帕恰狗
2020
- 物种:狗
@@ -29,7 +29,7 @@
2929
>
3030
> [Hello Kitty](https://zh.wikipedia.org/wiki/Hello_Kitty)
3131
32-
<img src="images/hello-kitty.png" alt="Hello Kitty" class="right" />
32+
{% embed img src="images/hello-kitty.png" alt="Hello Kitty" class="right" %}
3333

3434
- 名称:Hello Kitty,凯蒂猫、无口猫
3535
- 物种:猫/人(2015 年,三丽鸥发表新设定,指出:Hello Kitty 并不是猫。她走路是用两只脚,从来没有四只脚走路,并没有猫的行为特性,与过往设定并不相同。)
@@ -43,7 +43,7 @@
4343
>
4444
> [My Melody](https://zh.wikipedia.org/wiki/My_Melody)
4545
46-
<img src="images/my-melody.png" alt="My Melody" class="right" />
46+
{% embed img src="images/my-melody.png" alt="My Melody" class="right" %}
4747

4848
- 名称:Little Red Riding Hood、My Melody、美乐蒂
4949
- 物种:兔子
@@ -59,7 +59,7 @@
5959
>
6060
> [酷洛米](https://zh.wikipedia.org/wiki/酷洛米)
6161
62-
<img src="images/kuromi.png" alt="Kuromi" class="right" />
62+
{% embed img src="images/kuromi.png" alt="Kuromi" class="right" %}
6363

6464
- 名称:Kuromi、酷洛米
6565
- 物种:兔子
@@ -75,7 +75,7 @@
7575
>
7676
> [玉桂狗](https://zh.wikipedia.org/wiki/玉桂狗)
7777
78-
<img src="images/cinnamoroll.png" alt="Cinnamoroll" class="right" />
78+
{% embed img src="images/cinnamoroll.png" alt="Cinnamoroll" class="right" %}
7979

8080
- 名称:Cinnamoroll、玉桂狗、肉桂狗
8181
- 物种:狗
@@ -94,7 +94,7 @@
9494
>
9595
> [布丁狗](https://zh.wikipedia.org/wiki/布丁狗)
9696
97-
<img src="images/pom-pom-purin.png" alt="Pom Pom Purin" class="right" />
97+
{% embed img src="images/pom-pom-purin.png" alt="Pom Pom Purin" class="right" %}
9898

9999
- 名称:Pom Pom Purin、布丁狗
100100
- 物种:黄金猎犬(黄金寻回犬,Golden Retriever)

src/life/studio/disney/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 迪士尼

src/life/studio/pixar/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 一、简介
44

5-
<img src="images/pixar-lamp.webp" alt="Pixar Lamp" class="right" data-width="34" />
5+
{% embed img src="images/pixar-lamp.webp" alt="小台灯是皮克斯的经典标识" width="34" %}
66

77
皮克斯动画工作室(Pixar Animation Studios),简称皮克斯(英语:Pixar),其总部位于美国加利福尼亚州的埃默里维尔,是一家以**计算机动画制作**而闻名的动画电影制片公司。
88

0 commit comments

Comments
 (0)