Markdown快速入门

Markdown语法

参考:官方教程

标题

在单词或短语前面添加井号 (#) 。# 的数量代表了标题的级别。

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.

强调

  • 粗体(xxx)

    在单词或短语的前后各添加两个星号(asterisks)或下划线(underscores)。如需加粗一个单词或短语的中间部分用以表示强调的话,请在要加粗部分的两侧各添加两个星号(asterisks)

    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
  • 斜体(xxx

    在单词或短语前后添加一个星号(asterisk)或下划线(underscore)。要斜体突出单词的中间部分,请在字母前后各添加一个星号,中间不要带空格

    Markdown语法HTML预览效果
    Italicized text is the *cat's meow*.Italicized text is the <em>cat's meow</em>.Italicized text is the cat’s meow.
    Italicized text is the _cat's meow_.Italicized text is the <em>cat's meow</em>.Italicized text is the cat’s meow.
    A*cat*meowA<em>cat</em>meowAcatmeow
  • 粗体斜体(xxx

    在单词或短语的前后各添加三个星号或下划线。要加粗并用斜体显示单词或短语的中间部分,请在要突出显示的部分前后各添加三个星号,中间不要带空格

    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 really***very***important text.

引用

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

  • 单引用

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

    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 格式的元素。并非所有元素都可以使用,你需要进行实验以查看哪些元素有效。

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

列表

  • 有序列表

    在每个列表项前添加数字并紧跟一个英文句点。数字不必按数学顺序排列,但是列表应当以数字 1 起始

    Markdown语法HTML预览效果
    1. First item2. Second item3. Third item4. 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
  • 列表嵌套其他元素

代码

  • ``

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

    Markdown语法HTML预览效果
    At the command prompt, typenano.At the command prompt, type <code>nano</code>.At the command prompt, type nano.
  • 转义反引号

    Markdown语法HTML预览效果
    Use `code` in your Markdown file.<code>Usecodein your Markdown file.</code>Usecodein your Markdown file.
  • 代码块

    • 将代码块的每一行缩进至少四个空格或一个制表符

          <html>
            <head>
            </head>
          </html>
      
    • ```json
      {
        "firstName": "John",
        "lastName": "Smith",
        "age": 25
      }
      ```
      

分割线

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

***

---

_________________

链接

  • 超链接Markdown语法代码:[超链接显示名](超链接地址 "超链接title")(title可选填)

    这是一个链接 [Markdown语法](https://markdown.com.cn)。
    

    这是一个链接 Markdown语法

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

    这是一个链接 Markdown语法

    • 网址和Email地址

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

      <https://markdown.com.cn>
      <fake@example.com>
      

      https://markdown.com.cn
      fake@example.com

    • 带格式的链接

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

      I love supporting the **[EFF](https://eff.org)**.
      This is the *[Markdown Guide](https://www.markdownguide.org)*.
      See the section on [`code`](#code).
      

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

    • 引用类型链接

      这个链接用 1 作为网址变量 [Google][1]
      这个链接用 runoob 作为网址变量 [Runoob][runoob]
      然后在文档的结尾为变量赋值(网址)
      
      [1]: http://www.google.com/
      [runoob]: http://www.runoob.com/
      

      这个链接用 1 作为网址变量 Google
      这个链接用 runoob 作为网址变量 Runoob
      然后在文档的结尾为变量赋值(网址)

图片

  • 插入图片Markdown语法代码:[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OUwIThZ7-1633699369532)(图片链接 "图片title")]

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6hzeNhd8-1633699369536)(https://markdown.com.cn/assets/img/shiprock.c3b9a023.jpg "Magic Gardens")]
    

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-2kRMZRB8-1633699369537)(https://markdown.com.cn/assets/img/shiprock.c3b9a023.jpg “Magic Gardens”)]

  • 链接图片:给图片增加链接,点击跳转到链接

    [[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-aMeBjFt2-1633699369540)(https://markdown.com.cn/assets/img/shiprock.c3b9a023.jpg "Shiprock")]](https://markdown.com.cn)
    

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-2wE0Km0W-1633699369542)(https://markdown.com.cn/assets/img/shiprock.c3b9a023.jpg “Shiprock”)]

    转义字符\

    • 可转义的字符

      CharacterName
      \backslash
      `backtick (see also escaping backticks in code)
      *asterisk
      _underscore
      { }curly braces
      [ ]brackets
      ( )parentheses
      #pound sign
      +plus sign
      -minus sign (hyphen)
      .dot
      !exclamation mark
      |pipe (see also escaping pipe in tables)
    • 特殊字符自动转义

      字符需要特殊处理: <&< 符号用于起始标签,& 符号则用于标记 HTML 实体,如果你只是想要使用这些符号,你必须要使用实体的形式,像是 <&

      http://images.google.com/images?num=30&q=larry+bird
      

      http://images.google.com/images?num=30&q=larry+bird

    内嵌HTML标签

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值