From c4fdf28815764760751be0a61c180aba0bb57c93 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 7 Jan 2016 10:40:30 -0800 Subject: Markdown reader: renormalize table column widths if they exceed 100%. Closes #2626. --- src/Text/Pandoc/Readers/Markdown.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 7b1341af4..77c3a1016 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1452,11 +1452,16 @@ table = try $ do caption <- case frontCaption of Nothing -> option (return mempty) tableCaption Just c -> return c + -- renormalize widths if greater than 100%: + let totalWidth = sum widths + let widths' = if totalWidth < 1 + then widths + else map (/ totalWidth) widths return $ do caption' <- caption heads' <- heads lns' <- lns - return $ B.table caption' (zip aligns widths) heads' lns' + return $ B.table caption' (zip aligns widths') heads' lns' -- -- inline -- cgit v1.2.3