This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
blog/_posts/2021-09-21-markdown.md
2023-06-03 15:58:09 +08:00

5.4 KiB
Raw Permalink Blame History

layout, title, subtitle, date, author, catalog, header-img, tags
layout title subtitle date author catalog header-img tags
post Markdown语法简记 Hello, Future~ 2021-09-21 12:00:00 Manford Fan false img/post-bg-universe.jpg
Programming
Tools

Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,该语言在 2004 由约翰·格鲁伯英语John Gruber创建。Markdown 编写的文档可以导出 HTML、Word、图像、PDF、Epub 等多种格式的文档,其编写的文档后缀为 .md 或者 .markdown。很多静态网站的博文都是用 Markdown 来编写的,包括一些论坛或者网站的评论也支持 Markdown。

标题

使用=和-号表示

一级标题
=========

二级标题
--------- 

使用#号表示

# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题

字体

字体可以设置加粗,斜体以及删除线,三者可以搭配使用。

**加粗**
*斜体*
~~删除线~~

加粗

斜体

删除线

段落

使用自然的一行空格进行分隔段落,段落开头的最佳实践是顶格写,不留空白;段落与标题之间的最佳实践是留一行空行。

这是第二段,而且和其后的标题之间也留一行空行。

分割线

单独的三个及以上的“-”,“+”或者“*”可以形成一条分割线,可以参考如下。


---
+++
***

列表

有序列表

有序列表使用数字并加上 . 号来表示,如:

1. 第一项
2. 第二项
3. 第三项
  1. 第一项
  2. 第二项
  3. 第三项

无序列表

无序列表使用星号(*)、加号(+)或是减号(-)作为列表标记,这些标记后面要添加一个空格,然后再填写内容:

* 第一项
* 第二项
* 第三项
  • 第一项
  • 第二项
  • 第三项

区块引用

区块引用是在段落开头使用 > 符号 ,然后后面紧跟一个空格符号:

> 这是一个区块引用
>
> 这是第二个区块引用
>
> 这是第三个区块引用

这是一个区块引用

这是第二个区块引用

这是第三个区块引用

代码

代码片段

如果是段落上的一个函数或片段的代码可以用反引号把它包起来(`),例如:

`print()` 函数

print() 函数

代码块

代码块用三个反引号(`)对来把代码块包裹起来,例如:

\```cpp
#include <stdio.h>
uint32_t u = 0x40490fdb;
float a = *reinterpret_cast<float*>(&u);
std::cout << a;  // 3.14159
\```
#include <stdio.h>
uint32_t u = 0x40490fdb;
float a = *reinterpret_cast<float*>(&u);
std::cout << a;  // 3.14159

超链接

超链接由一个方括号和一个圆括号构成,方括号是超链接的显示部分,圆括号里面放着超链接的地址。

这是一个链接 [网站导航](https://nav.rustle.cc)

这是一个链接 网站导航

脚注

脚注使您可以添加注释和参考,而不会使文档正文混乱。当您创建脚注时,带有脚注的上标数字会出现在您添加脚注参考的位置。读者可以单击链接以跳至页面底部的脚注内容。

Here's a simple footnote,[^1] and here's a longer one.[^bignote]

[^1]: This is the first footnote.

[^bignote]: Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    `{ my code }`

    Add as many paragraphs as you like.

Here's a simple footnote,1 and here's a longer one.2

参考文章最后的注脚~

任务列表

任务列表使您可以创建带有复选框的项目列表。在支持任务列表的Markdown应用程序中复选框将显示在内容旁边。

- [x] Write the press release
- [ ] Update the website
- [ ] Contact the media
  • Write the press release
  • Update the website
  • Contact the media

图片

开头是一个英文的感叹号,紧接着的方括号内的描述性文字是可选的,超链接后面还可以跟上标题属性文字。

![nav 图标](https://nav.rustle.cc/assets/images/favicon.png "title")

nav 图标

表格

表格分为表头,对齐格式以及主体,每一列之间使用竖线分隔。

| left     | center     |right  |
| :------- | :-----:    |---:   |
| 左对齐   | 居中对齐   |右对齐 |
left center right
左对齐 居中对齐 右对齐

Emoji

一些Markdown应用程序允许您通过键入表情符号短代码来插入表情符号。这些以冒号开头和结尾并包含表情符号的名称。

🖐去露营了! :tent: 很快回来。

真好笑! :joy:

🖐去露营了! 很快回来。

真好笑! 😂

目测不支持代码转义,但是直接复制过来还是支持的~

Finals

另外Markdown 还可以结合 Html 使用,还有流程图等等,暂时用不到,先记录这么多,够用就好。


  1. This is the first footnote. And part content of this article comes from https://markdown.com.cn/ ↩︎

  2. Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    { my code }

    Add as many paragraphs as you like. ↩︎