1. Markdown介绍
Markdown是一种轻量级标记语言,排版语法简洁,能让人们更多的关注内容本身而非排版。它使用易读易写的纯文本格式编写文档,可以和HTML汇编,可导出HTML、PDF以及本生的.md格式文件。其简洁、高效、易写的特性Markdown被大量使用,如GitHub、Wikipedia、简书等。
2.Markdown标记语法
要创建标题,需要在单词或短语前添加井号 #。其中 # 的数量代表了标题的级别。例如,##标识创建一个二集标题<h2>。注意:不同的Markdown应用程序处理#和标题之间的空格方式不一致。为了兼容 考虑,需要一个空格在#和标题之间进行分割
3. Makrdown段落
创建段落,使用空白行将一行或多行进行分割。
eg
I really like using Markdown.
I Think I'll use it to format all of my documents form now on.
注意:段落中不要使用空格(space)和制表符(tabs)缩进段落
4. Markdown换行语法
在一行的末尾添加两个或多个空格,然后按回车健,即可创建一个换行<br>
This is the fisrt line.
And this is the second line.
5. Markdown强调语法
通过将文本设置为粗体或斜体来强调其重要性。
粗体
要加粗文本,在需要加粗的文本的两侧添加两个星号或则下划线。
| Markdown语法 | HTML | 预览效果 |
|---|---|---|
| I just love **bold text**. | I just <strong>bold text<strong>. | I just love bold text. |
斜体
要用斜体显示文本,需要在单词或短语前后添加一个星号。
| Markdown语法 | HTML | 预览效果 |
|---|---|---|
| Italicized text is the *cat's meow* | Italicized text is the <em>cat's meow*. | Italicized text is the cat's meow |
粗体+斜体
当需要同时使用粗体和斜体时,在需要使用的单词或短语两侧各添加三个星号
eg: This text is really important
6. Markdown引用语法
要创建块应用,需要在段落前添加要给 > 符号
Dorothy followed her through many of the beautiful rooms in her castle.
多个段落块的引用
块应用可以包含多个段落。
在段落之间的空白行添加一个>符号即可。
Dorothy followed her through many of the beautiful rooms in her castle.
The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
嵌套块引用
块引用可以嵌套。在要嵌套的段落前添加一个>>符号。
Dorothy followed her through many of the beautiful rooms in her castle.
The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
带有其它元素的块引用
块引用可以包含其它Markdown格式的元素。但是并非所有的元素都可以使用,需要进行实验以查看哪些元素有效
Dorothy followed her through many of the beautiful rooms in her castle.
- Revenu was off the chart
- Profits were higher than ever.
- Everything is going according to plan
7. 列表语法
使用列表可以将多个条目组织成有序或无序的列表
1.有序列表
要创建有序列表,请在每个列表项前添加数字并紧跟一个英文句点。数字不必按数学顺序排列,但是列表应当以数字1开始。
- First Item
- seconde Item
- Third Item
2. 无序列表
要创建无需列表,请在每个列表前添加-、*或+。缩进一个或多个列表项可创建列表嵌套
- First Item
- Second Item
- Indented item1
- Indented item2
- Third Item
3. 在列表中添加其它元素
要保留列表连续性的同时在列表中添加另一种元素,请将该元素缩进四个空格或一个制表符
嵌套引用
- This is the first list item.
- Here's the second list item.
I need to add another paragraph below the second list item.
- Last item
嵌套代码块
- First Item
- Second Item
const fn = () => {} - Third Item
8. 分割线语法
要创建分割线,请在单独一行上使用三个***、---或则___并且不能包含其它内容
test111
test222
9. 链接语法
链接文本在括号内,链接地址放在后面的括号中,链接title可选。语法模板:[超链接显示名](超链接地址 '超链接title')
eg
- 这是一个链接Markdown语法。
- baidu链接 (HTML标签生成)
网址和Emai地址
markdown.com.cn
fake@example.com
带格式化的链接
强调链接,使用强调语法,要将链接显示为代码使用反映好
eg
- I love supporting the EFF
- This is the Markdown Guid
- See the section on
code
10. 图片语法
要添加图像,请使用感叹号!然后再方括号增加代替文本,图片链接放在圆括号里,括号里的链接后可以增加一个可选的图片标题文本。语法模板:
eg:
给图片添加链接
[](要链接的地址)
11. 转义字符语法
要显示原本用于格式化的Markdown文档的字符,请在字符前添加反斜杠字符\
* First Item (no) & no
12. Markdown内嵌HTML标签
对于Markdown涵盖范围之外的标签,都可以直接在文件里使用THML本身。如需使用HTML,不需要额外标注这是HTML或是Markdown,只需将HTML添加到Markdown文本中即可。
例如:如果喜欢使用HTML的<a>或则<img>标签,可以直接使用这些标签,而不用使用Markdown提供的链接或图片语法。
注意:HTMl行级内联标签和区块标签不同,在内敛标签的范围内,Markdown的语法是可以解析的,在块标签中Markdown语法不会生效
eg:
- This is word is bold. This word is italic.
**test**这里的test强调不会生效
参考资料:Markdown官方教程