git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: Improved pipe table relative widths.

Previously pipe table columns got relative widths (based on the header underscore lines) when the source of one of the rows was greater in width than the column width. This gave bad results in some cases where much of the width of the row was due to nonprinting material (e.g. link URLs). Now pandoc only looks at printable width (the width of a plain string version of the source), which should give better results. Thanks to John Muccigrosso for bringing up the issue.

commitdd8df6cfbc07271f10f380620ecf8867bf3da8c3 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 3 Dec 2015, 11:02 (11 years ago) parente5c72ca
2 files changed+8−7
README+4−3 src/Text/Pandoc/Readers/Markdown.hs+4−4
README+4−3
@@ -2254,9 +2254,10 @@ legal (though ugly) pipe table:
22542254
22552255The cells of pipe tables cannot contain block elements like paragraphs
22562256and lists, and cannot span multiple lines. If a pipe table contains a
2257−row that is wider than the column width (see `--columns`), then the cell
2258−contents will wrap, with the relative cell widths determined by the widths
2259−of the separator lines.
2257+row whose printable content is wider than the column width (see
2258+`--columns`), then the cell contents will wrap, with the
2259+relative cell widths determined by the widths of the separator
2260+lines.
22602261
22612262Note: pandoc also recognizes pipe tables of the following
22622263form, as can be produced by Emacs' orgtbl-mode:
src/Text/Pandoc/Readers/Markdown.hs+4−4
@@ -1341,10 +1341,10 @@ pipeTable :: MarkdownParser ([Alignment], [Double], F [Blocks], F [[Blocks]])
13411341pipeTable = try $ do
13421342 nonindentSpaces
13431343 lookAhead nonspaceChar
1344− ((heads, rawHead),(aligns, seplengths)) <- (,) <$>
1345− withRaw pipeTableRow <*> pipeBreak
1346− (lines', rawRows) <- unzip <$> many (withRaw pipeTableRow)
1347− let maxlength = maximum $ map length (rawHead : rawRows)
1344+ (heads,(aligns, seplengths)) <- (,) <$> pipeTableRow <*> pipeBreak
1345+ lines' <- many pipeTableRow
1346+ let maxlength = maximum $
1347+ map (\x -> length . stringify $ runF x def) (heads : lines')
13481348 numColumns <- getOption readerColumns
13491349 let widths = if maxlength > numColumns
13501350 then map (\len ->