@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,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Get Started
|
|
3
|
+
description: Begin your journey with Astro Blog - from installation to deployment
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- Getting Started
|
|
10
|
+
- Tutorial
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Get Started
|
|
14
|
+
|
|
15
|
+
Welcome! This guide will walk you through setting up your Astro Blog from scratch.
|
|
16
|
+
|
|
17
|
+
::: tip Who Is This For?
|
|
18
|
+
This tutorial is designed for beginners. Even if you're new to Astro or static site generators, you'll be able to follow along step by step.
|
|
19
|
+
:::
|
|
20
|
+
|
|
21
|
+
## Learning Path
|
|
22
|
+
|
|
23
|
+
Follow these chapters in order:
|
|
24
|
+
|
|
25
|
+
| Step | Chapter | What You'll Learn |
|
|
26
|
+
|------|---------|-------------------|
|
|
27
|
+
| 1 | [Introduction](./01-intro) | What Astro Blog is and its features |
|
|
28
|
+
| 2 | [Installation](./02-install) | Set up Node.js and install the project |
|
|
29
|
+
| 3 | [First Post](./03-create-post) | Write and publish your first article |
|
|
30
|
+
| 4 | [Project Structure](./04-structure) | Understand how files are organized |
|
|
31
|
+
| 5 | [Deployment](./05-deploy) | Build and deploy to the web |
|
|
32
|
+
|
|
33
|
+
## Prerequisites
|
|
34
|
+
|
|
35
|
+
Before starting, make sure you have:
|
|
36
|
+
|
|
37
|
+
- **Node.js 18+** installed on your computer
|
|
38
|
+
- A **code editor** (VS Code recommended)
|
|
39
|
+
- Basic familiarity with the **command line**
|
|
40
|
+
|
|
41
|
+
::: info Don't Have Node.js?
|
|
42
|
+
Download it from [nodejs.org](https://nodejs.org). Choose the LTS (Long Term Support) version.
|
|
43
|
+
:::
|
|
44
|
+
|
|
45
|
+
## Time Required
|
|
46
|
+
|
|
47
|
+
- **Quick setup**: ~5 minutes
|
|
48
|
+
- **Full tutorial**: ~30 minutes
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
Ready? Let's start with the [Introduction](./01-intro)!
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Writing Guide
|
|
3
|
+
description: Master content creation with Markdown, components, and advanced features
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- Guide
|
|
10
|
+
- Writing
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Writing Guide
|
|
14
|
+
|
|
15
|
+
Learn how to create beautiful, engaging content for your blog.
|
|
16
|
+
|
|
17
|
+
## Markdown Basics
|
|
18
|
+
|
|
19
|
+
Start with the fundamentals:
|
|
20
|
+
|
|
21
|
+
| Guide | Description |
|
|
22
|
+
|-------|-------------|
|
|
23
|
+
| [Markdown Essentials](./markdown/) | Core syntax you'll use every day |
|
|
24
|
+
| [Containers](./markdown/02-containers) | Tips, warnings, and callout boxes |
|
|
25
|
+
| [Code Blocks](./markdown/03-code-blocks) | Syntax highlighting and features |
|
|
26
|
+
|
|
27
|
+
## Advanced Features
|
|
28
|
+
|
|
29
|
+
Take your content to the next level:
|
|
30
|
+
|
|
31
|
+
| Feature | Description |
|
|
32
|
+
|---------|-------------|
|
|
33
|
+
| [Mermaid Diagrams](./features/01-mermaid) | Flowcharts, sequences, and more |
|
|
34
|
+
| [LaTeX Math](./features/02-latex) | Mathematical formulas |
|
|
35
|
+
| [Video Embedding](./features/03-video) | YouTube, Bilibili, custom videos |
|
|
36
|
+
| [Icons](./features/04-icons) | Use icons from multiple libraries |
|
|
37
|
+
|
|
38
|
+
## Quick Reference
|
|
39
|
+
|
|
40
|
+
::: tip Common Patterns
|
|
41
|
+
```markdown
|
|
42
|
+
# Heading 1
|
|
43
|
+
## Heading 2
|
|
44
|
+
|
|
45
|
+
**bold** and *italic*
|
|
46
|
+
|
|
47
|
+
- Bullet list
|
|
48
|
+
1. Numbered list
|
|
49
|
+
|
|
50
|
+
[Link](https://example.com)
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
`inline code`
|
|
54
|
+
```
|
|
55
|
+
:::
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
Start with [Markdown Essentials](./markdown/)!
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Mermaid Diagrams
|
|
3
|
+
description: Create flowcharts, sequence diagrams, and more with Mermaid
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- Mermaid
|
|
10
|
+
- Diagrams
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Mermaid Diagrams
|
|
14
|
+
|
|
15
|
+
Create beautiful diagrams directly in Markdown using [Mermaid](https://mermaid.js.org).
|
|
16
|
+
|
|
17
|
+
## Basic Syntax
|
|
18
|
+
|
|
19
|
+
Use a code block with `mermaid` language:
|
|
20
|
+
|
|
21
|
+
````markdown
|
|
22
|
+
```mermaid
|
|
23
|
+
graph TD
|
|
24
|
+
A[Start] --> B[End]
|
|
25
|
+
```
|
|
26
|
+
````
|
|
27
|
+
|
|
28
|
+
## Flowchart
|
|
29
|
+
|
|
30
|
+
### Basic Flow
|
|
31
|
+
|
|
32
|
+
```mermaid
|
|
33
|
+
graph TD
|
|
34
|
+
A[Start] --> B{Decision}
|
|
35
|
+
B -->|Yes| C[Do Something]
|
|
36
|
+
B -->|No| D[Do Something Else]
|
|
37
|
+
C --> E[End]
|
|
38
|
+
D --> E
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Left to Right
|
|
42
|
+
|
|
43
|
+
```mermaid
|
|
44
|
+
graph LR
|
|
45
|
+
A[Input] --> B[Process]
|
|
46
|
+
B --> C[Output]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Node Shapes
|
|
50
|
+
|
|
51
|
+
```mermaid
|
|
52
|
+
graph TD
|
|
53
|
+
A[Rectangle]
|
|
54
|
+
B(Rounded)
|
|
55
|
+
C([Stadium])
|
|
56
|
+
D[[Subroutine]]
|
|
57
|
+
E[(Database)]
|
|
58
|
+
F((Circle))
|
|
59
|
+
G{Diamond}
|
|
60
|
+
H{{Hexagon}}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Sequence Diagram
|
|
64
|
+
|
|
65
|
+
```mermaid
|
|
66
|
+
sequenceDiagram
|
|
67
|
+
participant User
|
|
68
|
+
participant Browser
|
|
69
|
+
participant Server
|
|
70
|
+
participant Database
|
|
71
|
+
|
|
72
|
+
User->>Browser: Enter URL
|
|
73
|
+
Browser->>Server: HTTP Request
|
|
74
|
+
Server->>Database: Query Data
|
|
75
|
+
Database-->>Server: Return Data
|
|
76
|
+
Server-->>Browser: HTTP Response
|
|
77
|
+
Browser-->>User: Display Page
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Class Diagram
|
|
81
|
+
|
|
82
|
+
```mermaid
|
|
83
|
+
classDiagram
|
|
84
|
+
class Animal {
|
|
85
|
+
+String name
|
|
86
|
+
+int age
|
|
87
|
+
+makeSound()
|
|
88
|
+
}
|
|
89
|
+
class Dog {
|
|
90
|
+
+String breed
|
|
91
|
+
+bark()
|
|
92
|
+
}
|
|
93
|
+
class Cat {
|
|
94
|
+
+String color
|
|
95
|
+
+meow()
|
|
96
|
+
}
|
|
97
|
+
Animal <|-- Dog
|
|
98
|
+
Animal <|-- Cat
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## State Diagram
|
|
102
|
+
|
|
103
|
+
```mermaid
|
|
104
|
+
stateDiagram-v2
|
|
105
|
+
[*] --> Draft
|
|
106
|
+
Draft --> Review
|
|
107
|
+
Review --> Draft: Changes needed
|
|
108
|
+
Review --> Published
|
|
109
|
+
Published --> Archived
|
|
110
|
+
Archived --> [*]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Gantt Chart
|
|
114
|
+
|
|
115
|
+
```mermaid
|
|
116
|
+
gantt
|
|
117
|
+
title Project Timeline
|
|
118
|
+
dateFormat YYYY-MM-DD
|
|
119
|
+
section Planning
|
|
120
|
+
Requirements :a1, 2025-01-01, 7d
|
|
121
|
+
Design :a2, after a1, 5d
|
|
122
|
+
section Development
|
|
123
|
+
Backend :b1, after a2, 14d
|
|
124
|
+
Frontend :b2, after a2, 14d
|
|
125
|
+
section Testing
|
|
126
|
+
Testing :c1, after b1, 7d
|
|
127
|
+
Deployment :c2, after c1, 3d
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Pie Chart
|
|
131
|
+
|
|
132
|
+
```mermaid
|
|
133
|
+
pie title Language Usage
|
|
134
|
+
"JavaScript" : 45
|
|
135
|
+
"TypeScript" : 30
|
|
136
|
+
"Python" : 15
|
|
137
|
+
"Other" : 10
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Entity Relationship
|
|
141
|
+
|
|
142
|
+
```mermaid
|
|
143
|
+
erDiagram
|
|
144
|
+
USER ||--o{ POST : writes
|
|
145
|
+
USER ||--o{ COMMENT : writes
|
|
146
|
+
POST ||--o{ COMMENT : has
|
|
147
|
+
POST }|--|| CATEGORY : belongs_to
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Git Graph
|
|
151
|
+
|
|
152
|
+
```mermaid
|
|
153
|
+
gitGraph
|
|
154
|
+
commit id: "Initial"
|
|
155
|
+
branch develop
|
|
156
|
+
checkout develop
|
|
157
|
+
commit id: "Feature A"
|
|
158
|
+
commit id: "Feature B"
|
|
159
|
+
checkout main
|
|
160
|
+
merge develop
|
|
161
|
+
commit id: "Release"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Styling
|
|
165
|
+
|
|
166
|
+
### Custom Colors
|
|
167
|
+
|
|
168
|
+
```mermaid
|
|
169
|
+
graph TD
|
|
170
|
+
A[Start]:::green --> B{Check}:::yellow
|
|
171
|
+
B -->|Pass| C[Success]:::green
|
|
172
|
+
B -->|Fail| D[Error]:::red
|
|
173
|
+
|
|
174
|
+
classDef green fill:#90EE90
|
|
175
|
+
classDef yellow fill:#FFE4B5
|
|
176
|
+
classDef red fill:#FFB6C1
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Tips
|
|
180
|
+
|
|
181
|
+
::: tip Best Practices
|
|
182
|
+
1. **Keep it simple** - Complex diagrams become hard to read
|
|
183
|
+
2. **Use meaningful labels** - Clear text improves understanding
|
|
184
|
+
3. **Choose the right type** - Match diagram to your content
|
|
185
|
+
4. **Test rendering** - Preview before publishing
|
|
186
|
+
:::
|
|
187
|
+
|
|
188
|
+
::: info Learn More
|
|
189
|
+
Full documentation: [mermaid.js.org](https://mermaid.js.org/syntax/flowchart.html)
|
|
190
|
+
:::
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
Next: [LaTeX Math](./02-latex) for mathematical formulas.
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: LaTeX Math
|
|
3
|
+
description: Write mathematical formulas with LaTeX and KaTeX
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- LaTeX
|
|
10
|
+
- Math
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# LaTeX Math
|
|
14
|
+
|
|
15
|
+
Write beautiful mathematical formulas using LaTeX syntax, rendered with [KaTeX](https://katex.org).
|
|
16
|
+
|
|
17
|
+
## Inline Math
|
|
18
|
+
|
|
19
|
+
Use single `$` for inline formulas:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
The famous equation $E = mc^2$ changed physics.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The famous equation $E = mc^2$ changed physics.
|
|
26
|
+
|
|
27
|
+
More examples:
|
|
28
|
+
- Area of circle: $A = \pi r^2$
|
|
29
|
+
- Pythagorean theorem: $a^2 + b^2 = c^2$
|
|
30
|
+
- Quadratic formula: $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$
|
|
31
|
+
|
|
32
|
+
## Block Math
|
|
33
|
+
|
|
34
|
+
Use double `$$` for centered, block-level formulas:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
$$
|
|
38
|
+
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
|
|
39
|
+
$$
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
|
|
44
|
+
$$
|
|
45
|
+
|
|
46
|
+
## Basic Syntax
|
|
47
|
+
|
|
48
|
+
### Superscripts and Subscripts
|
|
49
|
+
|
|
50
|
+
| Syntax | Result |
|
|
51
|
+
|--------|--------|
|
|
52
|
+
| `x^2` | $x^2$ |
|
|
53
|
+
| `x_i` | $x_i$ |
|
|
54
|
+
| `x_i^2` | $x_i^2$ |
|
|
55
|
+
| `x^{10}` | $x^{10}$ |
|
|
56
|
+
|
|
57
|
+
### Fractions
|
|
58
|
+
|
|
59
|
+
```latex
|
|
60
|
+
$$
|
|
61
|
+
\frac{a}{b} \quad \frac{1}{2} \quad \frac{x+1}{y-1}
|
|
62
|
+
$$
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
$$
|
|
66
|
+
\frac{a}{b} \quad \frac{1}{2} \quad \frac{x+1}{y-1}
|
|
67
|
+
$$
|
|
68
|
+
|
|
69
|
+
### Square Roots
|
|
70
|
+
|
|
71
|
+
```latex
|
|
72
|
+
$$
|
|
73
|
+
\sqrt{2} \quad \sqrt{x+y} \quad \sqrt[3]{8}
|
|
74
|
+
$$
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
$$
|
|
78
|
+
\sqrt{2} \quad \sqrt{x+y} \quad \sqrt[3]{8}
|
|
79
|
+
$$
|
|
80
|
+
|
|
81
|
+
## Greek Letters
|
|
82
|
+
|
|
83
|
+
| Letter | Syntax | Letter | Syntax |
|
|
84
|
+
|--------|--------|--------|--------|
|
|
85
|
+
| $\alpha$ | `\alpha` | $\beta$ | `\beta` |
|
|
86
|
+
| $\gamma$ | `\gamma` | $\delta$ | `\delta` |
|
|
87
|
+
| $\pi$ | `\pi` | $\sigma$ | `\sigma` |
|
|
88
|
+
| $\theta$ | `\theta` | $\lambda$ | `\lambda` |
|
|
89
|
+
| $\Omega$ | `\Omega` | $\Sigma$ | `\Sigma` |
|
|
90
|
+
|
|
91
|
+
## Operators
|
|
92
|
+
|
|
93
|
+
### Sums and Products
|
|
94
|
+
|
|
95
|
+
```latex
|
|
96
|
+
$$
|
|
97
|
+
\sum_{i=1}^{n} x_i \quad \prod_{i=1}^{n} x_i
|
|
98
|
+
$$
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
$$
|
|
102
|
+
\sum_{i=1}^{n} x_i \quad \prod_{i=1}^{n} x_i
|
|
103
|
+
$$
|
|
104
|
+
|
|
105
|
+
### Integrals
|
|
106
|
+
|
|
107
|
+
```latex
|
|
108
|
+
$$
|
|
109
|
+
\int_a^b f(x)dx \quad \iint_D f(x,y)dxdy \quad \oint_C f(z)dz
|
|
110
|
+
$$
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
$$
|
|
114
|
+
\int_a^b f(x)dx \quad \iint_D f(x,y)dxdy \quad \oint_C f(z)dz
|
|
115
|
+
$$
|
|
116
|
+
|
|
117
|
+
### Limits
|
|
118
|
+
|
|
119
|
+
```latex
|
|
120
|
+
$$
|
|
121
|
+
\lim_{x \to \infty} \frac{1}{x} = 0
|
|
122
|
+
$$
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
$$
|
|
126
|
+
\lim_{x \to \infty} \frac{1}{x} = 0
|
|
127
|
+
$$
|
|
128
|
+
|
|
129
|
+
## Matrices
|
|
130
|
+
|
|
131
|
+
```latex
|
|
132
|
+
$$
|
|
133
|
+
\begin{pmatrix}
|
|
134
|
+
a & b \\
|
|
135
|
+
c & d
|
|
136
|
+
\end{pmatrix}
|
|
137
|
+
\quad
|
|
138
|
+
\begin{bmatrix}
|
|
139
|
+
1 & 2 & 3 \\
|
|
140
|
+
4 & 5 & 6
|
|
141
|
+
\end{bmatrix}
|
|
142
|
+
$$
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
$$
|
|
146
|
+
\begin{pmatrix}
|
|
147
|
+
a & b \\
|
|
148
|
+
c & d
|
|
149
|
+
\end{pmatrix}
|
|
150
|
+
\quad
|
|
151
|
+
\begin{bmatrix}
|
|
152
|
+
1 & 2 & 3 \\
|
|
153
|
+
4 & 5 & 6
|
|
154
|
+
\end{bmatrix}
|
|
155
|
+
$$
|
|
156
|
+
|
|
157
|
+
## Equations
|
|
158
|
+
|
|
159
|
+
### Aligned Equations
|
|
160
|
+
|
|
161
|
+
```latex
|
|
162
|
+
$$
|
|
163
|
+
\begin{aligned}
|
|
164
|
+
(a+b)^2 &= a^2 + 2ab + b^2 \\
|
|
165
|
+
(a-b)^2 &= a^2 - 2ab + b^2
|
|
166
|
+
\end{aligned}
|
|
167
|
+
$$
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
$$
|
|
171
|
+
\begin{aligned}
|
|
172
|
+
(a+b)^2 &= a^2 + 2ab + b^2 \\
|
|
173
|
+
(a-b)^2 &= a^2 - 2ab + b^2
|
|
174
|
+
\end{aligned}
|
|
175
|
+
$$
|
|
176
|
+
|
|
177
|
+
### Cases
|
|
178
|
+
|
|
179
|
+
```latex
|
|
180
|
+
$$
|
|
181
|
+
f(x) = \begin{cases}
|
|
182
|
+
x^2 & \text{if } x \geq 0 \\
|
|
183
|
+
-x^2 & \text{if } x < 0
|
|
184
|
+
\end{cases}
|
|
185
|
+
$$
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
$$
|
|
189
|
+
f(x) = \begin{cases}
|
|
190
|
+
x^2 & \text{if } x \geq 0 \\
|
|
191
|
+
-x^2 & \text{if } x < 0
|
|
192
|
+
\end{cases}
|
|
193
|
+
$$
|
|
194
|
+
|
|
195
|
+
## Common Formulas
|
|
196
|
+
|
|
197
|
+
### Statistics
|
|
198
|
+
|
|
199
|
+
Standard deviation:
|
|
200
|
+
$$
|
|
201
|
+
\sigma = \sqrt{\frac{1}{N}\sum_{i=1}^{N}(x_i - \mu)^2}
|
|
202
|
+
$$
|
|
203
|
+
|
|
204
|
+
### Calculus
|
|
205
|
+
|
|
206
|
+
Taylor series:
|
|
207
|
+
$$
|
|
208
|
+
e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots
|
|
209
|
+
$$
|
|
210
|
+
|
|
211
|
+
### Physics
|
|
212
|
+
|
|
213
|
+
Maxwell's equations:
|
|
214
|
+
$$
|
|
215
|
+
\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0}
|
|
216
|
+
$$
|
|
217
|
+
|
|
218
|
+
## Tips
|
|
219
|
+
|
|
220
|
+
::: tip Best Practices
|
|
221
|
+
1. **Use inline math** for simple formulas in text
|
|
222
|
+
2. **Use block math** for complex or important equations
|
|
223
|
+
3. **Add spacing** with `\quad` between elements
|
|
224
|
+
4. **Test rendering** - KaTeX doesn't support all LaTeX
|
|
225
|
+
:::
|
|
226
|
+
|
|
227
|
+
::: info Reference
|
|
228
|
+
Full KaTeX syntax: [katex.org/docs/supported.html](https://katex.org/docs/supported.html)
|
|
229
|
+
:::
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
Next: [Video Embedding](./03-video) for multimedia content.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Video Embedding
|
|
3
|
+
description: Embed YouTube, Bilibili, and custom videos in your posts
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- Documentation
|
|
8
|
+
tags:
|
|
9
|
+
- Video
|
|
10
|
+
- Multimedia
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Video Embedding
|
|
14
|
+
|
|
15
|
+
Add videos to make your content more engaging and informative.
|
|
16
|
+
|
|
17
|
+
## YouTube
|
|
18
|
+
|
|
19
|
+
Embed YouTube videos using the component:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
<YouTube id="dQw4w9WgXcQ" />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or with a full URL:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
<YouTube url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Options
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
<YouTube
|
|
35
|
+
id="dQw4w9WgXcQ"
|
|
36
|
+
title="Video Title"
|
|
37
|
+
start={30}
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
| Option | Description |
|
|
42
|
+
|--------|-------------|
|
|
43
|
+
| `id` | YouTube video ID |
|
|
44
|
+
| `url` | Full YouTube URL |
|
|
45
|
+
| `title` | Video title for accessibility |
|
|
46
|
+
| `start` | Start time in seconds |
|
|
47
|
+
|
|
48
|
+
## Bilibili
|
|
49
|
+
|
|
50
|
+
For Bilibili videos:
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
<Bilibili bvid="BV1xx411c7mD" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or with AV number:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
<Bilibili aid="123456789" />
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Options
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
<Bilibili
|
|
66
|
+
bvid="BV1xx411c7mD"
|
|
67
|
+
page={1}
|
|
68
|
+
title="Video Title"
|
|
69
|
+
/>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
| Option | Description |
|
|
73
|
+
|--------|-------------|
|
|
74
|
+
| `bvid` | Bilibili BV ID |
|
|
75
|
+
| `aid` | Bilibili AV number |
|
|
76
|
+
| `page` | Part number (for multi-part videos) |
|
|
77
|
+
| `title` | Video title |
|
|
78
|
+
|
|
79
|
+
## Self-Hosted Videos
|
|
80
|
+
|
|
81
|
+
For videos in your `public/` folder:
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
<Video src="/videos/demo.mp4" />
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Options
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
<Video
|
|
91
|
+
src="/videos/demo.mp4"
|
|
92
|
+
poster="/images/video-cover.jpg"
|
|
93
|
+
autoplay
|
|
94
|
+
muted
|
|
95
|
+
loop
|
|
96
|
+
/>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
| Option | Description |
|
|
100
|
+
|--------|-------------|
|
|
101
|
+
| `src` | Video file path |
|
|
102
|
+
| `poster` | Cover image URL |
|
|
103
|
+
| `autoplay` | Auto-play on load |
|
|
104
|
+
| `muted` | Muted by default |
|
|
105
|
+
| `loop` | Loop playback |
|
|
106
|
+
| `controls` | Show controls (default: true) |
|
|
107
|
+
|
|
108
|
+
## HTML5 Video
|
|
109
|
+
|
|
110
|
+
You can also use standard HTML5:
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<video
|
|
114
|
+
src="/videos/demo.mp4"
|
|
115
|
+
controls
|
|
116
|
+
width="100%"
|
|
117
|
+
poster="/images/cover.jpg">
|
|
118
|
+
Your browser doesn't support video.
|
|
119
|
+
</video>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Multiple Sources
|
|
123
|
+
|
|
124
|
+
```html
|
|
125
|
+
<video controls width="100%">
|
|
126
|
+
<source src="/videos/demo.webm" type="video/webm">
|
|
127
|
+
<source src="/videos/demo.mp4" type="video/mp4">
|
|
128
|
+
Your browser doesn't support video.
|
|
129
|
+
</video>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Video Formats
|
|
133
|
+
|
|
134
|
+
| Format | Extension | Support |
|
|
135
|
+
|--------|-----------|---------|
|
|
136
|
+
| MP4 (H.264) | `.mp4` | Best compatibility |
|
|
137
|
+
| WebM | `.webm` | Good compression |
|
|
138
|
+
| Ogg | `.ogv` | Open format |
|
|
139
|
+
|
|
140
|
+
::: tip Recommendation
|
|
141
|
+
Use **MP4 (H.264)** for best browser support. WebM is a good secondary option.
|
|
142
|
+
:::
|
|
143
|
+
|
|
144
|
+
## Responsive Videos
|
|
145
|
+
|
|
146
|
+
Videos are responsive by default. For custom aspect ratios:
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<div style="aspect-ratio: 16/9;">
|
|
150
|
+
<Video src="/videos/demo.mp4" style="width: 100%; height: 100%;" />
|
|
151
|
+
</div>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Best Practices
|
|
155
|
+
|
|
156
|
+
::: info Video Guidelines
|
|
157
|
+
1. **Optimize file size** - Compress videos for web
|
|
158
|
+
2. **Add poster images** - Show a preview before loading
|
|
159
|
+
3. **Provide captions** - Improve accessibility
|
|
160
|
+
4. **Consider autoplay carefully** - Can be annoying
|
|
161
|
+
5. **Use lazy loading** - Don't load videos until needed
|
|
162
|
+
:::
|
|
163
|
+
|
|
164
|
+
::: warning File Size
|
|
165
|
+
Keep videos under 10MB when possible. For longer videos, consider hosting on YouTube or Vimeo.
|
|
166
|
+
:::
|
|
167
|
+
|
|
168
|
+
## External Embedding
|
|
169
|
+
|
|
170
|
+
For other platforms, use their embed codes:
|
|
171
|
+
|
|
172
|
+
```html
|
|
173
|
+
<iframe
|
|
174
|
+
src="https://player.vimeo.com/video/123456789"
|
|
175
|
+
width="640"
|
|
176
|
+
height="360"
|
|
177
|
+
frameborder="0"
|
|
178
|
+
allowfullscreen>
|
|
179
|
+
</iframe>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
Next: [Icons](./04-icons) to add visual elements.
|