@jet-w/astro-blog 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ATRISB7B.js +206 -0
- package/dist/chunk-HVQKQN6B.js +145 -0
- package/dist/config/index.d.ts +3 -47
- package/dist/config/index.js +18 -2
- package/dist/i18n-5H4W145i.d.ts +202 -0
- package/dist/index.d.ts +186 -7
- package/dist/index.js +238 -3
- package/dist/integration.d.ts +9 -1
- package/dist/integration.js +2 -1
- package/dist/{sidebar-DNdiCKBw.d.ts → sidebar-Da-W_4Lr.d.ts} +1 -1
- package/dist/utils/sidebar.d.ts +1 -1
- package/package.json +4 -3
- package/src/components/layout/Footer.astro +36 -20
- package/src/components/layout/Header.astro +69 -15
- package/src/components/layout/Sidebar.astro +27 -15
- package/src/components/ui/LanguageSwitcher.vue +183 -0
- package/src/layouts/BaseLayout.astro +77 -52
- package/src/layouts/PageLayout.astro +22 -27
- package/src/layouts/SlidesLayout.astro +14 -2
- package/src/pages/rss.xml.ts +18 -6
- package/templates/default/astro.config.mjs +22 -2
- package/templates/default/content/posts/blog_docs/12-i18n.md +355 -0
- package/templates/default/content/posts/blog_docs/README.md +1 -0
- package/templates/default/content/posts/blog_docs_en/README.md +78 -0
- package/templates/default/content/posts/blog_docs_en/config/01-site.md +208 -0
- package/templates/default/content/posts/blog_docs_en/config/02-sidebar.md +240 -0
- package/templates/default/content/posts/blog_docs_en/config/03-i18n.md +285 -0
- package/templates/default/content/posts/blog_docs_en/config/README.md +85 -0
- package/templates/default/content/posts/blog_docs_en/get-started/01-intro.md +81 -0
- package/templates/default/content/posts/blog_docs_en/get-started/02-install.md +137 -0
- package/templates/default/content/posts/blog_docs_en/get-started/03-create-post.md +176 -0
- package/templates/default/content/posts/blog_docs_en/get-started/04-structure.md +173 -0
- package/templates/default/content/posts/blog_docs_en/get-started/05-deploy.md +197 -0
- package/templates/default/content/posts/blog_docs_en/get-started/README.md +52 -0
- package/templates/default/content/posts/blog_docs_en/guide/README.md +59 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/01-mermaid.md +194 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/02-latex.md +233 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/03-video.md +184 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/04-icons.md +227 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/README.md +51 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/02-containers.md +226 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/03-code-blocks.md +206 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/README.md +194 -0
- package/templates/default/package-lock.json +9667 -0
- package/templates/default/package.json +1 -1
- package/templates/default/src/config/footer.ts +14 -11
- package/templates/default/src/config/locales/en/footer.ts +17 -0
- package/templates/default/src/config/locales/en/index.ts +16 -0
- package/templates/default/src/config/locales/en/menu.ts +12 -0
- package/templates/default/src/config/locales/en/sidebar.ts +18 -0
- package/templates/default/src/config/locales/en/site.ts +7 -0
- package/templates/default/src/config/locales/index.ts +7 -0
- package/templates/default/src/config/locales/zh-CN/footer.ts +17 -0
- package/templates/default/src/config/locales/zh-CN/index.ts +16 -0
- package/templates/default/src/config/locales/zh-CN/menu.ts +12 -0
- package/templates/default/src/config/locales/zh-CN/sidebar.ts +18 -0
- package/templates/default/src/config/locales/zh-CN/site.ts +7 -0
- package/templates/default/src/config/sidebar.ts +10 -12
- package/templates/default/src/env.d.ts +7 -0
- package/dist/chunk-MQXPSOYB.js +0 -124
- /package/dist/{chunk-GYLSY3OJ.js → chunk-AZHCNNAC.js} +0 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Icons
|
|
3
|
+
description: Use icons from Font Awesome, Material, Remix, and Bootstrap
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- Icons
|
|
10
|
+
- Design
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Icons
|
|
14
|
+
|
|
15
|
+
Add visual elements with icons from multiple popular libraries.
|
|
16
|
+
|
|
17
|
+
## Available Libraries
|
|
18
|
+
|
|
19
|
+
| Library | Prefix | Icons |
|
|
20
|
+
|---------|--------|-------|
|
|
21
|
+
| Font Awesome | `fa-` | 2000+ |
|
|
22
|
+
| Material Icons | `material-icons` | 2500+ |
|
|
23
|
+
| Remix Icon | `ri-` | 2400+ |
|
|
24
|
+
| Bootstrap Icons | `bi-` | 2000+ |
|
|
25
|
+
| Ionicons | `ion-` | 1300+ |
|
|
26
|
+
|
|
27
|
+
## Font Awesome
|
|
28
|
+
|
|
29
|
+
### Solid Icons
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<i class="fas fa-home"></i>
|
|
33
|
+
<i class="fas fa-star"></i>
|
|
34
|
+
<i class="fas fa-heart"></i>
|
|
35
|
+
<i class="fas fa-user"></i>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
<i class="fas fa-home"></i> <i class="fas fa-star"></i> <i class="fas fa-heart"></i> <i class="fas fa-user"></i>
|
|
39
|
+
|
|
40
|
+
### Regular Icons
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<i class="far fa-star"></i>
|
|
44
|
+
<i class="far fa-heart"></i>
|
|
45
|
+
<i class="far fa-comment"></i>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
<i class="far fa-star"></i> <i class="far fa-heart"></i> <i class="far fa-comment"></i>
|
|
49
|
+
|
|
50
|
+
### Brand Icons
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<i class="fab fa-github"></i>
|
|
54
|
+
<i class="fab fa-twitter"></i>
|
|
55
|
+
<i class="fab fa-linkedin"></i>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
<i class="fab fa-github"></i> <i class="fab fa-twitter"></i> <i class="fab fa-linkedin"></i>
|
|
59
|
+
|
|
60
|
+
## Material Icons
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<span class="material-icons">home</span>
|
|
64
|
+
<span class="material-icons">favorite</span>
|
|
65
|
+
<span class="material-icons">settings</span>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
<span class="material-icons">home</span> <span class="material-icons">favorite</span> <span class="material-icons">settings</span>
|
|
69
|
+
|
|
70
|
+
### Outlined Style
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<span class="material-icons-outlined">home</span>
|
|
74
|
+
<span class="material-icons-outlined">favorite</span>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
<span class="material-icons-outlined">home</span> <span class="material-icons-outlined">favorite</span>
|
|
78
|
+
|
|
79
|
+
### Rounded Style
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<span class="material-icons-round">home</span>
|
|
83
|
+
<span class="material-icons-round">favorite</span>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
<span class="material-icons-round">home</span> <span class="material-icons-round">favorite</span>
|
|
87
|
+
|
|
88
|
+
## Remix Icon
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<i class="ri-home-line"></i>
|
|
92
|
+
<i class="ri-home-fill"></i>
|
|
93
|
+
<i class="ri-star-line"></i>
|
|
94
|
+
<i class="ri-star-fill"></i>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
<i class="ri-home-line"></i> <i class="ri-home-fill"></i> <i class="ri-star-line"></i> <i class="ri-star-fill"></i>
|
|
98
|
+
|
|
99
|
+
### Common Icons
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<i class="ri-github-fill"></i>
|
|
103
|
+
<i class="ri-twitter-fill"></i>
|
|
104
|
+
<i class="ri-code-line"></i>
|
|
105
|
+
<i class="ri-terminal-box-line"></i>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
<i class="ri-github-fill"></i> <i class="ri-twitter-fill"></i> <i class="ri-code-line"></i> <i class="ri-terminal-box-line"></i>
|
|
109
|
+
|
|
110
|
+
## Bootstrap Icons
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<i class="bi bi-house"></i>
|
|
114
|
+
<i class="bi bi-star"></i>
|
|
115
|
+
<i class="bi bi-heart"></i>
|
|
116
|
+
<i class="bi bi-github"></i>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
<i class="bi bi-house"></i> <i class="bi bi-star"></i> <i class="bi bi-heart"></i> <i class="bi bi-github"></i>
|
|
120
|
+
|
|
121
|
+
## Ionicons
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<ion-icon name="home"></ion-icon>
|
|
125
|
+
<ion-icon name="star"></ion-icon>
|
|
126
|
+
<ion-icon name="heart"></ion-icon>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
<ion-icon name="home"></ion-icon> <ion-icon name="star"></ion-icon> <ion-icon name="heart"></ion-icon>
|
|
130
|
+
|
|
131
|
+
## Sizing
|
|
132
|
+
|
|
133
|
+
### Font Awesome
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<i class="fas fa-star fa-xs"></i>
|
|
137
|
+
<i class="fas fa-star fa-sm"></i>
|
|
138
|
+
<i class="fas fa-star"></i>
|
|
139
|
+
<i class="fas fa-star fa-lg"></i>
|
|
140
|
+
<i class="fas fa-star fa-2x"></i>
|
|
141
|
+
<i class="fas fa-star fa-3x"></i>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
<i class="fas fa-star fa-xs"></i> <i class="fas fa-star fa-sm"></i> <i class="fas fa-star"></i> <i class="fas fa-star fa-lg"></i> <i class="fas fa-star fa-2x"></i> <i class="fas fa-star fa-3x"></i>
|
|
145
|
+
|
|
146
|
+
### CSS Sizing
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<i class="ri-star-fill" style="font-size: 24px;"></i>
|
|
150
|
+
<i class="ri-star-fill" style="font-size: 32px;"></i>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
<i class="ri-star-fill" style="font-size: 24px;"></i> <i class="ri-star-fill" style="font-size: 32px;"></i>
|
|
154
|
+
|
|
155
|
+
## Coloring
|
|
156
|
+
|
|
157
|
+
```html
|
|
158
|
+
<i class="fas fa-star" style="color: gold;"></i>
|
|
159
|
+
<i class="fas fa-heart" style="color: red;"></i>
|
|
160
|
+
<i class="fas fa-leaf" style="color: green;"></i>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
<i class="fas fa-star" style="color: gold;"></i> <i class="fas fa-heart" style="color: red;"></i> <i class="fas fa-leaf" style="color: green;"></i>
|
|
164
|
+
|
|
165
|
+
## Animation
|
|
166
|
+
|
|
167
|
+
### Font Awesome
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<i class="fas fa-spinner fa-spin"></i>
|
|
171
|
+
<i class="fas fa-circle-notch fa-spin"></i>
|
|
172
|
+
<i class="fas fa-sync fa-spin"></i>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
<i class="fas fa-spinner fa-spin"></i> <i class="fas fa-circle-notch fa-spin"></i> <i class="fas fa-sync fa-spin"></i>
|
|
176
|
+
|
|
177
|
+
## Common Use Cases
|
|
178
|
+
|
|
179
|
+
### In Text
|
|
180
|
+
|
|
181
|
+
Use icons inline with text:
|
|
182
|
+
|
|
183
|
+
```markdown
|
|
184
|
+
<i class="fas fa-check" style="color: green;"></i> Task completed
|
|
185
|
+
|
|
186
|
+
<i class="fas fa-times" style="color: red;"></i> Task failed
|
|
187
|
+
|
|
188
|
+
<i class="fas fa-info-circle" style="color: blue;"></i> Information
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
<i class="fas fa-check" style="color: green;"></i> Task completed
|
|
192
|
+
|
|
193
|
+
<i class="fas fa-times" style="color: red;"></i> Task failed
|
|
194
|
+
|
|
195
|
+
<i class="fas fa-info-circle" style="color: blue;"></i> Information
|
|
196
|
+
|
|
197
|
+
### In Lists
|
|
198
|
+
|
|
199
|
+
```markdown
|
|
200
|
+
- <i class="ri-checkbox-circle-fill" style="color: green;"></i> Feature A
|
|
201
|
+
- <i class="ri-checkbox-circle-fill" style="color: green;"></i> Feature B
|
|
202
|
+
- <i class="ri-close-circle-fill" style="color: red;"></i> Not supported
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
- <i class="ri-checkbox-circle-fill" style="color: green;"></i> Feature A
|
|
206
|
+
- <i class="ri-checkbox-circle-fill" style="color: green;"></i> Feature B
|
|
207
|
+
- <i class="ri-close-circle-fill" style="color: red;"></i> Not supported
|
|
208
|
+
|
|
209
|
+
## Icon Search
|
|
210
|
+
|
|
211
|
+
Find icons at:
|
|
212
|
+
- [Font Awesome](https://fontawesome.com/icons)
|
|
213
|
+
- [Material Icons](https://fonts.google.com/icons)
|
|
214
|
+
- [Remix Icon](https://remixicon.com/)
|
|
215
|
+
- [Bootstrap Icons](https://icons.getbootstrap.com/)
|
|
216
|
+
- [Ionicons](https://ionic.io/ionicons)
|
|
217
|
+
|
|
218
|
+
::: tip Choosing Icons
|
|
219
|
+
1. **Stay consistent** - Pick one library for most icons
|
|
220
|
+
2. **Match your style** - Outlined vs filled, thin vs bold
|
|
221
|
+
3. **Consider meaning** - Icons should be intuitive
|
|
222
|
+
4. **Don't overuse** - Icons should enhance, not clutter
|
|
223
|
+
:::
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
Continue to [Configuration](../../config/) to customize your blog.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Advanced Features
|
|
3
|
+
description: Diagrams, math formulas, videos, and icons
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- Features
|
|
10
|
+
- Advanced
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Advanced Features
|
|
14
|
+
|
|
15
|
+
Take your content to the next level with these powerful features.
|
|
16
|
+
|
|
17
|
+
## Feature Overview
|
|
18
|
+
|
|
19
|
+
| Feature | Description |
|
|
20
|
+
|---------|-------------|
|
|
21
|
+
| [Mermaid Diagrams](./01-mermaid) | Flowcharts, sequences, Gantt charts |
|
|
22
|
+
| [LaTeX Math](./02-latex) | Mathematical formulas and equations |
|
|
23
|
+
| [Video Embedding](./03-video) | YouTube, Bilibili, custom videos |
|
|
24
|
+
| [Icons](./04-icons) | 5000+ icons from multiple libraries |
|
|
25
|
+
|
|
26
|
+
## Quick Examples
|
|
27
|
+
|
|
28
|
+
### Diagrams
|
|
29
|
+
|
|
30
|
+
```mermaid
|
|
31
|
+
graph LR
|
|
32
|
+
A[Write] --> B[Build]
|
|
33
|
+
B --> C[Deploy]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Math
|
|
37
|
+
|
|
38
|
+
Inline: $E = mc^2$
|
|
39
|
+
|
|
40
|
+
Block:
|
|
41
|
+
$$
|
|
42
|
+
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
### Icons
|
|
46
|
+
|
|
47
|
+
Use icons anywhere: <i class="fas fa-star"></i> <i class="ri-heart-fill"></i>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
Start with [Mermaid Diagrams](./01-mermaid)!
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Containers
|
|
3
|
+
description: Use callout boxes for tips, warnings, and important information
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- Markdown
|
|
10
|
+
- Containers
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Containers
|
|
14
|
+
|
|
15
|
+
Containers are special callout boxes that help highlight important information.
|
|
16
|
+
|
|
17
|
+
## Basic Syntax
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
::: type
|
|
21
|
+
Content goes here
|
|
22
|
+
:::
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Container Types
|
|
26
|
+
|
|
27
|
+
### Tip
|
|
28
|
+
|
|
29
|
+
For helpful suggestions:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
::: tip
|
|
33
|
+
This is a helpful tip for the reader.
|
|
34
|
+
:::
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
::: tip
|
|
38
|
+
This is a helpful tip for the reader.
|
|
39
|
+
:::
|
|
40
|
+
|
|
41
|
+
### Info
|
|
42
|
+
|
|
43
|
+
For informational notes:
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
::: info
|
|
47
|
+
Here's some additional information.
|
|
48
|
+
:::
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
::: info
|
|
52
|
+
Here's some additional information.
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
### Warning
|
|
56
|
+
|
|
57
|
+
For things to be careful about:
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
::: warning
|
|
61
|
+
Be careful with this operation.
|
|
62
|
+
:::
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
::: warning
|
|
66
|
+
Be careful with this operation.
|
|
67
|
+
:::
|
|
68
|
+
|
|
69
|
+
### Danger
|
|
70
|
+
|
|
71
|
+
For critical warnings:
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
::: danger
|
|
75
|
+
This action cannot be undone!
|
|
76
|
+
:::
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
::: danger
|
|
80
|
+
This action cannot be undone!
|
|
81
|
+
:::
|
|
82
|
+
|
|
83
|
+
### Note
|
|
84
|
+
|
|
85
|
+
For general notes:
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
::: note
|
|
89
|
+
A side note for the reader.
|
|
90
|
+
:::
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
::: note
|
|
94
|
+
A side note for the reader.
|
|
95
|
+
:::
|
|
96
|
+
|
|
97
|
+
## Custom Titles
|
|
98
|
+
|
|
99
|
+
Add a custom title after the type:
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
::: tip Pro Tip
|
|
103
|
+
This container has a custom title.
|
|
104
|
+
:::
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
::: tip Pro Tip
|
|
108
|
+
This container has a custom title.
|
|
109
|
+
:::
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
::: warning Security Notice
|
|
113
|
+
Always validate user input!
|
|
114
|
+
:::
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
::: warning Security Notice
|
|
118
|
+
Always validate user input!
|
|
119
|
+
:::
|
|
120
|
+
|
|
121
|
+
## Rich Content
|
|
122
|
+
|
|
123
|
+
Containers support full Markdown inside:
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
::: info Features
|
|
127
|
+
This blog supports:
|
|
128
|
+
- **Markdown** formatting
|
|
129
|
+
- `Code` snippets
|
|
130
|
+
- [Links](https://example.com)
|
|
131
|
+
|
|
132
|
+
| Feature | Status |
|
|
133
|
+
|---------|--------|
|
|
134
|
+
| Images | ✅ |
|
|
135
|
+
| Tables | ✅ |
|
|
136
|
+
:::
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
::: info Features
|
|
140
|
+
This blog supports:
|
|
141
|
+
- **Markdown** formatting
|
|
142
|
+
- `Code` snippets
|
|
143
|
+
- [Links](https://example.com)
|
|
144
|
+
|
|
145
|
+
| Feature | Status |
|
|
146
|
+
|---------|--------|
|
|
147
|
+
| Images | ✅ |
|
|
148
|
+
| Tables | ✅ |
|
|
149
|
+
:::
|
|
150
|
+
|
|
151
|
+
## Details (Collapsible)
|
|
152
|
+
|
|
153
|
+
Create expandable sections:
|
|
154
|
+
|
|
155
|
+
```markdown
|
|
156
|
+
::: details Click to expand
|
|
157
|
+
This content is hidden by default.
|
|
158
|
+
You can put lots of content here.
|
|
159
|
+
:::
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
::: details Click to expand
|
|
163
|
+
This content is hidden by default.
|
|
164
|
+
You can put lots of content here.
|
|
165
|
+
:::
|
|
166
|
+
|
|
167
|
+
### Details with Custom Title
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
::: details View the solution
|
|
171
|
+
```javascript
|
|
172
|
+
function solve() {
|
|
173
|
+
return 42;
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
:::
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
::: details View the solution
|
|
180
|
+
```javascript
|
|
181
|
+
function solve() {
|
|
182
|
+
return 42;
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
:::
|
|
186
|
+
|
|
187
|
+
## Nested Containers
|
|
188
|
+
|
|
189
|
+
You can nest containers (use more colons for outer):
|
|
190
|
+
|
|
191
|
+
```markdown
|
|
192
|
+
:::: warning Important
|
|
193
|
+
This is important!
|
|
194
|
+
|
|
195
|
+
::: tip
|
|
196
|
+
A tip inside a warning.
|
|
197
|
+
:::
|
|
198
|
+
::::
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
:::: warning Important
|
|
202
|
+
This is important!
|
|
203
|
+
|
|
204
|
+
::: tip
|
|
205
|
+
A tip inside a warning.
|
|
206
|
+
:::
|
|
207
|
+
::::
|
|
208
|
+
|
|
209
|
+
## Best Practices
|
|
210
|
+
|
|
211
|
+
::: tip When to Use Containers
|
|
212
|
+
- **tip** - Helpful suggestions, best practices
|
|
213
|
+
- **info** - Background information, context
|
|
214
|
+
- **warning** - Potential issues, things to watch
|
|
215
|
+
- **danger** - Critical errors, data loss risks
|
|
216
|
+
- **note** - General observations
|
|
217
|
+
- **details** - Optional content, long examples
|
|
218
|
+
:::
|
|
219
|
+
|
|
220
|
+
::: warning Don't Overuse
|
|
221
|
+
Too many containers can be distracting. Use them sparingly for truly important information.
|
|
222
|
+
:::
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
Next: Master [Code Blocks](./03-code-blocks) for beautiful code snippets.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Code Blocks
|
|
3
|
+
description: Syntax highlighting, line numbers, and code display features
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- Markdown
|
|
10
|
+
- Code
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Code Blocks
|
|
14
|
+
|
|
15
|
+
Display code with beautiful syntax highlighting powered by Shiki.
|
|
16
|
+
|
|
17
|
+
## Basic Code Blocks
|
|
18
|
+
|
|
19
|
+
Wrap code in triple backticks:
|
|
20
|
+
|
|
21
|
+
````markdown
|
|
22
|
+
```
|
|
23
|
+
Plain text code block
|
|
24
|
+
```
|
|
25
|
+
````
|
|
26
|
+
|
|
27
|
+
## Syntax Highlighting
|
|
28
|
+
|
|
29
|
+
Specify the language after the backticks:
|
|
30
|
+
|
|
31
|
+
````markdown
|
|
32
|
+
```javascript
|
|
33
|
+
function greet(name) {
|
|
34
|
+
return `Hello, ${name}!`;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
````
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
function greet(name) {
|
|
41
|
+
return `Hello, ${name}!`;
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Supported Languages
|
|
46
|
+
|
|
47
|
+
Over 100 languages are supported:
|
|
48
|
+
|
|
49
|
+
| Language | Identifier |
|
|
50
|
+
|----------|------------|
|
|
51
|
+
| JavaScript | `javascript`, `js` |
|
|
52
|
+
| TypeScript | `typescript`, `ts` |
|
|
53
|
+
| Python | `python`, `py` |
|
|
54
|
+
| HTML | `html` |
|
|
55
|
+
| CSS | `css` |
|
|
56
|
+
| JSON | `json` |
|
|
57
|
+
| Bash | `bash`, `sh` |
|
|
58
|
+
| Markdown | `markdown`, `md` |
|
|
59
|
+
|
|
60
|
+
## Language Examples
|
|
61
|
+
|
|
62
|
+
### JavaScript/TypeScript
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
interface User {
|
|
66
|
+
name: string;
|
|
67
|
+
age: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const user: User = {
|
|
71
|
+
name: 'Alice',
|
|
72
|
+
age: 25
|
|
73
|
+
};
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Python
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
def fibonacci(n):
|
|
80
|
+
if n <= 1:
|
|
81
|
+
return n
|
|
82
|
+
return fibonacci(n-1) + fibonacci(n-2)
|
|
83
|
+
|
|
84
|
+
print([fibonacci(i) for i in range(10)])
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### HTML
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<!DOCTYPE html>
|
|
91
|
+
<html>
|
|
92
|
+
<head>
|
|
93
|
+
<title>Hello</title>
|
|
94
|
+
</head>
|
|
95
|
+
<body>
|
|
96
|
+
<h1>Hello World</h1>
|
|
97
|
+
</body>
|
|
98
|
+
</html>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### CSS
|
|
102
|
+
|
|
103
|
+
```css
|
|
104
|
+
.container {
|
|
105
|
+
display: flex;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
align-items: center;
|
|
108
|
+
gap: 1rem;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.button {
|
|
112
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
113
|
+
color: white;
|
|
114
|
+
padding: 0.5rem 1rem;
|
|
115
|
+
border-radius: 0.25rem;
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Bash
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
#!/bin/bash
|
|
123
|
+
|
|
124
|
+
# Install dependencies
|
|
125
|
+
npm install
|
|
126
|
+
|
|
127
|
+
# Build project
|
|
128
|
+
npm run build
|
|
129
|
+
|
|
130
|
+
# Deploy
|
|
131
|
+
rsync -avz dist/ server:/var/www/blog/
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### JSON
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"name": "my-blog",
|
|
139
|
+
"version": "1.0.0",
|
|
140
|
+
"dependencies": {
|
|
141
|
+
"astro": "^5.0.0",
|
|
142
|
+
"vue": "^3.4.0"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Inline Code
|
|
148
|
+
|
|
149
|
+
Use single backticks for inline code:
|
|
150
|
+
|
|
151
|
+
```markdown
|
|
152
|
+
Use `npm install` to install dependencies.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Use `npm install` to install dependencies.
|
|
156
|
+
|
|
157
|
+
## Code Block Features
|
|
158
|
+
|
|
159
|
+
### Copy Button
|
|
160
|
+
|
|
161
|
+
All code blocks have a copy button that appears on hover.
|
|
162
|
+
|
|
163
|
+
### Language Label
|
|
164
|
+
|
|
165
|
+
The language name is displayed in the header.
|
|
166
|
+
|
|
167
|
+
### Collapsible Code
|
|
168
|
+
|
|
169
|
+
Long code blocks (15+ lines) are automatically collapsed with an "Expand" button.
|
|
170
|
+
|
|
171
|
+
::: tip Try It
|
|
172
|
+
Scroll up to see the expand/collapse feature on longer code blocks.
|
|
173
|
+
:::
|
|
174
|
+
|
|
175
|
+
## Code in Containers
|
|
176
|
+
|
|
177
|
+
Code works inside containers:
|
|
178
|
+
|
|
179
|
+
::: tip Example
|
|
180
|
+
```javascript
|
|
181
|
+
// This code is inside a tip container
|
|
182
|
+
console.log('Hello from a container!');
|
|
183
|
+
```
|
|
184
|
+
:::
|
|
185
|
+
|
|
186
|
+
## Diff Syntax
|
|
187
|
+
|
|
188
|
+
Show code changes:
|
|
189
|
+
|
|
190
|
+
```diff
|
|
191
|
+
- const old = 'before';
|
|
192
|
+
+ const new = 'after';
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Best Practices
|
|
196
|
+
|
|
197
|
+
::: info Code Block Tips
|
|
198
|
+
1. **Always specify the language** for proper highlighting
|
|
199
|
+
2. **Keep examples focused** - show only relevant code
|
|
200
|
+
3. **Add comments** to explain complex logic
|
|
201
|
+
4. **Test your code** - ensure examples actually work
|
|
202
|
+
:::
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
Continue to advanced features: [Mermaid Diagrams](../features/01-mermaid).
|