From df1944f7740599896f0e3d3de1be2e6aafb62d6c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 18 Jan 2024 08:34:09 -0800 Subject: Markdown writer: fix output for pipe tables... ...with a huge number of columns. Previously we got invalid pipe tables when the number of table columns exceeded the setting of `--columns`. Closes #9346. --- src/Text/Pandoc/Writers/Markdown/Table.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/Markdown/Table.hs b/src/Text/Pandoc/Writers/Markdown/Table.hs index b2a220b10..caef0a0ea 100644 --- a/src/Text/Pandoc/Writers/Markdown/Table.hs +++ b/src/Text/Pandoc/Writers/Markdown/Table.hs @@ -50,7 +50,9 @@ pipeTable opts headless aligns widths rawHeaders rawRows = do not (all (== 0) widths) && maxwidth + (numcols + 1) > colwidth then map - (floor . (* fromIntegral (colwidth - (numcols +1)))) + (max 0 . + floor . + (* fromIntegral (colwidth - (numcols +1)))) widths else contentWidths let torow cs = nowrap $ literal "|" <> -- cgit v1.2.3