Adjust widths in Markdown grid tables so that they match on round-trip.

This commit is contained in:
John MacFarlane 2016-11-15 16:48:24 +01:00
parent 298e6f38f9
commit 0dfcedad7e

View file

@ -638,7 +638,7 @@ gridTable opts headless aligns widths headers' rawRows = do
then replicate numcols (1.0 / fromIntegral numcols) then replicate numcols (1.0 / fromIntegral numcols)
else widths else widths
let widthsInChars = map let widthsInChars = map
((\x -> x - 1) . floor . (fromIntegral (writerColumns opts) *)) widths' ((\x -> x - 3) . floor . (fromIntegral (writerColumns opts) *)) widths'
let hpipeBlocks blocks = hcat [beg, middle, end] let hpipeBlocks blocks = hcat [beg, middle, end]
where h = maximum (1 : map height blocks) where h = maximum (1 : map height blocks)
sep' = lblock 3 $ vcat (map text $ replicate h " | ") sep' = lblock 3 $ vcat (map text $ replicate h " | ")