文章目录
一、markdown标题
一级标题:
># 一级标题:
二级标题:
>## 二级标题:
三级标题:
>### 三级标题:
四级标题:
>#### 四级标题:
五级标题:
>##### 五级标题:
六级标题:
>###### 六级标题:
二、markdown字体和段落
- 斜体:一个_或*包裹:斜体 和 斜体
_斜体_和*斜体*
- 粗体:两个_或*包裹:粗体 和 粗体
**粗体**和_粗体_
- 粗斜体:三个_或*包裹:粗斜体
***粗斜体***和___粗斜体___
- 删除线: 使用两个~~包裹,如~~删除线~~→
删除线~~删除线~~
- 分割线:使用三个以上的 “- “,”*” 和 “_”,如
---
效果如下
在文本中加粗(bold)或倾斜(Italic)时建议使用" * "
三、markdown列表
-
有序列表
在列表项前加数字和英文“.”,如“1.”- 列表项1
- 列表项2
-
无序列表
在列表项前加“*”,“-”,“+”,如“- 列表项1”- 列表项1
- 列表项2
- 列表项3
-
列表嵌套
在子列表选项前缩进四个空格即可,如- 一级
- 二级
- 三级
- 二级
- 一级
-
任务列表
语法:
- [x] text(x可去,x代表已选择)如
- [x] Write the press release
- [ ] Update the website
- [ ] Contact the media- Write the press release
- Update the website
- Contact the media
-
定义列表
语法:
列表名
:子列表内容
注意:定义列表必须与上下文用空行区分
如
First Term
: This is the definition of the first term.
Second Term
: This is one definition of the second term.
: This is another definition of the second term.
-
First Term
- This is the definition of the first term. Second Term
- This is one definition of the second term.
- This is another definition of the second term.
四、markdown中插入代码
- 将单词或短语标注为代码块,使用一个“ ` ”包裹
如调用date
对象调用`date `对象
- 当代码中有引号时,使用两个"`"包裹转义
如,function 'a'
``function ‘a’ ``
- 创建代码块,每行至少缩进4个空格或1个制表符(tab)或用三个“ ` ”包裹
代码:
```
<html>
<head>
</head>
</html>
```效果: <html> <head> </head> </html>
- 语法高亮
一般markdown编辑器自带语法高亮,最好在反引号后说明语言类型
{ "firstName": "John", "lastName": "Smith", "age": 25 }
五、markdown链接
- 超链接:
语法: [超链接显示名](超链接地址 “超链接title”)
title是可选的,当title有值时鼠标悬停时显示内容
如:
[GitHub](https://github.com/explore “探索GitHub”)
效果:
GitHub - 网址和email:
语法: < 链接url >
如
CSDN官网:<https://www.csdn.net/>
我的邮箱:<1715970551@qq.com>
效果:
CSDN官网:https://www.csdn.net/
我的邮箱:1715970551@qq.com - 带格式化的链接
1.强调链接:在链接语法前后加“ * ”,如
效果如下斜体链接:*[GitHub](https://github.com/explore "探索GitHub")* 粗体链接:**[GitHub](https://github.com/explore "探索GitHub")** 删除线链接:~~[GitHub](https://github.com/explore "探索GitHub")~~ 详情参考第二部分:markdown字体和段落.
斜体链接:GitHub
粗体链接:GitHub
删除线链接:GitHub - 引用类型链接
六、markdown图片
-
插入图片
语法: ![图片alt](图片链接 “图片title”)
如:
![图片](./images/illust_62799720_20191019_123028.jpg “beautiful”) -
链接图片
语法: [![图片alt](图片链接 “图片title”)](链接地址)
如
[[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3gpEVtue-1619620960061)(“www.4399.com”)]
七、markdown转义符
- 一般都用“\”进行转义
如"\\"和“\[”,“\{”等
- 特殊字符自动转义
markdown会将< 和 &自动转义
八、markdown与html标签 {#eight}
- 行级內联标签可以任意使用
- 在markdown中使用区块标签必须在前后加上空行
在行级内联标签内可以使用markdown语法。在块级标签内不能。
九、markdown表格
- 使用三个或多个连字符(—)创建每列的标题,使用管道(|)分隔每列
效果如下:如: | Syntax | Description | | ----------- | ----------- | | Header | Title | | Paragraph | Text |
Syntax Description Header Title Paragraph Text - 在标题行中的连字符的左侧,右侧或两侧添加冒号(:),将列中的文本对齐到左侧,右侧或中心。
效果如下:如 | Syntax | Description | Test Text | | :--- | :----: | ---: | | Header | Title | Here's this | | Paragraph | Text | And more |
Syntax Description Test Text Header Title Here’s this Paragraph Text And more
如果要在表格中使用“|”符号,可以使用表格的HTML字符代码(|)
十、markdown标题
-
使用大括号给标题添加id
My Great Heading {#custom-id}
-
使用标题id,链接时跳转到指定标签
[text](#id)
如
# 八、markdown与html标签 {#eight} [跳转到第八个标题](#eight)
结果: 跳转到第八个标题