Pandoc: table 21% width on conversion from markdown to html

Created on 4 Dec 2015  Â·  5Comments  Â·  Source: jgm/pandoc

Write the following markdown text.

|A|B|
|---------|------|
|C|D|
|E|FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF|

Get the following html with 21% width.

<table style="width:21%;">
<colgroup>
<col width="12%" />
<col width="8%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">A</th>
<th align="left">B</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">C</td>
<td align="left">D</td>
</tr>
<tr class="even">
<td align="left">E</td>
<td align="left">FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</td>
</tr>
</tbody>
</table>

Most helpful comment

I'm still not really getting this. I don't want any width set by Pandoc, and when using pandoc --columns=10000 it results in something like width: 1%.

So is it possible to have multiline tables without a width?

All 5 comments

Yes, that's by design. Read the manual under pipe tables.
When you have rows that are longer than text width, the
columns are assigned relative widths so they can wrap (this
is more important in LaTeX/PDF than in HTML). The relative
widths are controlled by the relative widths of the bars.
So if you change

 |---------|------|

to

 |-------------------------------|--------------------------|

you'll notice a difference. 100% is the column width (80 by
default by you can set it with --column.) So another
option for you would be to use a wider column width.

Not sure what you're raising here. Overall table width too small? See some discussion of this new feature in the Google group. If you're seeking to not have the widths at all, you can set the column width to a large number:

pandoc --columns 1000

BTW, I get 24% with pandoc 1.15.2.1 from:

> pandoc -t html << EOF
 >|A|B|
 >|---------|------|
 >|C|D|
 >|E|FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF|
 >EOF
<table style="width:24%;">
<colgroup>
<col width="13%" />
<col width="9%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">A</th>
<th align="left">B</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">C</td>
<td align="left">D</td>
</tr>
<tr class="even">
<td align="left">E</td>
<td align="left">FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</td>
</tr>
</tbody>
</table>

Thanks. pandoc --columns=1000 fixed it.

I'm still not really getting this. I don't want any width set by Pandoc, and when using pandoc --columns=10000 it results in something like width: 1%.

So is it possible to have multiline tables without a width?

Multiline tables always come with relative column widths.
This is necessary, because generally the cells will need
to wrap. HTML can often figure out a pleasing way to
wrap them automatically, but most other formats we support
don't; they need widths.

+++ Joshua Muheim [Jul 22 16 05:33 ]:

I'm still not really getting this. I don't want any width set by
Pandoc, and when using pandoc --columns=10000 it results in something
like width: 1%.

So is it possible to have multiline tables without a width?

—
You are receiving this because you modified the open/close state.
Reply to this email directly, [1]view it on GitHub, or [2]mute the
thread.

References

  1. https://github.com/jgm/pandoc/issues/2574#issuecomment-234531721
  2. https://github.com/notifications/unsubscribe-auth/AAAL5DH-JTJHVq2wNy_svWc8ET2a9_HNks5qYLiTgaJpZM4Gu28h
Was this page helpful?
0 / 5 - 0 ratings

Related issues

RLesur picture RLesur  Â·  3Comments

tolot27 picture tolot27  Â·  5Comments

felixsanz picture felixsanz  Â·  5Comments

timtroendle picture timtroendle  Â·  3Comments

velimir picture velimir  Â·  4Comments