reStructuredText 中的多行表格单元格? [英] Multi-line table cell in reStructuredText?

查看:74
本文介绍了reStructuredText 中的多行表格单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在表格单元格中输入换行符?例如,假设我有一个这样的表:

Is there a way to input a newline into a table cell? For example, say I have a table like this:

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

我希望上面的内容创建一个包含两行三列的表格,第二行第一列将项目 1 和项目 2 显示在不同的行上.

I want the above to create a table with two rows, three columns, and the second row, first column to display Item 1 and Item 2 on separate lines.

我尝试了行块语法 |,但它在表格单元格中不起作用.我可以使用列表语法,但我不希望出现项目符号.

I have tried the line blocks syntax |, but it doesn't work inside a table cell. I can use list syntax, but I don't want bullet points to appear.

推荐答案

首先我觉得你的表语法不对,应该不是:

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.

现在有了这个表,行块语法:

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

似乎有效:使用 Pandoc 进行测试,左下角单元格被转换为以下 HTML:

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>

注意Item 1Item 2 之间的换行符
.

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

这篇关于reStructuredText 中的多行表格单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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