Markdown语法详解!
简介
Markdown有两层意思:一是轻量级、纯文本语法格式的标记语言;二是编辑并解析markdown语法,展示最终文字排版效果的客户端。markdown使得文字排版标准化,可以轻松转换成HTML或其他格式。让你专注于文字内容,而无需浪费时间在文字排版上。
标题
语法:#
- markdown写法:
# Heading level 1 ## Heading level 2 ### Heading level 3 #### Heading level 4 ##### Heading level 5 ###### Heading level 6
- markdown写法:
段落1。段落2。
- 实际效果:
【Markdown语法详解!】段落1。
换行 语法:正常段落换行用
2空格+回车
;表格中换行用
。- markdown写法:
This is the first line. And this is the second line.This is the first line.
And this is the second line.
- 实际效果:
This is the first line.
And this is the second line.
This is the first line.
And this is the second line.
*
或者_
包含斜体内容- markdown写法:
Italicized text is the *cat's meow*. Italicized text is the _cat's meow_.
- 实际效果:
Italicized text is the cat's meow.
Italicized text is the _cat's meow_.
**
或者__
包含加粗内容;- markdown写法:
I just love **bold text**. I just love __bold text__.
- 实际效果:
I just love bold text.
I just love __bold text__.
***
或___
包含内容- markdown写法:
This text is ***really important***. This text is ___really important___. This text is __*really important*__. This text is **_really important_**.
- 实际效果:
This text is really important.
This text is ___really important___.
This text is __really important__.
This text is really important.
- 实际效果:
- 段落开始处加上
>
- 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.
- Markdown写法
- 多个段落引用
- Markdown写法
> 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写法
- 段落嵌套引用
- Markdown写法
> 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写法
- 引用与其他元素配合使用
- Markdown写法
> **The quarterly results look great!** > > - Revenue was off the chart. > - Profits were higher than ever. > >*Everything* is going according to **plan**.
- 实际效果:
The quarterly results look great!
- Revenue was off the chart.
- Profits were higher than ever.
Everything is going according to plan.
- Markdown写法
- 有序列表
- Markdown写法
1. First item 2. Second item 3. Third item 4. Fourth item
- 实际效果:(因为缩进下面本应该显示1,2,3这样的序列)
- First item
- Second item
- Third item
- Fourth item
- Markdown写法
- 无序列表(
-
、+
、*
用这三种符号实现)
- Markdown写法(下面只用
-
说明)
- First item - Second item - Third item - Indented item - Indented item - Fourth item
- 实际效果:
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
- Markdown写法(下面只用
- 列表中插入段落
- Markdown写法
*This is the first list item. *Here's the second list item.I need to add another paragraph below the second list item.*And here's the third list item.
- 实际效果:
- This is the first list item.
- Here's the second list item.
I need to add another paragraph below the second list item.
- And here's the third list item.
- Markdown写法
- 列表中插入块引用
- Markdown写法
*This is the first list item. *Here's the second list item.> I need to add another paragraph below the second list item.*And here's the third list item.
- 实际效果:
- This is the first list item.
- Here's the second list item.
I need to add another paragraph below the second list item.
- And here's the third list item.
- Markdown写法
- 用 `包括一个词或短语
- Markdown写法
At the command prompt, type `nano`.
- 实际效果:
At the command prompt, typenano
.
- Markdown写法
- 用
`
包含代码块
- Markdown写法
Test - 锐客网
- 实际效果:
Test - 锐客网
- Markdown写法
***
、---
、___
- Markdown写法
*** --- ___
- 实际效果:
_
- 格式:
[链接名](URL)
- Markdown写法
My favorite search engine is [Duck Duck Go](https://duckduckgo.com).
- 实际效果:
My favorite search engine is Duck Duck Go.
- Markdown写法
- 格式:
[链接名](URL "Title")
增加链接Title(鼠标悬浮时显示)
- Markdown写法
My favorite search engine is [Duck Duck Go](https://duckduckgo.com "The best search engine for privacy").
- 实际效果:
My favorite search engine is Duck Duck Go.
- Markdown写法
- 链接配合其他元素使用
- Markdown写法
I love supporting **[EFF](https://eff.org)**. This is the *[Markdown Guide](https://www.markdownguide.org)*.
- 实际效果:
I love supporting EFF.
This is the Markdown Guide.
- Markdown写法
- 链接嵌套
- Markdown写法
[![百度首页](www.baidu.com/img/baidu_jgylogo3.gif "百度首页")](www.baidu.com)
- 实际效果:
文章图片
- Markdown写法
- 原文加链接优化
- Markdown写法
In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to eat: it was a [hobbit-hole](https://en.wikipedia.org/wiki/Hobbit#Lifestyle "Hobbit lifestyles"), and that means comfort.上面的写法和下面的写法,展示效果是一样的,但是上面把链接插入在原文中很不好阅读,可以用下面方式,方便修改阅读:In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to eat: it was a [hobbit-hole][1], and that means comfort.[1]:"Hobbit lifestyles"
- 实际效果:
In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends
of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to
eat: it was a hobbit-hole, and that means comfort.
- Markdown写法
[1]:"Hobbit lifestyles"
URL变链接 语法:
- Markdown写法
- 实际效果:
https://www.markdownguide.org
mailto:fake@example.com
![图片名](URL)
- Markdown写法
1.Open the file containing the Linux mascot. 2.Marvel at its beauty.![Tux, the Linux mascot](http://www.baidu.com/img/baidu_jgylogo3.gif)3.Close the file.
- 实际效果:
- Open the file containing the Linux mascot.
- Marvel at its beauty.
文章图片
- Close the file.
\
用反斜杠可以反引用下面特殊字符- Markdown写法
* Without the backslash, this would be a bullet in an unordered list. \* Without the backslash, this would be a bullet in an unordered list.
- 实际效果:
- Without the backslash, this would be a bullet in an unordered list.
* Without the backslash, this would be a bullet in an unordered list.
- Without the backslash, this would be a bullet in an unordered list.
- 可以处理的特殊字符
\`*-{}[]()#+-·!
html: true
1、 Markdown 文件里加上 HTML 表格:
- markdown写法:
这是一个普通段落。
Foo
- 实际效果
这是一个普通段落。
Foo
- markdown写法:
1. 插入视频
- 实际效果:
|
来分隔不同的单元格,使用 -
来分隔表头和其他行。- markdown写法:
| 左对齐 | 右对齐 | 居中对齐 | | :-----| ----: | :----: | | 单元格 | 单元格 | 单元格 | | 单元格 | 单元格 | 单元格 |-: 设置内容和标题栏居右对齐。 :- 设置内容和标题栏居左对齐。 :-: 设置内容和标题栏居中对齐。
- 实际效果:
| 左对齐 | 右对齐 | 居中对齐 |
| :-----| ----: | :----: |
| 单元格 | 单元格 | 单元格 |
| 单元格 | 单元格 | 单元格 |
- Markdown语法详解!
推荐阅读
- 标签、语法规范、内联框架、超链接、CSS的编写位置、CSS语法、开发工具、块和内联、常用选择器、后代元素选择器、伪类、伪元素。
- 六步搭建ES6语法环境
- Java|Java OpenCV图像处理之SIFT角点检测详解
- C语言浮点函数中的modf和fmod详解
- 2018-06-29|2018-06-29 这是我的第一篇文章 markdown
- 虚拟DOM-Diff算法详解
- LSTM网络层详解及其应用实例
- OC:|OC: WKWebView详解
- vue中的条件判断详解v-if|vue中的条件判断详解v-if v-else v-else-if v-show
- Vue组件之事件总线和消息发布订阅详解