git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: renormalize table column widths if they exceed 100%.

Closes #2626.

commitc4fdf28815764760751be0a61c180aba0bb57c93 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 7 Jan 2016, 10:40 (11 years ago) parenta5efd2a
1 file changed+6−1
src/Text/Pandoc/Readers/Markdown.hs+6−1
src/Text/Pandoc/Readers/Markdown.hs+6−1
@@ -1452,11 +1452,16 @@ table = try $ do
14521452 caption <- case frontCaption of
14531453 Nothing -> option (return mempty) tableCaption
14541454 Just c -> return c
1455+ -- renormalize widths if greater than 100%:
1456+ let totalWidth = sum widths
1457+ let widths' = if totalWidth < 1
1458+ then widths
1459+ else map (/ totalWidth) widths
14551460 return $ do
14561461 caption' <- caption
14571462 heads' <- heads
14581463 lns' <- lns
1459− return $ B.table caption' (zip aligns widths) heads' lns'
1464+ return $ B.table caption' (zip aligns widths') heads' lns'
14601465
14611466--
14621467-- inline