-
-
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
Pipe Tables written by pandoc cannot be written as pipe tables again #3171
Comments
This is only going to happen when you have pipe tables whose width exceeds the column width (see |
I see. When I opened this issue, I didn't think about the Unfortunately, going back to the original code I used when I first discover the issue, it has find . -maxdepth 2 -mindepth 2 -iname "*.md" -exec pandoc\
-f markdown+abbreviations+autolink_bare_uris+markdown_attribute+mmd_header_identifiers+mmd_link_attributes+mmd_title_block+tex_math_double_backslash-latex_macros\
-t markdown+raw_tex-native_spans-simple_tables-multiline_tables-grid_tables-latex_macros\
--normalize -s --wrap=none --atx-headers -o {} {} \; |
Just to make a more minimal working example: Command used: pandoc -t markdown-simple_tables-multiline_tables-grid_tables --wrap=none -s -o test.txt test.docx
pandoc -t markdown-simple_tables-multiline_tables-grid_tables --wrap=none -s -o test-2.txt test.txt
So this is a demonstration that the pandoc markdown reader and writer combination is not idempotent. |
The column widths are added because the content is wider I suppose the Markdown writer could be told that it can |
Great advice: pandoc -t markdown-simple_tables-multiline_tables-grid_tables --wrap=none --column=999 -s -o test-2.txt test.txt will now leads to correct result. However, from the manual, it seems Regarding the solution, I'm thinking may be |
I think it's worth separating these two things (columns and wrap). Infinity doesn't work anyway, since in multiline tables and grid tables we compute column widths relative to --columns; if we divide by infinity, we'll have infinitesimally narrow columns in the output! You might well want to use multiline tables, or even pipe tables with specified column widths, while not wrapping paragraphs. |
Ah, I didn't think about relative vs. absolute length. Right! Sorry, I miss it. Why |
I've just run into this too.
This sounds good. |
Requires removing `--columns=80` pandoc wrap on linter. See jgm/pandoc#3171.
Requires removing `--columns=80` pandoc wrap on linter. See jgm/pandoc#3171.
+++ Ollie Ford [Nov 04 16 16:26 ]:
Well, we need some way to determine what the relative column |
Playing with the MWE example above again, if I do $ pandoc -t native test.docx -o test-docx.native
$ pandoc -t native test.txt -o test-md.native -f markdown
$ diff test-docx.native test-md.native
1,2c1,4
< [Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
< []
---
> [Table [] [AlignDefault,AlignDefault,AlignDefault] [6.611570247933884e-2,0.5950413223140496,0.33884297520661155]
> [[]
> ,[]
> ,[]] So the difference between the 1st docx to md conversion and the 2nd md to md conversion is exactly the width. The docx reader applied zero width it.
I originally suggested The obvious benefit is then I don't have to specify an arbitrary large number which is ugly and not guarantee to work. |
+++ ickc [Nov 10 16 18:17 ]:
It's problematic because in some places we divide by columns. |
Oh, I see. You mean somewhere else other than tables. But in that case would If there's no way to remedy the situation. I think the only thing left is to add this the the MANUAL. I can help make a pull request on MANUAL.txt if you want. |
Manual already says:
|
This is a bit related to #3154, but different.
Attached are some MWE:
The tables in
test.txt
are generated by pandoc. They are both originally in.docx
and I use pandoc to convert topipe_tables
by-t markdown-simple_tables-multiline_tables-grid_tables
. But if I convert from markdown to markdown again, say,pandoc -f markdown -t markdown-multiline_tables-grid_tables -o test-pandoc.txt test.txt
, the tables would becomes HTML table, as intest-pandoc.txt
. I tried different combination, but the writer would insist to write either in multiline or grid tables, but not pipe tables (nor simple tables).I noticed that this behavior seems to happen only when the column width is wide. And looking at the HTML tables generated, it has
<col width="33%" />
in it.The text was updated successfully, but these errors were encountered: