Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
1 | $ hexo new "My New Post" |
More info: Writing
Run server
1 | $ hexo server |
More info: Server
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
More info: Deployment
Complete Examples of Common Markdown Formatting
1. Headers
Level 2 Header
Level 3 Header
Level 4 Header
Level 5 Header
Level 6 Header
2. Paragraphs and Line Breaks
This is a regular paragraph. Markdown paragraphs require an empty line between them.
This is the second paragraph.
This line uses two trailing spaces for a soft line break.
3. Emphasis
Bold text
Italic text
Bold and Italic text
Strikethrough text
Highlighted text
Note:
==highlight==is not supported by all Markdown renderers. A more universal method is shown below:
HTML Highlighted Text
4. Lists
4.1 Unordered List
- Item 1
- Item 2
- Item 3
- Sub-item A
- Sub-item B
4.2 Ordered List
- Step 1
- Step 2
- Step 3
- Sub-step 1
- Sub-step 2
4.3 Task List
- Completed Task
- Unfinished Task
- Pending Task
5. Blockquotes
This is a first-level blockquote.
This is a nested blockquote.
6. Links and Images
6.1 Regular Link
6.2 Link with Title
6.3 Automatic Link
6.4 Image
7. Inline Code and Code Blocks
7.1 Inline Code
Use console.log("Hello Markdown") to output text.
7.2 Code Block
1 | function greet(name) { |
1 | def add(a: int, b: int) -> int: |
7.3 Code Block Diff
1 | diff --git a/example.js b/example.js |
8. Tables
| Name | Type | Description |
|---|---|---|
| Markdown | Markup Language | Lightweight text formatting language |
| Mermaid | Chart Syntax | Generate charts from text |
| GitHub Alert | Extended Syntax | GitHub-style alert boxes |
9. Mathematical Formulas
9.1 Inline Math
The mass-energy equivalence formula is .
9.2 Math Block
$
\int_{-\infty}^{+\infty} e^{-x^2} , dx = \sqrt{\pi}
$
10. Subscript and Superscript
10.1 HTML Method
The chemical formula for water is H2O.
The formula for squares is x2 + y2 = z2.
10.2 Math Formula Method
Chemical formula for water:
Formula for squares:
11. Horizontal Rules
12. GitHub-Style Alert Boxes
Note
This is a regular note.
Tip
This is a practical tip.
Important
This is important information.
Warning
This is a warning.
Caution
This is a high-risk reminder.
13. Mermaid Diagrams
Requires a Markdown renderer that supports Mermaid, such as GitHub, Obsidian, Typora, VS Code extensions, etc.
13.1 Flowchart
flowchart TD
A[Start] --> B{Does condition hold?}
B -- Yes --> C[Execute Plan A]
B -- No --> D[Execute Plan B]
C --> E[End]
D --> Eflowchart TD
A[Start] --> B{Does condition hold?}
B -- Yes --> C[Execute Plan A]
B -- No --> D[Execute Plan B]
C --> E[End]
D --> E13.2 Sequence Diagram
sequenceDiagram
participant User as User
participant App as Application
participant API as API Service
participant DB as Database
User->>App: Send Request
App->>API: Call Endpoint
API->>DB: Query Data
DB-->>API: Return Result
API-->>App: Return Response
App-->>User: Display ResultsequenceDiagram
participant User as User
participant App as Application
participant API as API Service
participant DB as Database
User->>App: Send Request
App->>API: Call Endpoint
API->>DB: Query Data
DB-->>API: Return Result
API-->>App: Return Response
App-->>User: Display Result13.3 Class Diagram
classDiagram
class User {
+String name
+String email
+login()
+logout()
}
class Admin {
+manageUsers()
}
User <|-- AdminclassDiagram
class User {
+String name
+String email
+login()
+logout()
}
class Admin {
+manageUsers()
}
User <|-- Admin13.4 State Diagram
stateDiagram-v2
[*] --> Idle
Idle --> Loading: Submit Request
Loading --> Success: Request Succeeded
Loading --> Error: Request Failed
Success --> [*]
Error --> Idle: RetrystateDiagram-v2
[*] --> Idle
Idle --> Loading: Submit Request
Loading --> Success: Request Succeeded
Loading --> Error: Request Failed
Success --> [*]
Error --> Idle: Retry14. Escaping Characters
If you need to display Markdown special characters, use a backslash to escape them.
# This is not a header
- This is not a list item
* This is not italic *
15. Footnotes
This is a sentence with a footnote.[^1]
[^1]: This is the footnote content.
16. Definition Lists
- Term One
- This is the definition for term one.
- Term Two
- This is the definition for term two.
17. Collapsed Content
Click to expand
This is the collapsed content.
- Supports lists
- Supports code
- Supports formulas:
18. Comprehensive Example
Important
The following example mixes headers, lists, links, formulas, code, and Mermaid.
Project Initialization Process
- Read the Markdown Guide
- Install dependencies
- Write code
- Submit a Pull Request
1 | npm install |
Complexity estimate: .
flowchart LR
A[Write Documentation] --> B[Local Preview]
B --> C{Does it pass?}
C -- Yes --> D[Commit]
C -- No --> Aflowchart LR
A[Write Documentation] --> B[Local Preview]
B --> C{Does it pass?}
C -- Yes --> D[Commit]
C -- No --> A