restructuredtext - 跨越多行的单元格中的文本换行 - Sphinx ReStructuredText
问题描述
当创建一个单元格跨越多行的表格时,我注意到文本的内容不会换行,而是增加了表格的宽度以产生水平滚动条。
例如考虑以下 RST,
+-------+-----------------+
| | |
+-------+-----------------+
| | This text must |
+-------+ wrap over to |
| | the next line |
+-------+-----------------+
建成后生产,
当我增加文本的长度时,表格会水平增长。我应该怎么做才能包装?现在,我通过手动插入带有“|”的换行符来强制它换行 但产生的输出看起来很糟糕。
解决方案
您将无法覆盖colgroup
Sphinx 中的标签。您可以尝试改用rst2html5 包,它不会生成colgroup
. 另一种选择是使用 CSS 来控制列宽:
col:nth-child(1) {
width: 200px;
}
col:nth-child(2) {
width: 300px;
}
<table border="1" class="docutils">
<colgroup>
<col width="29%" />
<col width="71%" />
</colgroup>
<tbody valign="top">
<tr><td> </td>
<td> </td>
</tr>
<tr><td> </td>
<td rowspan="2">This text must
wrap over to
the next line</td>
</tr>
<tr><td> </td>
</tr>
</tbody>
</table>
推荐阅读
- macos - Anaconda 在解决环境或执行时陷入困境
- sql-server - SQL Server 超时错误仅适用于 dockerized .net 3.1 项目
- ios - 移动 IBOutlet 视图
- sas - 通过SAS改变IMPALA SQL Select语句中变量的长度
- python - 在没有 client_id 的 Python 中获取 Power BI 服务访问令牌
- python - 为什么我的终端脚本不能执行/找到我的 python 脚本?
- r - `glmsmurf()` 中的 storage.mode(xd) 错误
- vue.js - vuejs 和 storybook 的 Eslint 错误
- javascript - 如何在 React Native 的自定义组件中调用一个设置外部变量的函数?
- authentication - Minio NAS 网关安全