markdown语法

makedown语法

Markdown是一种轻量级标记语言,排版语法简洁,让人们更多地关注内容本身而非排版。它使用易读易写的纯文本格式编写文档,可与HTML混编,可导出 HTML、PDF 以及本身的 .md 格式的文件。因简洁、高效、易读、易写,Markdown被大量使用,如Github、Wikipedia、简书等.

标题语法

要创建标题,请在单词或短语前面添加井号 (#) 。# 的数量代表了标题的级别。例如,添加三个 # 表示创建一个三级标题 (<h3>) (例如:### My Header)。

Markdown语法HTML预览效果
# Heading level 1<h1>Heading level 1</h1>Heading level 1
## Heading level 2<h2>Heading level 2</h2>Heading level 2
### Heading level 3<h3>Heading level 3</h3>Heading level 3
#### Heading level 4<h4>Heading level 4</h4>Heading level 4
##### Heading level 5<h5>Heading level 5</h5>Heading level 5
###### Heading level 6<h6>Heading level 6</h6>Heading level 6

段落语法

要创建段落,请使用空白行将一行或多行文本进行分隔。

Markdown语法HTML预览效果
I really like using Markdown.I think I'll use it to format all of my documents from now on.<p>I really like using Markdown.</p><p>I think I'll use it to format all of my documents from now on.</p>I really like using Markdown.I think I’ll use it to format all of my documents from now on.

换行语法

在一行的末尾添加两个或多个空格,然后按回车键,即可创建一个换行(<br>)。(我觉得可以就是直接使用回车换行)

Markdown语法HTML预览效果
This is the first line. And this is the second line.<p>This is the first line.<br>And this is the second line.</p>This is the first line.And this is the second line.

几乎每个 Markdown 应用程序都支持两个或多个空格进行换行,称为 结尾空格(trailing whitespace) 的方式,但这是有争议的,因为很难在编辑器中直接看到空格,并且很多人在每个句子后面都会有意或无意地添加两个空格。由于这个原因,你可能要使用除结尾空格以外的其它方式来换行。幸运的是,几乎每个 Markdown 应用程序都支持另一种换行方式:HTML 的 <br> 标签。

为了兼容性,请在行尾添加“结尾空格”或 HTML 的 <br> 标签来实现换行。

强调语法

通过对文本内容修改为斜体或者粗体来强调重要性

粗体(Bold)

要加粗文本内容 ,需在文本内容前后各添加两个**或者__(建议使用*号)

Markdown语法HTML预览效果
I just love **bold text**.I just love <strong>bold text</strong>.I just love bold text.
I just love __bold text__.I just love <strong>bold text</strong>.I just love bold text.
Love**is**boldLove<strong>is</strong>boldLoveisbold

斜体(Italic)

要加粗文本内容 ,需在文本内容前后各添加两个*或者_(建议使用*号)

粗体和斜体

要同时用粗体和斜体突出显示文本,请在单词或短语的前后各添加三个星号或下划线。要加粗并用斜体显示单词或短语的中间部分,请在要突出显示的部分前后各添加三个星号,中间不要带空格。(建议使用*号)

Markdown语法HTML预览效果
This text is ***really important***.This text is <strong><em>really important</em></strong>.This text is really important.
This text is ___really important___.This text is <strong><em>really important</em></strong>.This text is really important.
This text is __*really important*__.This text is <strong><em>really important</em></strong>.This text is really important.
This text is **_really important_**.This text is <strong><em>really important</em></strong>.This text is really important.
This is really***very***important text.This is really<strong><em>very</em></strong>important text.This is reallyveryimportant text.

引用语法

要创建块引用,请在段落前添加一个 > 符号。

> Hello World daitou666!!!

输入以上内容后的效果为

Hello World daitou666!!!

同时也支持多个>,如:

> 最近过的还好吗?
> 过的还行,你呢?
>> 一般般

最近过的还好吗?
过的还行,你呢?

一般般

列表语法

可以将多个条目组织成有序或无序列表。

有序列表

要创建有序列表,请在每个列表项前添加数字并紧跟一个英文句点。数字不必按数学顺序排列,但是列表应当以数字 1 起始。(实话来说,我觉得没啥意义哈哈哈)

Markdown语法HTML预览效果
1. First item 2. Second item 3. Third item 4. Fourth item <ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>First itemSecond itemThird itemFourth item
1. First item1. Second item1. Third item1. Fourth item<ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>First itemSecond itemThird itemFourth item
1. First item8. Second item3. Third item5. Fourth item<ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>First itemSecond itemThird itemFourth item
1. First item2. Second item3. Third item 1. Indented item 2. Indented item4. Fourth item<ol><li>First item</li><li>Second item</li><li>Third item<ol><li>Indented item</li><li>Indented item</li></ol></li><li>Fourth item</li></ol>First itemSecond itemThird itemIndented itemIndented itemFourth item

无序列表

要创建无序列表,请在每个列表项前面添加破折号 (-)、星号 (*) 或加号 (+) 。缩进一个或多个列表项可创建嵌套列表。

Markdown语法HTML预览效果
- First item- Second item- Third item- Fourth item<ul><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ul>First itemSecond itemThird itemFourth item
* First item* Second item* Third item* Fourth item<ul><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ul>First itemSecond itemThird itemFourth item
+ First item+ Second item+ Third item+ Fourth item<ul><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ul>First itemSecond itemThird itemFourth item
- First item- Second item- Third item - Indented item - Indented item- Fourth item<ul><li>First item</li><li>Second item</li><li>Third item<ul><li>Indented item</li><li>Indented item</li></ul></li><li>Fourth item</li></ul>First itemSecond itemThird itemIndented itemIndented itemFourth item
在列表中嵌套
- 只因你太美
  - 鸡你太美
     - 你太美

效果如下:

  • 只因你太美
    • 鸡你太美
      • 你太美

要在保留列表连续性的同时在列表中添加另一种元素,请将该元素按住Shift再回车,如下例所示

*   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.

  • This is the first list item.

代码块

代码块通常采用四个空格或一个制表符缩进。当它们被放在列表中时,请将它们缩进八个空格或两个制表符。

1.  Open the file.
2.  Find the following code block on line 21:

        <html>
          <head>
            <title>Test</title>
          </head>

3.  Update the title to match the name of your website.
  1. Open the file.

  2. Find the following code block on line 21:

​ 鸡你太美

  1. Update the title to match the name of your website.
列表

You can nest an unordered list in an ordered list, or vice versa.

1. First item
2. Second item
3. Third item
    - Indented item
    - Indented item
4. Fourth item

渲染效果如下:

  1. First item
  2. Second item
  3. Third item
    • Indented item
    • Indented item
  4. Fourth item
1.  Open the file containing the Linux mascot.
2.  Marvel at its beauty.

    ![Tux, the Linux mascot](下载.png) #此括号内为图片路径,[]为此文档中表示图片的名称

3.  Close the file.
  1. Open the file containing the Linux mascot.

  2. Marvel at its beauty.

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Vd0bAnSY-1665999397200)(下载.png)]

  3. Close the file.

代码语法

要将单词或短语表示为代码,请将其包裹在反引号 ` 中。

Markdown语法HTML预览效果
At the command prompt, type nano.At the command prompt, type <code>nano</code>.At the command prompt, type nano.

转义反引号

如果你要表示为代码的单词或短语中包含一个或多个反引号,则可以通过将单词或短语包裹在双反引号(````)中。

如 :

``code `code` code ``

效果如下:

code `code` code

Markdown语法HTML预览效果
Use `code` in your Markdown file.<code>Use code in your Markdown file.</code>Use code in your Markdown file.

代码块

要创建代码块,请将代码块的每一行缩进至少四个空格或一个制表符。

    <html>
      <head>
      </head>
    </html>

渲染效果如下:

<html>
  <head>
  </head>
</html>

分隔线语法

要创建分隔线,请在单独一行上使用三个或多个星号 (***)、破折号 (---) 或下划线 (___) ,并且不能包含其他内容。

***
---
___

效果图如下




不过为了兼容性,建议在分隔线的上下加入空白行

链接语法

链接文本放在中括号内,链接地址放在后面的括号中,链接title可选。

超链接Markdown语法代码:[超链接显示名](超链接地址 "超链接title") (“超链接title”)可以省略

例如:

[百度](www.baidu.com)

百度

给链接增加 Title

链接title是当鼠标悬停在链接上时会出现的文字,这个title是可选的,它放在圆括号中链接地址后面,跟链接地址之间以空格分隔。

这是一个链接 [Markdown语法](https://baidu.com "最好的markdown教程")。

渲染效果如下:

这是一个链接 Markdown语法

网址和Email地址

使用尖括号可以很方便地把URL或者email地址变成可点击的链接。

<https://www.baidu.com>

渲染效果如下:

https://www.baidu.com

带格式化的链接

强调 链接, 在链接语法前后增加星号。 要将链接表示为代码,请在方括号中添加反引号。

I love supporting the **[EFF](https://eff.org)**.
This is the *[Spring](https://spring.io)*.
See the section on [`code`](#code).

渲染效果如下:

I love supporting the EFF.
This is the Spring.
See the section on code.

图片语法

要添加图像,请使用感叹号 (!), 然后在方括号增加替代文本,图片链接放在圆括号里,括号里的链接后可以增加一个可选的图片标题文本。

插入图片Markdown语法代码:![图片alt](图片链接 "图片title")

对应的HTML代码:<img src="图片链接" alt="图片alt" title="图片title">

![这是图片](下载.png)

渲染效果如下:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-9cHIZQ2u-1665999397201)(下载.png)]

给图片增加链接

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Z6oGhe06-1665999397202)(下载.png)]

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值