Markdown基础语法参考指北
1. 标题与层级 (Headings)
使用 # 号表示标题,在 # 后加一个空格,再输入标题。
一级标题 (H1):# 一级标题
二级标题 (H2):## 二级标题
三级标题 (H3):### 三级标题
2. 文本格式化 (Emphasis)
-
斜体
*倾斜内容*或_倾斜内容_ -
加粗
**强调内容**或__强调内容__ -
加粗斜体
***又粗又斜*** -
删除线~~错误或过时的文本~~ -
下划线
<u>HTML 标签实现</u> -
文本填充底色反引号` `里面输入`文本内容` -
空白占位符
不换行空格,最常用的空格,防止单词在行尾被拆开。
  半角空格,宽度大约等于一个字母 n 的宽度。
  全角空格,宽度大约等于一个字母 m 的宽度(通常为一个中文字符宽)。
3. 列表与组织 (Lists)
无序列表 (Unordered List)
-
自然语言处理 (NLP)
* 自然语言处理 (NLP) -
计算语言学 (CL)
+ 计算语言学 (CL) -
机器学习 (ML)
- 机器学习 (ML)
有序列表 (Ordered List)
使用 1.、2.、3.等:
-
预处理 (Preprocessing)
1. 预处理 (Preprocessing) -
特征提取 (Feature Extraction)
2. 特征提取 (Feature Extraction) -
模型训练 (Model Training)
3. 模型训练 (Model Training)
任务列表 (Task Lists)
- 完成形態素解析
* [x] 完成形態素解析
- 编写Python脚本
+ [ ] 编写Python自动化脚本
- 导出为 PDF
- [x] 导出为 PDF
4. 引用与分割 (Quotes)
引用块
使用 > 符号。可以嵌套:
语言是思维的边界。
> 语言是思维的边界。—— 维特根斯坦
>> —— 维特根斯坦
5. 线条与表格
分割线: 使用三个或更多的 - 或 *,效果如下。
目录树
Windows :按住 Alt 键,然后在数字键盘上输入
Alt + 179 = │
Alt + 196 = ─
Alt + 195 = ├
Alt + 192 = └
用以上4种线条,足以实现复杂的目录树
以下为:三层级的目录树
blog-root
├── config
│ ├── database.js
│ ├── utils
│ └── helper.js
├── media
│ ├── musics
│ ├── images
│ └── videos
└── README.md
表格
- 直接使用
|隔开各列文本,实现表格效果,渲染时默认忽略竖线 - 表格中的文字对齐可分别使用
左对齐:---
居中对齐:---:
右对齐---:
| 左对齐 | 居中对齐 | 右对齐 |
| :--- | :---: | ---: |
| 苹果 | 香蕉 | 橙子 |
| 火龙果 | 西瓜 | 草莓 |
| 左对齐 | 居中对齐 | 右对齐 |
|---|---|---|
| 苹果 | 香蕉 | 橙子 |
| 火龙果 | 西瓜 | 草莓 |
*以上居中对齐、右对齐与本博客主题中表格的对齐方式存在冲突,可在其它markdown软件中渲染
6. 超链接
[方括号里输入链接说明](圆括号里填入对应链接)
示例:[欢迎来到bilibili!](https://www.bilibili.com/)
7. 图片与视频
- 图片插入的实现方式与超链接相似,但需要在最前方加一个
!

示例:
# ./落日余晖.jpg 表示这张图片与本文同级别,名为"落日余晖",格式为".jpg"
效果:
- 视频插入
<iframe width=
"100%" height="468" src="//player.bilibili.com/player.html
?bvid=BV1fK4y1s7Qf&p=1" scrolling="no" border="0"
frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>8. 脚注
这是一段用于测试的正文文本,其中需要补充说明[^1]。这是另一条演示脚注[^2]
[^1]: 脚注的详细解释,自动呈现在文末,它不会打断主流程的阅读。
[^2]: 在编写时,你可以把脚注文本写在正文后,就像这样。
这是一段用于测试的正文文本,其中需要补充说明1。这是另一条演示脚注2
9. 代码块 (Code Blocks)
行内代码
使用单个反引号组合,例如`import spacy` ,效果如右import spacy。
围栏代码块 (Code Fencing)
使用```指定编程语言以获得语法高亮,例如:
```python
# 使用 Ginza/spaCy 包
import spacy
nlp = spacy.load("ja_ginza")
print("成功嵌套并换行")
```
### 这一行作结尾,哈哈已经结束了!
代码块末尾输入```以结束,整体效果如下:
# 使用 Ginza/spaCy 包
import spacy
nlp = spacy.load("ja_ginza")
print("成功嵌套并换行")这一行作结尾,哈哈已经结束了!
一些提示
-
Markdown语法兼容HTML,可以在使用Markdown难以达到理想效果时尝试HTML语句 例如<在行与行或块与块之间使用>在行与行或块与块之间使用>
<br>强制换行 -
对于使用
` `进行文本高亮,如果遇到冲突或语法歧义,可使用反斜线 \ 充当转义符,让紧跟再\后的一个或一串符号失去语法效果;或者使用更多数量的``来包围较少数量的`占位字符串`,例如:`` `占位字符串` ``,这样就能使多层级中的` `失去语法效果,从而实现`占位字符串`的效果
注<以下内容>以下内容>(至文末)来自fuwari演示文档
公式
Inline math equations go in like so: . Display math should get its own line and be put in in double-dollarsigns:
And note that you can backslash-escape any punctuation characters which you wish to be displayed literally, ex.: `foo`, *bar*, etc.
.md文件中插入视频
---
title: Markdown基础语法
published: 2026-03-04
tags: [Markdown,web]
category: Coding
description: Markdown 基础语法参考指北
draft: false
---
正文...
---
## GitHub Repository Cards
You can add dynamic cards that link to GitHub repositories, on page load, the repository information is pulled from the GitHub API.
::github{repo="Fabrizz/MMM-OnSpotify"}
Create a GitHub repository card with the code `::github{repo="<owner>/<repo>"}`.
```markdown
::github{repo="saicaca/fuwari"}Admonitions
Following types of admonitions are supported: note tip important warning caution
Highlights information that users should take into account, even when skimming.
Optional information to help a user be more successful.
Crucial information necessary for users to succeed.
Critical content demanding immediate user attention due to potential risks.
Negative potential consequences of an action.
Basic Syntax
:::note
Highlights information that users should take into account, even when skimming.
:::
:::tip
Optional information to help a user be more successful.
:::Custom Titles
The title of the admonition can be customized.
MY CUSTOM TITLE
This is a note with a custom title.
:::note[MY CUSTOM TITLE]
This is a note with a custom title.
:::GitHub Syntax
[!TIP] The GitHub syntax is also supported.
> [!NOTE]
> The GitHub syntax is also supported.
> [!TIP]
> The GitHub syntax is also supported.Spoiler
You can add spoilers to your text. The text also supports Markdown syntax.
The content
The content :spoiler[is hidden **ayyy**]!
Here, we'll explore how code blocks look using Expressive Code. The provided examples are based on the official documentation, which you can refer to for further details.
Expressive Code
Syntax Highlighting
Regular syntax highlighting
console.log('This code is syntax highlighted!')Rendering ANSI escape sequences
ANSI colors:
- Regular: Red Green Yellow Blue Magenta Cyan
- Bold: Red Green Yellow Blue Magenta Cyan
- Dimmed: Red Green Yellow Blue Magenta Cyan
256 colors (showing colors 160-177):
160 161 162 163 164 165
166 167 168 169 170 171
172 173 174 175 176 177
Full RGB colors:
ForestGreen - RGB(34, 139, 34)
Text formatting: Bold Dimmed Italic UnderlineEditor & Terminal Frames
Code editor frames
console.log('Title attribute example')<!-- src/content/index.html -->
<div>File name comment example</div>Terminal frames
echo "This terminal frame has no title"Write-Output "This one has a title!"Overriding frame types
echo "Look ma, no frame!"# Without overriding, this would be a terminal frame
function Watch-Tail { Get-Content -Tail 20 -Wait $args }
New-Alias tail Watch-TailText & Line Markers
Marking full lines & line ranges
// Line 1 - targeted by line number
// Line 2
// Line 3
// Line 4 - targeted by line number
// Line 5
// Line 6
// Line 7 - targeted by range "7-8"
// Line 8 - targeted by range "7-8"Selecting line marker types (mark, ins, del)
function demo() {
console.log('this line is marked as deleted')
// This line and the next one are marked as inserted
console.log('this is the second inserted line')
return 'this line uses the neutral default marker type'
}Adding labels to line markers
// labeled-line-markers.jsx
<button
role="button"
{...props}
value={value}
className={buttonClassName}
disabled={disabled}
active={active}
>
{children &&
!active &&
(typeof children === 'string' ? <span>{children}</span> : children)}
</button>Adding long labels on their own lines
// labeled-line-markers.jsx
<button
role="button"
{...props}
value={value}
className={buttonClassName}
disabled={disabled}
active={active}
>
{children &&
!active &&
(typeof children === 'string' ? <span>{children}</span> : children)}
</button>Using diff-like syntax
+this line will be marked as inserted
-this line will be marked as deleted
this is a regular line--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+this is an actual diff file
-all contents will remain unmodified
no whitespace will be removed eitherCombining syntax highlighting with diff-like syntax
function thisIsJavaScript() {
// This entire block gets highlighted as JavaScript,
// and we can still add diff markers to it!
- console.log('Old code to be removed')
+ console.log('New and shiny code!')
}Marking individual text inside lines
function demo() {
// Mark any given text inside lines
return 'Multiple matches of the given text are supported';
}Regular expressions
console.log('The words yes and yep will be marked.')Escaping forward slashes
echo "Test" > /home/test.txtSelecting inline marker types (mark, ins, del)
function demo() {
console.log('These are inserted and deleted marker types');
// The return statement uses the default marker type
return true;
}Word Wrap
Configuring word wrap per block
// Example with wrap
function getLongString() {
return 'This is a very long string that will most probably not fit into the available space unless the container is extremely wide'
}// Example with wrap=false
function getLongString() {
return 'This is a very long string that will most probably not fit into the available space unless the container is extremely wide'
}Configuring indentation of wrapped lines
// Example with preserveIndent (enabled by default)
function getLongString() {
return 'This is a very long string that will most probably not fit into the available space unless the container is extremely wide'
}// Example with preserveIndent=false
function getLongString() {
return 'This is a very long string that will most probably not fit into the available space unless the container is extremely wide'
}Collapsible Sections
// All this boilerplate setup code will be collapsed
import { someBoilerplateEngine } from '@example/some-boilerplate'
import { evenMoreBoilerplate } from '@example/even-more-boilerplate'
const engine = someBoilerplateEngine(evenMoreBoilerplate())
// This part of the code will be visible by default
engine.doSomething(1, 2, 3, calcFn)
function calcFn() {
// You can have multiple collapsed sections
const a = 1
const b = 2
const c = a + b
// This will remain visible
console.log(`Calculation result: ${a} + ${b} = ${c}`)
return c
}
// All this code until the end of the block will be collapsed again
engine.closeConnection()
engine.freeMemory()
engine.shutdown({ reason: 'End of example boilerplate code' })Line Numbers
Displaying line numbers per block
// This code block will show line numbers
console.log('Greetings from line 2!')
console.log('I am on line 3')// Line numbers are disabled for this block
console.log('Hello?')
console.log('Sorry, do you know what line I am on?')Changing the starting line number
console.log('Greetings from line 5!')
console.log('I am on line 6')