git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: renormalize table column widths if they exceed 100%.
c4fdf28John MacFarlane
src/Text/Pandoc/Readers/Markdown.hs+6−1
@@ -1452,11 +1452,16 @@ table = try $ do
1452 caption <- case frontCaption of
1452 caption <- case frontCaption of
1453 Nothing -> option (return mempty) tableCaption
1453 Nothing -> option (return mempty) tableCaption
1454 Just c -> return c
1454 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
1455 return $ do
1460 return $ do
1456 caption' <- caption
1461 caption' <- caption
1457 heads' <- heads
1462 heads' <- heads
1458 lns' <- lns
1463 lns' <- lns
1459− return $ B.table caption' (zip aligns widths) heads' lns'
1464+ return $ B.table caption' (zip aligns widths') heads' lns'
1460
1465
1461--
1466--
1462-- inline
1467-- inline