I'm using Sphinx to document a Python project.
There seems to be a bit of inconsistency with the .. csv-table::
directive.
The main issue is a new line in a cell. And my questionable mental health.
The following code:
.. 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."
Will render as:
I have searched through the entire reStructuredText manual, but could not find a way to solve it.
Is there any way to write two lines in one cell that will appear as the 2nd row, but without the indentation?
The theme is sphinx_rtd_theme.
I found the theme.css file (C:\Python34\Lib\site-packages\sphinx_rtd_theme\static\css\theme.css), but I can't find the section of the table definition for newline styling
Line blocks have a left margin value in the sphinx_rtd_theme. One way to get rid of them is to create a custom CSS file which imports the theme's style rules and add a rule for line blocks within tables without that margin. Assuming the standard file and path names of a Sphinx project:
Create a _static/css/mystyle.css
file in your Sphinx project with the following content:
@import "theme.css";
table.docutils div.line-block {
margin-left: 0;
}
Add the following option to the conf.py
:
html_style = 'css/mystyle.css'
Rebuild the Sphinx project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With