Rapporter / pander

An R Pandoc Writer: Convert arbitrary R objects into markdown
http://rapporter.github.io/pander/
Open Software License 3.0
294 stars 66 forks source link

Feature request: Use link references in tables #352

Open dhicks opened 3 years ago

dhicks commented 3 years ago

I've been struggling the last several days with a version of #336 : I have a table with one column that contains links attached to very short text, and it ends up ridiculously wide, like a third of the table width. The attachment table.md shows the first few rows of this table (generated with pandoc.table()).

With manually-generated markdown, one workaround is to use link references. The attachment table_ref.md shows how this works in practice. This allows the problem column to be much narrower, and the result has much nicer column widths when rendered to HTML by pandoc.

So one approach to addressing this problem in pander would be to automatically replace image and link targets with these link references. To ensure uniqueness, a hash function could be used to generate link labels from the targets, in much the same way services like bit.ly automatically generate shortlinks.

table.md table_ref.md