gpt4 book ai didi

python - Python 文档字符串 (Sphinx) 中的 csv 表格式 - 一个单元格中的多行

转载 作者:太空狗 更新时间:2023-10-30 02:43:14 25 4
gpt4 key购买 nike

我正在使用 Sphinx 来记录一个 Python 项目。

似乎与 .. csv-table:: 指令有些不一致。

主要问题是单元格中的新行。还有我可疑的心理健康状况。

以下代码:

.. csv-table::
:header: Header1, Header2, Header3

A, B, "These lines appear as one line,
even though they are written in two lines."
C, D, "| These lines appear as two lines,
| but they are indented, and my OCD will simply not allow it."
E, F, "| If I continue this line in another line,
it will appear in a new line."
G, H, "If there is a blank line between the two lines,

there will be a blank line between the lines."

将呈现为:

enter image description here

我已经搜索了整个 reStructuredText 手册,但找不到解决它的方法。

有没有办法在一个单元格中写两行,显示为第二行,但没有缩进?

主题是 sphinx_rtd_theme。

我找到了 theme.css 文件(C:\Python34\Lib\site-packages\sphinx_rtd_theme\static\css\theme.css),但是找不到换行样式的表定义部分

最佳答案

行 block 在 sphinx_rtd_theme 中有一个左边距值。摆脱它们的一种方法是创建一个自定义 CSS 文件,该文件导入主题的样式规则,并为没有该边距的表格内的行 block 添加规则。假设一个 Sphinx 项目的标准文件名和路径名:

在您的 Sphinx 项目中创建一个 _static/css/mystyle.css 文件,内容如下:

@import "theme.css";

table.docutils div.line-block {
margin-left: 0;
}

将以下选项添加到 conf.py:

html_style = 'css/mystyle.css'

重建 Sphinx 项目。

关于python - Python 文档字符串 (Sphinx) 中的 csv 表格式 - 一个单元格中的多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34194728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com