【笔记】Markdown学习笔记

前言

Markdown是一种轻量级标记语言,创始人为约翰·格鲁伯。它允许人们使用易读易写的纯文本格式编写文档,然后转换成有效的XHTML(或者HTML)文档。(维基百科

标准语法

标题

1
2
3
4
5
6
# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题
1
2
3
4
5
6
<h1 id="一级标题">一级标题</h1>
<h2 id="二级标题">二级标题</h2>
<h3 id="三级标题">三级标题</h3>
<h4 id="四级标题">四级标题</h4>
<h5 id="五级标题">五级标题</h5>
<h6 id="六级标题">六级标题</h6>
1
2
一级标题
===
1
<h1 id="一级标题">一级标题</h1>
1
2
二级标题
---
1
<h2 id="二级标题">二级标题</h2>

段落

  • 一个空格、多个空格、一个换行都会渲染为空格,只有多个换行才会渲染为换行
1
2
3
4
文本内容1
文本内容2 文本内容3

文本内容4 文本内容5
1
2
<p>文本内容1 文本内容2 文本内容3</p>
<p>文本内容4 文本内容5</p>

字体

斜体

1
_文本内容_
1
*文本内容*
1
<em>文本内容</em>

粗体

1
__文本内容__
1
**文本内容**
1
<strong>文本内容</strong>
粗斜体
1
___文本内容___
1
***文本内容***
1
<strong><em>文本内容</em></strong>

分隔线

1
---
1
<hr />

列表

无序列表

1
2
* 文本内容
* 文本内容
1
2
+ 文本内容
+ 文本内容
1
2
- 文本内容
- 文本内容
1
2
3
4
5
6
7
8
<ul>
<li>
文本内容
<ul>
<li>文本内容</li>
</ul>
</li>
</ul>

有序列表

1
2
3
4
1. 文本内容1
2. 文本内容2
1. 文本内容3
2. 文本内容4
1
2
3
4
5
6
7
8
9
10
<ol type="1">
<li>文本内容1</li>
<li>
文本内容2
<ol type="1">
<li>文本内容3</li>
<li>文本内容4</li>
</ol>
</li>
</ol>

链接

行内式链接

1
[文本内容](https://example.com/)
1
<a href="https://example.com/">文本内容</a>

参考式链接

1
2
3
[文本内容][1]

[1]: https://example.com/ "标题"
1
<a href="https://example.com/" title="标题">文本内容</a>

自动链接

1
<https://example.com/>
1
<a href="https://example.com/">https://example.com/</a>

图片

1
![替换文本](https://example.com/image.webp)
1
<img src="https://example.com/image.webp" alt="替换文本">
  • 替换文本可以省略
1
![](https://example.com/image.webp)
1
<img src="https://example.com/image.webp" alt="">

图片链接

1
[![](https://example.com/image.webp)](https://example.com/)
1
2
3
<a href="https://example.com/">
<img src="https://example.com/image.webp" alt="">
</a>

代码

行内代码

`print()`
1
2
3
<p>
<code>print()</code>
<p>

代码块

```
print()
```
1
print()
1
2
3
<pre>
<code>行内代码</code>
</pre>

引用

1
2
> 引用内容1
> 引用内容2
1
2
3
4
<blockquote>
<p>引用内容1</p>
<p>引用内容2</p>
</blockquote>

脚注

1
2
3
文本内容[^1]

[^1]: 脚注内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<p>
文本内容
<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref">
<sup>1</sup>
</a>

<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
<hr/>
<ol>
<li id="fn1">
<p>
脚注内容
<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a>
</p>
</li>
</ol>
</section>

扩展语法

字体

删除线

1
~~文本内容~~
1
<del>文本内容</del>

列表

任务列表

1
2
- [x] 已完成任务
- [ ] 未完成任务
1
2
3
4
<ul class="task-list">
<li><label><input type="checkbox" checked=""/>已完成任务</label></li>
<li><label><input type="checkbox"/>未完成任务</label></li>
</ul>

链接

锚点

1
2
3
# 锚点位置

[文本内容](#锚点位置)
1
2
3
<h1 id="锚点位置">锚点位置</h1>

<a href="#锚点位置">文本内容</a>

代码

高亮代码块

```python
print()
```
1
2
3
4
5
6
7
8
9
10
11
<div class="sourceCode" id="cb1">
<pre class="sourceCode python">
<code class="sourceCode python">
<span id="cb1-1">
<a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>
<span class="bu">print</span>
()
</span>
</code>
</pre>
</div>

表格

1
2
3
4
|A|B|
|---|---|
|A1|B1|
|A2|B2|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>A1</td>
<td>B1</td>
</tr>
<tr>
<td>A2</td>
<td>B2</td>
</tr>
</tbody>
</table>
1
2
3
4
|A|B|C|
|:---|:---:|---:|
|A1|B1|C1|
|A2|B2|C2|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<table>
<thead>
<tr>
<th style="text-align: left;">A</th>
<th style="text-align: center;">B</th>
<th style="text-align: right;">C</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">A1</td>
<td style="text-align: center;">B1</td>
<td style="text-align: right;">C1</td>
</tr>
<tr>
<td style="text-align: left;">A2</td>
<td style="text-align: center;">B2</td>
<td style="text-align: right;">C2</td>
</tr>
</tbody>
</table>

Mermaid流程图

```mermaid
graph TD
  Collection --> List
  Collection --> Set
  Collection --> Map
```
1
2
3
4
5
6
7
8
<pre class="mermaid">
<code>
graph TD
Collection --&gt; List
Collection --&gt; Set
Collection --&gt; Map
</code>
</pre>

LaTeX数学公式

行内公式

1
$a^2 + b^2 = c^2$
1
2
3
4
5
6
7
<span class="math inline">
<em>a</em><sup>2</sup>
+
<em>b</em><sup>2</sup>
=
<em>c</em><sup>2</sup>
</span>

公式块

1
2
3
$$
a^2 + b^2 = c^2
$$
1
2
3
4
5
6
7
8
9
10
<span class="math display">
<em>a</em>
<sup>2</sup>
+
<em>b</em>
<sup>2</sup>
=
<em>c</em>
<sup>2</sup>
</span>

Emoji表情

1
:smile:

嵌入HTML

  • 直接就可以嵌入HTML标签
1
<div></div>

完成

参考文献

IDEA Preferences
CSDN——珍妮玛•黛金