简单表单个单元格中的多行文本?

mpe*_*pen 4 restructuredtext

我发现了这个问题,但我不希望<br>在我的单元格中显示s; 我只是想在必要时进行换行.

例如,

================  ============
a short sentence  second cell
a much longer     bottom right
  sentence
================  ============
Run Code Online (Sandbox Code Playgroud)

我希望"更长的句子"适合一个单元格.我需要使用长的文本行,除非我能找到一种方法来包装它.这可能吗?

如果相关,我正在使用带有 PDF输出的NoTex.

小智 6

此问题的解决方法是使用替换指令:

================  ============
a short sentence  second cell
|long_sentence|   bottom right
================  ============

.. |long_sentence| replace:: a much longer sentence
Run Code Online (Sandbox Code Playgroud)


ddb*_*eck 5

简单的表格样式不支持包装块.使用网格样式,如下所示:

+------------------+--------------+
| a short sentence | second cell  |
+------------------+--------------+
| a much longer    | bottom right |
| sentence         |              |
+------------------+--------------+
Run Code Online (Sandbox Code Playgroud)

这些表格使用起来比较繁琐,但它们更灵活.有关详细信息,请参阅完整文档

  • 有没有其他表格样式?对我来说似乎有点离谱,我应该摆弄ASCII艺术而不是写内容 - ReST应该是有益的. (2认同)
  • *没有其他表格样式吗?*-现在有更多样式(“ CSV表格”和“列表表格”)。参见http://docutils.sourceforge.net/docs/ref/rst/directives.html#table (2认同)

小智 5

有一个干净的方法。问题是默认情况下,列设置为无包装,因此这就是滚动的原因。要解决此问题,您必须使用以下命令覆盖CSS:

/* override table no-wrap */
.wy-table-responsive table td, .wy-table-responsive table th {
    white-space: normal;
}
Run Code Online (Sandbox Code Playgroud)