狮身人面像错误 - 警告 "list-table"宽度与表 (1) 中的列数不匹配



我正在使用狮身人面像,python狮身人面像语法是:

.. list-table:: Frozen Delights!
:widths: 15 10 30 20
:header-rows: 1
* - Treat
- Quantity
- Description
* - Albatross
- 2.99
- On a stick!
* - Crunchy Frog
- 1.49
- If we took the bones out, it wouldn't be
crunchy, now would it?
* - Gannet Ripple
- 1.99
- On a stick!

尝试生成 .rst 文件时不断收到错误:WARNING "list-table" widths do not match the number of columns in table (1).我已经尝试了狮身人面像文档中的其他几个示例和其他几个示例,但似乎没有任何效果。

docutils 文档中给出的示例对我有用。

将您的示例与已发布的示例进行比较,并注意缩进、widths参数的数量以及换行方式的不同。

.. list-table:: Frozen Delights!
:widths: 15 10 30
:header-rows: 1
* - Treat
- Quantity
- Description
* - Albatross
- 2.99
- On a stick!
* - Crunchy Frog
- 1.49
- If we took the bones out, it wouldn't be
crunchy, now would it?
* - Gannet Ripple
- 1.99
- On a stick!

我知道这并不能真正回答您最初的问题,但是我遇到了同样的问题,唯一的解决方案是切换到Sphinx支持的其他格式:

+------------+------------+-----------+------------+-----------+
| Header 1   | Header 2   | Header 3  | Header 1   | Header 3  |
+============+============+===========+============+===========+
| body row 1 | column 2   | column 3  | body row 1 | column 3  |
+------------+------------+-----------+------------+-----------+
| body row 1 | column 2   | column 3  | body row 1 | column 3  |
+------------+------------+-----------+------------+-----------+
| body row 1 | column 2   | column 3  | body row 1 | column 3  |
+------------+------------+-----------+------------+-----------+
| body row 1 | column 2   | column 3  | body row 1 | column 3  |
+------------+------------+-----------+------------+-----------+

最新更新