@@ -555,14 +555,14 @@ blockToMarkdown' opts t@(Table caption aligns widths headers rows) = do
555555 case True of
556556 _ | isSimple &&
557557 isEnabled Ext_simple_tables opts -> fmap (nest 2,) $
558− pandocTable opts (all null headers) aligns' widths'
558+ pandocTable opts False (all null headers) aligns' widths'
559559 rawHeaders rawRows
560560 | isSimple &&
561561 isEnabled Ext_pipe_tables opts -> fmap (id,) $
562562 pipeTable (all null headers) aligns' rawHeaders rawRows
563563 | not hasBlocks &&
564564 isEnabled Ext_multiline_tables opts -> fmap (nest 2,) $
565− pandocTable opts (all null headers) aligns' widths'
565+ pandocTable opts True (all null headers) aligns' widths'
566566 rawHeaders rawRows
567567 | isEnabled Ext_grid_tables opts &&
568568 writerColumns opts >= 8 * numcols -> (id,) <$>
@@ -633,9 +633,10 @@ pipeTable headless aligns rawHeaders rawRows = do
633633 let body = vcat $ map torow rawRows
634634 return $ header $$ border $$ body
635635
636−pandocTable :: PandocMonad m => WriterOptions -> Bool -> [Alignment] -> [Double]
636+pandocTable :: PandocMonad m
637+ => WriterOptions -> Bool -> Bool -> [Alignment] -> [Double]
637638 -> [Doc] -> [[Doc]] -> MD m Doc
638−pandocTable opts headless aligns widths rawHeaders rawRows = do
639+pandocTable opts multiline headless aligns widths rawHeaders rawRows = do
639640 let isSimple = all (==0) widths
640641 let alignHeader alignment = case alignment of
641642 AlignLeft -> lblock
@@ -664,10 +665,9 @@ pandocTable opts headless aligns widths rawHeaders rawRows = do
664665 (zipWith3 alignHeader aligns widthsInChars)
665666 let rows' = map makeRow rawRows
666667 let head' = makeRow rawHeaders
667− let maxRowHeight = maximum $ map height (head':rows')
668668 let underline = cat $ intersperse (text " ") $
669669 map (\width -> text (replicate width '-')) widthsInChars
670− let border = if maxRowHeight > 1
670+ let border = if multiline
671671 then text (replicate (sum widthsInChars +
672672 length widthsInChars - 1) '-')
673673 else if headless
@@ -676,9 +676,9 @@ pandocTable opts headless aligns widths rawHeaders rawRows = do
676676 let head'' = if headless
677677 then empty
678678 else border <> cr <> head'
679− let body = if isSimple
680− then vcat rows'
681− else vsep rows'
679+ let body = if multiline
680+ then vsep rows'
681+ else vcat rows'
682682 let bottom = if headless
683683 then underline
684684 else border