如何在reStructuredText中创建嵌套列表? [英] How to create a nested list in reStructuredText?

查看:85
本文介绍了如何在reStructuredText中创建嵌套列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码创建正确嵌套的列表(以下 Sphinx docutils docs):

I am trying to create a properly nested list using the following code (following Sphinx and docutils docs):

1. X

  a. U
  b. V
  c. W

2. Y
3. Z

我希望这会导致两个OL,但是我得到以下输出:

I expect this to result in two OLs but I get the following output instead:

<ol class="arabic simple"> 
  <li>X</li> 
</ol> 

<blockquote> 
  <div>
    <ol class="loweralpha simple"> 
      <li>U</li> 
      <li>V</li> 
      <li>W</li> 
    </ol> 
  </div>
</blockquote> 

<ol class="arabic simple" start="2"> 
  <li>Y</li> 
  <li>Z</li> 
</ol> 

我做错了什么?无法获得以下结果?

What am I doing wrong? Is it not possible to get the following result?

<ol class="arabic simple"> 
  <li>X
    <ol class="loweralpha simple"> 
      <li>U</li> 
      <li>V</li> 
      <li>W</li> 
    </ol> 
  </li>
  <li>Y</li> 
  <li>Z</li> 
</ol> 

推荐答案

确保嵌套列表缩进到与父列表的文本相同的级别(或三个字符,以较大者为准),如下所示:

Make sure the nested list is indented to the same level as the text of the parent list (or three characters, whichever is greater), like this:

1. X

   a. U
   b. V
   c. W

2. Y
3. Z

然后您将获得预期的输出.

Then you'll get the output you expected.

这篇关于如何在reStructuredText中创建嵌套列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆