三级Markdown嵌套列表问题

Markdown nesting list problem at third level

我想在 markdown 文件中做一个嵌套列表。我在第三层嵌套列表时卡住了。

问题:

  1. 美国广播公司
  2. 美国广播公司
    2.1 字母表
    2.2 字母表
    2.2.1 ABC
    2.2.2 ABC
    2.2.3 ABC
    2.3 字母表
    2.4 字母表
  3. 美国广播公司

如果我在代码围栏块中编写上面的代码,它可以正常工作,但我想在没有代码围栏的情况下进行列表嵌套。

1. ABC
2. ABC  
2.1 ABC  
  2.2 ABC     
    2.2.1 ABC    
    2.2.2 ABC   
    2.2.3 ABC  
  2.3 ABC  
  2.4 ABC 
3. ABC

问题是 2.22.2.1 不是有效的列表标记。至少,它们不以句号结尾。

你没有告诉我们你使用的是哪个 Markdown 解析器。一些工具可能支持 2.2. 作为有效的列表标记(注意数字末尾的额外点),但大多数工具不支持。一般预计末尾整个数字只有一个句号

按照原来的规则explain:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

<ol>
<li>Bird</li>
<li>McHale</li>
<li>Parish</li>
</ol>

If you instead wrote the list in Markdown like this:

1.  Bird
1.  McHale
1.  Parish

or even:

3. Bird
1. McHale
8. Parish

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

因此,您的列表格式应如下所示:

1. ABC
2. ABC  
   1. ABC  
   2. ABC     
      1. ABC    
      2. ABC   
      3. ABC  
   3. ABC  
   4. ABC 
3. ABC

当然,这不提供您的嵌套数字,但这些嵌套数字无论如何都不会保留在 HTML 中。您需要一些自定义 CSS 来让 HTML 改变“项目符号”的显示方式(可能使用 list-style-type. Unfortunately, nested numbers is not an option there either. That may require some additional CSS hacks (link 指向我找到的第一个相关结果在快速搜索中。我不能保证。但是,这将是一个单独的问题。