如何避免ReST表中的水平滚动条?

时间:2016-11-16 20:01:49

标签: html css python-sphinx restructuredtext read-the-docs

我在ReST标记中有这个表:

+---------------------------+-----------------------------------------------------------------+
| Option Line Kind          | Distinguishing Characteristic                                   |
+===========================+=================================================================+
| **Reference**             | The option name is called a (node) reference, if the value\     |
|                           | of an option is a predefined keyword for the current node\      |
|                           | class. Because the option's value is a keyword, it can not\     |
|                           | be an interpolated value.                                       |
+---------------------------+-----------------------------------------------------------------+
| **Option**                | The option uses a defined option name valid for the current\    |
|                           | node class. The value can be a fixed or interpolated string.    |
+---------------------------+-----------------------------------------------------------------+
| **User Defined Variable** | Otherwise an option line is a user defined variable. It can\    |
|                           | have fixed or interpolated string values.                       |
+---------------------------+-----------------------------------------------------------------+

Sphinx(ReadTheDocs主题)生成一个水平滚动条而不是破坏第2列中的内容。结果就是这个混乱:

enter image description here

我需要在ReST(或RTFD主题??)中更改以使其中断文本?

修改

@ aflp91的答案导致此表: enter image description here

2 个答案:

答案 0 :(得分:1)

使用

添加_static / custom.css文件
.wy-table-responsive table td {
white-space: normal;
}

不要忘记将其声明为conf.py:

def setup(app):
app.add_stylesheet('custom.css')

适用于我的测试...

答案 1 :(得分:0)

您可以对表使用CSS属性:

Overflow-x : hidden;
overflow-y : hidden;