首页 > 其他分享 >6、Markdown 列表语法

6、Markdown 列表语法

时间:2023-04-13 17:36:48浏览次数:46  
标签:Markdown Third list 列表 语法 item Second Fourth First

Markdown 列表语法

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

有序列表

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

Markdown语法 HTML 预览效果
1. First item<br>2. Second item<br>3. Third item<br>4. Fourth item <ol><br><li>First item</li><br><li>Second item</li><br><li>Third item</li><br><li>Fourth item</li><br></ol> 1. First item
2. Second item
3. Third item
4. Fourth item
1. First item<br>1. Second item<br>1. Third item<br>1. Fourth item <ol><br><li>First item</li><br><li>Second item</li><br><li>Third item</li><br><li>Fourth item</li><br></ol> 1. First item
2. Second item
3. Third item
4. Fourth item
1. First item<br>8. Second item<br>3. Third item<br>5. Fourth item <ol><br><li>First item</li><br><li>Second item</li><br><li>Third item</li><br><li>Fourth item</li><br></ol> 1. First item
2. Second item
3. Third item
4. Fourth item
1. First item<br>2. Second item<br>3. Third item<br>    1. Indented item<br>    2. Indented item<br>4. Fourth item <ol><br><li>First item</li><br><li>Second item</li><br><li>Third item<br><ol><br><li>Indented item</li><br><li>Indented item</li><br></ol><br></li><br><li>Fourth item</li><br></ol> 1. First item
2. Second item
3. Third item
1. Indented item
2. Indented item
4. Fourth item

有序列表最佳实践

CommonMark and a few other lightweight markup languages let you use a parenthesis ()) as a delimiter (e.g., 1) First item), but not all Markdown applications support this, so it isn’t a great option from a compatibility perspective. For compatibility, use periods only.

✅  Do this ❌  Don't do this
1. First item<br>2. Second item 1) First item<br>2) Second item

无序列表

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

Markdown语法 HTML 预览效果
- First item<br>- Second item<br>- Third item<br>- Fourth item <ul><br><li>First item</li><br><li>Second item</li><br><li>Third item</li><br><li>Fourth item</li><br></ul> - First item
- Second item
- Third item
- Fourth item
* First item<br>* Second item<br>* Third item<br>* Fourth item <ul><br><li>First item</li><br><li>Second item</li><br><li>Third item</li><br><li>Fourth item</li><br></ul> - First item
- Second item
- Third item
- Fourth item
+ First item<br>+ Second item<br>+ Third item<br>+ Fourth item <ul><br><li>First item</li><br><li>Second item</li><br><li>Third item</li><br><li>Fourth item</li><br></ul> - First item
- Second item
- Third item
- Fourth item
- First item<br>- Second item<br>- Third item<br>    - Indented item<br>    - Indented item<br>- Fourth item <ul><br><li>First item</li><br><li>Second item</li><br><li>Third item<br><ul><br><li>Indented item</li><br><li>Indented item</li><br></ul><br></li><br><li>Fourth item</li><br></ul> - First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item

无序列表最佳实践

Markdown applications don’t agree on how to handle different delimiters in the same list. For compatibility, don't mix and match delimiters in the same list — pick one and stick with it.

✅  Do this ❌  Don't do this
- First item<br>- Second item<br>- Third item<br>- Fourth item + First item<br>* Second item<br>- Third item<br>+ Fourth 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.

渲染效果如下:

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

    > A blockquote would look great below the second list item.

*   And here's the third list item.

渲染效果如下:

  • This is the first list item.

  • Here's the second list item.

    A blockquote would look great below the second list item.

  • And here's the third 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:

    <html>
     <head>
       <title>Test</title>
     </head>
    
  3. Update the title to match the name of your website.

图片

1.  Open the file containing the Linux mascot.
2.  Marvel at its beauty.

    ![Tux, the Linux mascot](/assets/images/tux.png)

3.  Close the file.

渲染效果如下:

  1. Open the file containing the Linux mascot.

  2. Marvel at its beauty.

    Tux, the Linux mascot

  3. Close the file.

列表

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

标签:Markdown,Third,list,列表,语法,item,Second,Fourth,First
From: https://www.cnblogs.com/liuyangQAQ/p/17315716.html

相关文章

  • Kibana查询语法使用手册【转】
    阅读目录全文搜索按字段搜索通配符搜索匹配单一字符匹配任意多个字符范围搜索布尔搜索分组搜索转义特殊字符速查全文搜索在搜索栏输入login,会返回所有字段值中包含login的文档使用双引号包起来作为一个短语搜索"likeGecko" 也可以按页面左侧显示的字段搜索限定......
  • 4、Markdown 强调语法
    Markdown强调语法通过将文本设置为粗体或斜体来强调其重要性。粗体(Bold)要加粗文本,请在单词或短语的前后各添加两个星号(asterisks)或下划线(underscores)。如需加粗一个单词或短语的中间部分用以表示强调的话,请在要加粗部分的两侧各添加两个星号(asterisks)。Markdown语法HTML......
  • django 1.8 官方文档翻译:2-1-1 模型语法
    模型模型是你的数据的唯一的、权威的信息源。它包含你所储存数据的必要字段和行为。通常,每个模型对应数据库中唯一的一张表。基础:每个模型都是django.db.models.Model的一个Python子类。模型的每个属性都表示数据库中的一个字段。Django提供一套自动生成的用于数据库访问的API;详......
  • Java基础语法
    Java基础语法注释、标识符、关键字注释注释并不会被执行,是给我们程序员看的书写注释是一个非常好的习惯Java注释的分类:单行注释://多行注释:/***/文档注释标识符标识符的作用用来表示变量名、类名、方法名、数组名和文件名等是一个有效的字......
  • 08列表(list)与元组(tuple)
    列表(list)与元组(tuple)列表的格式>-[数据1,数据2,数据3,数据4,......]>-列表可以存储多个数据,数据之间的逗号以英文分割而且可以数据是不同类型的数据,列表是可变数据类型。>-空列表list_data=[]或者list_data=list()列表的创建#使用[]直接创建列表li=[1,2,......
  • Python的函数的缺省值参数(空列表)之坑
    Fromhttps://www.jianshu.com/p/9f899d829562 defadd(x,lst=[]):ifnot(xinlst):lst.append(x)returnlstlist1=add(1)print(list1)list2=add(2)print(list2)list3=add(3,[11,12,13,14])print(list3)list4=add(4)print(list4......
  • Java基础语法
    注释、标识符、关键字注释注释并不会被执行,是给我们程序员看的书写注释是一个非常好的习惯Java注释的分类:单行注释://多行注释:/****/文档注释标识符标识符的作用用来表示变量名、类名、方法名、数组名和文件名等是一个有效的字符序列......
  • Redis源码之ZipList压缩列表
    List(版本3.2之前)、Hash和SortedSet这三种数据类型,都可以使用压缩列表(ziplist)来保存数据。新版本Redis的quickList底层也是采用zipList支持,Redis版本更新频繁,本文不保证时效性。 一、ziplist结构ziplist是一个特殊双向链表,不像普通的链表使用前后指针关联在一起,它是存储......
  • mysql insert|replace语法
    insert语法replace语法版权声明:本文所有权归作者!商业用途转载请联系作者授权!非商业用途转载,请标明本文链接及出处!赞成、反驳、不解的小伙伴,欢迎一起交流!......
  • helm模板文件chart编写语法
    一、简单介绍1、快速创建一个chart模板helmcreatemychartmychart├──charts├──Chart.yaml├──templates│  ├──deployment.yaml│  ├──_helpers.tpl│  ├──hpa.yaml│  ├──ingress.yaml│  ├──NOTES.txt│  ├─......