-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code blocks in rST tables incorrectly wrapped #4644
Comments
This is similar to #4572 and #4320. It's not clear that this is a bug.
specifies that the table has two columns, each 50% of the text width. Pandoc respects that. The only way to respect that constraint is to break the code block, which is simply too wide to fit in a 50% wide column. You could fix this by changing the widths, e.g.
One possible solution to all of these problems would be to increase the widths of cells arbitrarily to fit the content without bad line breaks (that is proposed in #4320). Maybe that's the thing to do, but I'm not sure. Whether we make that change or not, something will be broken in the output. Either the code will be badly wrapped, or the table will extend beyond the specified column width. Either of these calls for manual intervention. |
@jgm do the widths of columns in the ascii-drawn rST table represent anything in rST syntax? Looks like there's the .. table:: Name
:widths: 50, 50
+----...
| ... If a table in native Pandoc format has column widths defined, shoud not they be used in the |
You might be right. We use the same function to create grid tables in rst and markdown. I had thought that the widths were significant in both, but it may be that they're only significant in (pandoc) markdown. Need to do some experiments I guess. ALso, forgot to mention this before, but the tables behave differently if you select
|
@jgm should I raise another issue about column widths? I could add some examples there. |
I've determined by experimenting with rst2html.py that the actual widths of cells in grid tables are significant in the way pandoc takes them to be; they affect the widths in the HTML tables produced. However, this can be overridden with the |
this is the same problem we tackled with #4320, right? Anything we want to improve on that solution? The idea of list tables is interesting and we can discuss it on the related issue |
One more example that works fine:
|
Code blocks in table cells, having lines of more than about 30 characters, get incorrectly wrapped when writing rST.
Take this source html:
Or the same in Pandoc native format:
Pandoc writes this as the following rST:
Note the wrapped line
ml -o result.rst
. It's indented less than the code, so it becomes plain text. But even if it had the same indentation, still it would be wrong to voluntarily wrap a line of code.This rST is read to the following native data:
And then written to this HTML (I've indented it for readability):
Just to make sure that wrapping lines of code is wrong syntax, here's how Sphinx renders the same rST table:
This can be solved by writing native tables to list-tables in rST, as proposed in #4564. In list-tables, lines can be of any length and table cells can have content with complex formatting: code blocks, lists and even other tables.
The text was updated successfully, but these errors were encountered: