Multi-line table cell in reStructuredText?

拥有回忆 提交于 2019-12-03 22:40:32

First of all I think your table syntax is incorrect, should it not be:

+----------+----------+----------+
| Header 1 | Header 2 | Header 3 |
+==========+==========+==========+
| Item 1   |          |          |
| Item 2   |          |          |
+----------+----------+----------+

Note that the top row is made up of hyphens, not equal signs, and the rows are separated by pipes, |, not plus signs.

Now with this table, the line block syntax:

+----------+----------+----------+
| Header 1 | Header 2 | Header 3 |
+==========+==========+==========+
| | Item 1 |          |          |
| | Item 2 |          |          |
+----------+----------+----------+

seems to work: testing with Pandoc the bottom left cell gets transformed into the following HTML:

<td align="left">Item 1<br />Item 2</td>

Note the line break <br /> in between Item 1 and Item 2.

You can also leave a gap between the lines like this

+----------+----------+----------+
| Header 1 | Header 2 | Header 3 |
+==========+==========+==========+
| Item 1   |          |          |
|          |          |          |
| Item 2   |          |          |
+----------+----------+----------+

This method tends to be friendlier with editors so they dont think you have accidentally added an extra pipe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!