Closed dcomtois closed 5 years ago
I think this is a limitation of pandoc
and not a pander
issue, so please check with the devs there with a minimal example of a markdown file including a grid table with an image (markup) in a cell. Once we know how to do that properly in markdown, pander
will be able to kick in as well.
Just a little update, in case someone encounters the same situation: I asked the question on the pandoc discussion group, and it is indeed a limitation in pandoc. There is an easy workaround when the column containing the images is the last one:
+-------+---------------+
| color | Img |
+=======+===============+
| Blue | ![](tiny-blue-square-with-a-ridiculously-long-file-name.png) |
+-------+---------------+
... but if it's not the last column, it doesn't work.
Otherwise, here are the suggestions I got from the Pandoc discussion board:
~Only the last solution seems appropriate, at least for the moment~ (Edit: as it turns out, it also requires the use of a pandoc filter, so there is no obvious solution AFAIK.)
And it doesn't seem like there's a lot of appetite for change at this point.
Thanks, @dcomtois, these points are really useful :+1:
You're welcome! Unfortunately the workaround I was putting my faith in a non-solution since it also requires a pandoc filter. Maybe an advanced Web developer could see a solution (involving Javascript, most probably), but I had to do something far from ideal to make things work: copy the images in a subdirectory and save them using short names. That way I can put in the cells something like this:
![]img/ds001.png
...and it makes the widths perfectly fine. Only (quite annoying) problem is that it leaves garbage behind.
The column widths are affected by the length of the path to images, which should not happen... For instance, if a cell contains:
![](C:\\Users\\usr1234\\AppData\\Local\\Temp\\RtmpQhs2I7\\file3a745a6e4f4f.png)
The width will try to accomodate for all these characters.
Here's a .Rmd demo: